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
Problematic check for run-time libs availability in autoconf scripts #11114
Comments
Problematic, yes. Also very challenging to fix, since the autotools macro |
Maybe it is possible to temporarily change the CC variable to include the LD_LIBRARY_PATH set to By directly changing the configure script like this:
The configure script will succeed as expected. I'm not sure if it is possible to expand $CC to include this change though. IIRC, the compiler needs to be wrapped in a script in order for the expansion of CC to work correctly in this case. |
Right, something like this? diff --git a/m4/curl-functions.m4 b/m4/curl-functions.m4
index 4d4d13a40..6bef89720 100644
--- a/m4/curl-functions.m4
+++ b/m4/curl-functions.m4
@@ -5864,15 +5864,18 @@ AC_DEFUN([CURL_RUN_IFELSE], [
case $host_os in
darwin*)
AC_RUN_IFELSE([AC_LANG_SOURCE([$1])], $2, $3, $4)
;;
*)
+ oldcc=$CC
+ CC="./compiler $CC"
old=$LD_LIBRARY_PATH
LD_LIBRARY_PATH=$CURL_LIBRARY_PATH:$old
export LD_LIBRARY_PATH
AC_RUN_IFELSE([AC_LANG_SOURCE([$1])], $2, $3, $4)
LD_LIBRARY_PATH=$old # restore
+ CC=$oldcc
;;
esac
])
dnl CURL_COVERAGE and:
|
I think the I could not test the patch above as |
A simple workaround is to use curl´s cmake buildsystem. |
There are plenty of workarounds. If cmake is good enough, then that might be the easiest.
That's the only way we ever generate configure so that sounds wrong. |
in the CURL_RUN_IFELSE macro, with LD_LIBRARY_PATH set to the value of the configure invoke, and not the value that might be used later, intended for the execution of the output the compiler ouputs. For example when the compiler uses the same library (like libz) that configure checks for. Reported-by: Jonas Bülow Fixes #11114
Yes, it seems to work fine! Sorry for the delay, I had some issues bringing the patch into our buildsystem. Thanks! |
curl/m4/curl-functions.m4
Lines 5856 to 5876 in f157610
When compiling a projects and its dependencies (curl) with custom compiler flags (such as enabling address sanitizers) this autoconf macro will also test that the compiler can run with the libraries found on the path(s) set in
LD_LIBRARY_PATH
. This will result in a failure when a library used by both the compiler and curl is used.libz
is such a library.This is how configure fails:
Looking in
config.log
the error is seen:Running from command line the problem can be reproduced by:
To summarize:
LD_LIBRARY_PATH
should not be set when compilingconftest.c
in the configure script. It should only be set when running the resulting program.The text was updated successfully, but these errors were encountered: