Recent

Author Topic: XMailer Installation Failure  (Read 2729 times)

Razmataz2

  • New member
  • *
  • Posts: 9
XMailer Installation Failure
« on: October 15, 2019, 05:50:11 am »
I'm trying to install XMailer from the repository via the Online Package Manager. Synapse is a dependency, and the installer is successful in downloading, opening, and compiling that package. Xmailer, however, fails with a "Fatal: Cannot find SSL_OpenSSL used by XMailer of package XMailerPkg."  I'm running Ubuntu 19.04 and ensured that I had openssl and libssl-dev (1.1.1b-1ubuntu2.4) installed before attempting to install XMailer.

Thoughts on resolving this issue?

Thanks!

Thaddy

  • Hero Member
  • *****
  • Posts: 9278
Re: XMailer Installation Failure
« Reply #1 on: October 15, 2019, 08:27:33 am »
ssl_openssl is part of synapse. Check your synapse directory and make sure it is in the project dependencies.
also related to equus asinus.

Razmataz2

  • New member
  • *
  • Posts: 9
Re: XMailer Installation Failure
« Reply #2 on: October 15, 2019, 02:21:27 pm »
Can you provide me with a bit more direction?  When you say, "Check your synapse directory," I assume you mean a physical directory on the filesystem.  Once there, am I looking for a file called ssl_openssl?

My apologies if this is overly elementary, but I'm brand new to all of this.  I have a LOT to learn.

jujibo

  • Jr. Member
  • **
  • Posts: 77
Re: XMailer Installation Failure
« Reply #3 on: October 15, 2019, 04:27:10 pm »
I'm trying to install XMailer from the repository via the Online Package Manager. Synapse is a dependency, and the installer is successful in downloading, opening, and compiling that package. Xmailer, however, fails with a "Fatal: Cannot find SSL_OpenSSL used by XMailer of package XMailerPkg."  I'm running Ubuntu 19.04 and ensured that I had openssl and libssl-dev (1.1.1b-1ubuntu2.4) installed before attempting to install XMailer.

Thoughts on resolving this issue?

Thanks!

Seems there is a problem using XMailer with libssl1.1.1 (the version you are using).

Xmailer uses function IsAvailableOpenSSL to detect if libssl is installed (you need libssl-dev installed).

Code: Pascal  [Select]
  1. function IsAvailableOpenSSL: Boolean;
  2. var
  3.   VOpenSSL: TSSLOpenSSL;
  4. begin
  5.   VOpenSSL := TSSLOpenSSL.Create(nil);
  6.   try
  7.     Result := VOpenSSL.LibVersion <> '';
  8.   finally
  9.     VOpenSSL.Free;
  10.   end;
  11. end;
  12. {$ENDIF}

In this case it returns false because LibVersion returns empty string. Probably this works with libssl1.0.X. I guess this is a bug in synapse when support for libssl1.1 was added.

For a quick fix, simply edit xmailer.pas and comment the lines from 424 to 426:

Code: Pascal  [Select]
  1. {$IFDEF OPEN_SSL}
  2.   //if not IsAvailableOpenSSL then
  3.   //  raise Exception.CreateFmt('%: SSL error: %s',
  4.   //    [Self.ClassName, 'Could not found the SSL library.']);
  5. {$ENDIF}  

I tried it using Debian 10 and libssl1.1.1d and it works. I was wondering why Xmailer was failing. I send mails with synapse and libssl1.1 without problems (I don't use xmailer. I use my own code since years ago).

I forgot to say, you need Synapse package. You can install it using Online Package Manager. Look for synapse (Synapse 40.1)
« Last Edit: October 15, 2019, 05:03:10 pm by jujibo »

Thaddy

  • Hero Member
  • *****
  • Posts: 9278
Re: XMailer Installation Failure
« Reply #4 on: October 15, 2019, 05:52:37 pm »
Yes, that works, but is an open wound.
I will try to give an example, but that is for tomorrow: dinner time.

Dead giveaway: the path (or install) is not correct. Nothing to do with code.
also related to equus asinus.

Razmataz2

  • New member
  • *
  • Posts: 9
Re: XMailer Installation Failure
« Reply #5 on: October 16, 2019, 01:21:14 am »
Unfortunately, commenting lines 424 - 426 in xmailer.pas did not have the desired effect.

Attempting to install xmailer after the comments produces the same error message at line 19 of xmailer.pas, which is line 4 in the extract below.

Code: Pascal  [Select]
  1. function IsAvailableOpenSSL: Boolean;
  2. uses
  3. {$IFDEF OPEN_SSL}
  4.   SSL_OpenSSL,
  5. {$ENDIF}
  6. {$IFDEF UTF_8_MIME}
  7.   MimeInln,
  8. {$ENDIF}
  9.   SMTPSend, MimePart, MimeMess, SynaChar, SynaUtil, Classes, SysUtils;  

I've verified that Synapse 40.1 is installed, and also double-checked to ensure that I have openssl and libssl-dev installed, both of which are version 1.1.1b-1ubuntu2.4.

Thaddy - I checked the ~/.lazarus/onlinepackagemanager/packages/synapse40.1 directory and have verified that ssl_openssl.pas is there.  Although I'm not certain that's exactly what you were suggesting I do.

Any other thoughts or suggestions on getting past this issue?

JanRoza

  • Hero Member
  • *****
  • Posts: 538
    • http://www.silentwings.nl
Re: XMailer Installation Failure
« Reply #6 on: October 16, 2019, 07:25:32 am »
Quote
Check your synapse directory and make sure it is in the project dependencies.
Did you do this as well?
Otherwise although Synapse is installed on your disk your project doesn't know about it.
So select Project Inspector from the Lazarus menu and look if Synapse is included in the list of modules that are in your project, if not add it.
OS: Windows 10 (64 bit) / Ubuntu 19.04 (64 bit)
Laz: Lazarus 2.0.4 FPC 3.0.4 i386-win32-win32/win64

Razmataz2

  • New member
  • *
  • Posts: 9
Re: XMailer Installation Failure
« Reply #7 on: October 18, 2019, 11:55:03 pm »
Since this is a package that I'm trying to install via the Online Package Manager, It's not clear to me how I go about treating this as a project.  Again, I'm BRAND NEW new to all of this, so I'm likely overlooking something very basic here.

I did download the Xmailer package and opened the xmailerpkg.lpk package file. It does list laz_synapse as a required package. If I open the xmailerpkg.lpk in Lazarus and then click compile, it does not try to install synapse (it seems to know that it's installed), but the compilation of Xmailer still fails as previously described (exact error below).

I also added laz_synapse to the Uses line in Xmailer.pas and still get the "xmailer.pas(19,3) Fatal: Cannot find SSL_OpenSSL used by Xmailer of package XMailerPkg." error.

Can someone provide me step by step instructions on how to resolve this?

Thanks for being patient with me.  I'm trying!

jujibo

  • Jr. Member
  • **
  • Posts: 77
Re: XMailer Installation Failure
« Reply #8 on: October 19, 2019, 11:14:18 am »
@Razmataz2

Well, I have find the error. Unit ssl_openssl.pas is not included in laz_synapse v40.1 package.

You can fix it easy.

Open laz_synapse package.
Press Add button and select Add files from filesystem
Select ssl_openssl.pas file
Compile.

Should be ok now. I have seen there are a few files  not included in the package (ssl related).

Thaddy

  • Hero Member
  • *****
  • Posts: 9278
Re: XMailer Installation Failure
« Reply #9 on: October 19, 2019, 05:35:17 pm »
Well, I have find the error. Unit ssl_openssl.pas is not included in laz_synapse v40.1 package.
You should probably not use that package at all. It is unsupported/unmaintained,afaik and not related to the author of Synapse.
You should use the Synapse sources from github.
also related to equus asinus.

jujibo

  • Jr. Member
  • **
  • Posts: 77
Re: XMailer Installation Failure
« Reply #10 on: October 19, 2019, 06:08:36 pm »
Well, I have find the error. Unit ssl_openssl.pas is not included in laz_synapse v40.1 package.
You should probably not use that package at all. It is unsupported/unmaintained,afaik and not related to the author of Synapse.
You should use the Synapse sources from github.

I don't use that package and I have not problems with synapse (@Razmataz2 has it). ... I'm not asking, only trying to guide @Razmataz2. He is using Online Package Manager and installed laz_synapse package and Xmailer from it.

BTW. I have take a look at  Synapse page: http://www.ararat.cz/synapse/doku.php/download It points to Sourceforge for the code. I have downloaded it from svn and checked that the package doesn't include the unit ssl_openssl.pas.

Isn't this the original code? I guess Online Package Manager created the package from original code.


Thaddy

  • Hero Member
  • *****
  • Posts: 9278
Re: XMailer Installation Failure
« Reply #11 on: October 19, 2019, 06:46:12 pm »
I confused github with svn . Sorry.
also related to equus asinus.

wp

  • Hero Member
  • *****
  • Posts: 6454
Re: XMailer Installation Failure
« Reply #12 on: October 20, 2019, 12:10:16 am »
My synapse has always been working correctly, and I am using it's ssl in my current project. But today when, motivated by this thread, I tried to compile the XMailer package I must have broken something somehow- same error message as in the first post: "unit ssl_opernssl not found". So I had to investigate...

The problem is that the the ssl_openssl.pas file is found in the synapse installation folder, but it is not included in the laz_synapse package, probably because they wanted to keep the stuff which requires external dlls should not break the non-ssl usage of the library if the dlls are not found. That's a good idea but poses a massive problem when another package or a project requires the ssl_openssl unit. Since the compiler knows only the path to the compiled package units it does not find the sources of the ssl unit.

A possibility to solve the issue is to add the path to the synapse sources to the unit search path of  the project or package, as the Delphi people are doing. I refrain from this because it ties the project/package to a given directory structure. And it can be the source of other compilation problem.

Another solution has been mentioned already above: Open the laz_synapse.lpk file in "Package" > "Open package file", click on "Add" > "Add Files from File System" and select the ss_openssl.pas file. Click "Compile", and the XMailer should be working now. What I don't like here is that a third-party package is modified here, and that any usage of the synapse library must find the ssl libraries now.

Here is another, less intrusive solution: Create a package, maybe laz_synapse_ssl, which requires laz_synapse and contains only the unit ssl_openssl. When this package is compiled (no need to "install") and is in the requirements of a package/project the IDE knows where to find ssl_openssl. I am attaching the package file which must be saved in the same folder as laz_synapse.lpk.

Now only the new package must be added to the requirements of a project/package requiring ssl. Other usages of synapse are left untouched. While this solution does not modify any synapse file it requires modification of the XMailer package because the new package must be added to the requirements. And it should be mentioned that two packages residing in the same directiory is a somewhat unstable situation - in my tests it works, though. Nothing's perfect...

I am attaching also a modified xmailer package file adjusted for the latter solution. It must replace the original one.

Unfortunately, the synapse project seems to be pretty much dead, and I don't know how to contact the authors to get this issue fixed properly.

[EDIT]
Please read my next post for a better solution with the laz_synapse_ssl package.
« Last Edit: October 20, 2019, 10:49:53 am by wp »
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

wp

  • Hero Member
  • *****
  • Posts: 6454
Re: XMailer Installation Failure
« Reply #13 on: October 20, 2019, 10:24:19 am »
There is another solution: Just copy the files ssl_openssl.pas and ssl_openssl_lib.pas from the synapse directory to the directory xmailer/src.

And a better solution for the laz_synapse_ssl package which avoids sharing the same directory with the main laz_synapse files which may lead to compilation problems: Put laz_synapse_ssl.lpk into a separate directory and copy the units ssl_openssl.pas and ssl_openssl_lib.pas there, too. I am attaching a zip for this solution: Just unzip the files to any folder, open the lpk file in "Package" > "Open Package File" and click "Compile".
« Last Edit: October 20, 2019, 10:47:56 am by wp »
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10