Hint when compiling with another openssl library #2615

Closed
AlBundyLoves69 opened this Issue May 28, 2018 · 8 comments

Comments

Projects
None yet
2 participants
@AlBundyLoves69

I would like to provide an information which could be published in the installation manual in order to help others.

When curl is compiled with another openssl version than the system default it is often not possible to set the library path from the new openssl version in /etc/ld.so.conf because this may break the system.

In this case the configure script fails running conftest when it is using the openssl libraries with ./conftest: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory.

The only way in this case is to use the rpath linker option.

Solution:
Before running ./configure execute export LDFLAGS="-Wl,--rpath=/<path-to-correct-openssl-libraries>"

@bagder

This comment has been minimized.

Show comment
Hide comment
@bagder

bagder May 28, 2018

Member

Are you suggesting that as a change for docs/INSTALL ?

Personally I tend to just set LD_LIBRARY_PATH if this is more of a temporary thing/work-around.

Member

bagder commented May 28, 2018

Are you suggesting that as a change for docs/INSTALL ?

Personally I tend to just set LD_LIBRARY_PATH if this is more of a temporary thing/work-around.

@AlBundyLoves69 AlBundyLoves69 changed the title from Hint for compiling with another openssl library to Hint when compiling with another openssl library May 28, 2018

@AlBundyLoves69

This comment has been minimized.

Show comment
Hide comment
@AlBundyLoves69

AlBundyLoves69 May 28, 2018

Not really a change - I suggest a note in how to install curl and libcurl.

There is the LDFLAGS note but this is not enough. When the openssl libraries are somewhere else which is not set in /etc/ld.so.conf then configure script fails.

Honestly, for me it doesn't matter, if you prefer LD_LIBRARY_PATH then it is of course also OK. I personally like the rpath linker option because in this case I don't depend on any external settings - the path is hard-coded into the executable.

Notice:
From the above mentioned page:
If you have shared SSL libs installed in a directory where your run-time linker doesn't find them (which usually causes configure failures), you can provide the -R option to ld on some operating systems to set a hard-coded path to the run-time linker:

LDFLAGS=-R/usr/local/ssl/lib ./configure --with-ssl

This doesn't work for gcc 7.3.0. This is the output in config.log:

gcc: error: unrecognized command line option '-R'

This works:

LDFLAGS=-Wl,-R/usr/local/ssl/lib ./configure --with-ssl

Adding -Wl, doesn't break it. How ever, a small modification in the installation guide would help...

Not really a change - I suggest a note in how to install curl and libcurl.

There is the LDFLAGS note but this is not enough. When the openssl libraries are somewhere else which is not set in /etc/ld.so.conf then configure script fails.

Honestly, for me it doesn't matter, if you prefer LD_LIBRARY_PATH then it is of course also OK. I personally like the rpath linker option because in this case I don't depend on any external settings - the path is hard-coded into the executable.

Notice:
From the above mentioned page:
If you have shared SSL libs installed in a directory where your run-time linker doesn't find them (which usually causes configure failures), you can provide the -R option to ld on some operating systems to set a hard-coded path to the run-time linker:

LDFLAGS=-R/usr/local/ssl/lib ./configure --with-ssl

This doesn't work for gcc 7.3.0. This is the output in config.log:

gcc: error: unrecognized command line option '-R'

This works:

LDFLAGS=-Wl,-R/usr/local/ssl/lib ./configure --with-ssl

Adding -Wl, doesn't break it. How ever, a small modification in the installation guide would help...

@bagder

This comment has been minimized.

Show comment
Hide comment
@bagder

bagder May 28, 2018

Member

When the openssl libraries are somewhere else which is not set in /etc/ld.so.conf then configure script fails

No it doesn't. If it does, that's a bug! The configure script sets and uses LD_LIBRARY_PATH specifically to deal with this.

I would be very happy if you would provide your suggested phrasing as actual diffs to the source file. Also note that you're talking about linker options to a specific linker so any docs would need to clarify that this is system/linker specific. And as you say, possibly even version specific.

Member

bagder commented May 28, 2018

When the openssl libraries are somewhere else which is not set in /etc/ld.so.conf then configure script fails

No it doesn't. If it does, that's a bug! The configure script sets and uses LD_LIBRARY_PATH specifically to deal with this.

I would be very happy if you would provide your suggested phrasing as actual diffs to the source file. Also note that you're talking about linker options to a specific linker so any docs would need to clarify that this is system/linker specific. And as you say, possibly even version specific.

@AlBundyLoves69

This comment has been minimized.

Show comment
Hide comment
@AlBundyLoves69

AlBundyLoves69 May 28, 2018

Wait, it must be a new bug because I tried it with curl 7.58 and there it works! So check the changes from 7.58 to 7.60! Thank you for mentioning it because I almost forgot. I had to solve it so I was working on it last weekend until I found the solution with the rpath linker option.

This is the command line:

./configure --prefix=/FaF/curl --with-ssl=/FaF/openssl --disable-ldap --without-zlib --disable-proxy --disable-ipv6 --disable-manual

With 7.58 it works without any additional LDFLAGS setting, with 7.60 it fails.

Wait, it must be a new bug because I tried it with curl 7.58 and there it works! So check the changes from 7.58 to 7.60! Thank you for mentioning it because I almost forgot. I had to solve it so I was working on it last weekend until I found the solution with the rpath linker option.

This is the command line:

./configure --prefix=/FaF/curl --with-ssl=/FaF/openssl --disable-ldap --without-zlib --disable-proxy --disable-ipv6 --disable-manual

With 7.58 it works without any additional LDFLAGS setting, with 7.60 it fails.

@bagder

This comment has been minimized.

Show comment
Hide comment
@bagder

bagder May 28, 2018

Member

Yes, #2586 for example is a fix since 7.60.0 and is directly related to this. So please try a daily snapshot first.

Member

bagder commented May 28, 2018

Yes, #2586 for example is a fix since 7.60.0 and is directly related to this. So please try a daily snapshot first.

@AlBundyLoves69

This comment has been minimized.

Show comment
Hide comment
@AlBundyLoves69

AlBundyLoves69 May 28, 2018

Yep, I confirm, the latest daily snapshot works! I will check out periodically if a new version is available.


So, there would be more or less only the hint in the installation guide regarding the rpath linker option or preceding LDFLAGS with -Wl, so it works for gcc.

Yep, I confirm, the latest daily snapshot works! I will check out periodically if a new version is available.


So, there would be more or less only the hint in the installation guide regarding the rpath linker option or preceding LDFLAGS with -Wl, so it works for gcc.

@bagder

This comment has been minimized.

Show comment
Hide comment
@bagder

bagder May 28, 2018

Member

Thanks for confirming. The next release date is planned for July 11th.

Member

bagder commented May 28, 2018

Thanks for confirming. The next release date is planned for July 11th.

bagder added a commit that referenced this issue May 28, 2018

INSTALL: LDFLAGS=-Wl,-R/usr/local/ssl/lib
... the older description doesn't work

Reported-by: Peter Varga
Fixes #2615

@bagder bagder closed this in c10f3a1 May 29, 2018

@bagder

This comment has been minimized.

Show comment
Hide comment
@bagder

bagder May 29, 2018

Member

Thanks @AlBundyLoves69, the updated description has now landed!

Member

bagder commented May 29, 2018

Thanks @AlBundyLoves69, the updated description has now landed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment