Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not export LD_LIBRARY_PATH globally #2490

Closed
mikhirev opened this issue Apr 13, 2018 · 6 comments
Closed

Do not export LD_LIBRARY_PATH globally #2490

mikhirev opened this issue Apr 13, 2018 · 6 comments
Labels

Comments

@mikhirev
Copy link

Hello!

In configure.ac paths to SSL libraries are added to LD_LIBRARY_PATH, that is exported immediately after that. In some cases this leads to breaking the toolchain, improper configuration and impossibility to compile.

In my particular case, I have custom openssl installation in non-standard prefix, and some other libraries, including zlib, there. After openssl is found and its path is added to LD_LIBRARY_PATH, some subsequent tests fail because ccache segfaults (it uses zlib to compress/decompress cached object files). ./configure finishes successfully, but compilation fails because of incorrect configuration.

As custom LD_LIBRARY_PATH is needed to execute tests only, it is better to set it when running tests, but not during configuration and build.

curl/libcurl version

Applicable to any version, including master.

operating system

Solaris 10 with gcc and ccache from opencsw, but also possible to reproduce on any Unix-like system.

@bagder bagder added the build label Apr 13, 2018
@bagder
Copy link
Member

bagder commented Apr 13, 2018

If you look closer, you'll see that the configure scripts builds and executes a few of the tests. Those tests will fail if it can't link with the libs it has already detected it should use. Your bad ccache install is perhaps the first thing to fix here...

If you can make configure only use LD_LIBRARY_PATH in some more limited contexts and have that work, I'd welcome that.

@mikhirev
Copy link
Author

mikhirev commented Apr 13, 2018

Adding -L<PATH> to linker options (is't it already there?) and executing tests with env LD_LIBRARY_PATH="$MY_LD_LIBRARY_PATH" ./sometest will solve the problem with tests in configure. My ccache installation is fine, but it needs to use system libraries, but not those I want to link curl to…

@bagder
Copy link
Member

bagder commented Apr 13, 2018

-L is for link-time, so it doesn't help the run-time when executing tests.

I presume we can make a wrapper macro for AC_RUN_IFELSE that sets and unsets the LD_LIBRARY_PATH accordingly to make it only affect the actual running of the the tests...

bagder added a commit that referenced this issue Apr 13, 2018
... only set it when we actually have to run tests to reduce its impact on for
example build commands etc.

Fixes #2490

Reported-by: Dmitry Mikhirev
@bagder
Copy link
Member

bagder commented Apr 16, 2018

Does my suggested change make it better for you?

@mikhirev
Copy link
Author

@bagder thank you, it does exactly what I need. Test build in my environment passed successfully.

@bagder
Copy link
Member

bagder commented Apr 16, 2018

Lovely, thanks for the confirmation. I'll merge that...

@bagder bagder closed this as completed in 2d4c215 Apr 16, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jul 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

2 participants