LDFLAGS ignored during some configure checks

Liviu Ionescu ilg at livius.net
Mon Apr 22 23:25:55 CEST 2024


The configure script does not use `$LDFLAGS` in all compiler invocations, and in cases when the compiler requires mandatory linker options (like for passing `-Wl,-rpath`, or `-static` if the compiler is not installed in a system location), most of the checks fail for not being able to run the resulting binary.

My workaround is to patch `configure` and add `$LDFLAGS` to all the C & C++ compile lines:

```
sed -i.bak \
-e 's|gmp_compile="$cc $cflags $cppflags conftest.c >&5"|gmp_compile="$cc $cflags $cppflags conftest.c $LDFLAGS \>\&5"|' \
-e 's|gmp_cxxcompile="$CXX $CPPFLAGS $CXXFLAGS conftest.cc >&5"|gmp_cxxcompile="$CXX $CPPFLAGS $CXXFLAGS conftest.cc $LDFLAGS \>\&5"|' \
"${XBB_SOURCES_FOLDER_PATH}/${gmp_src_folder_name}/configure"
```

It is functional, but not particularly elegant.

Could you consider a proper solution for this issue?


Thank you,

Liviu



More information about the gmp-bugs mailing list