[cfe-dev] clang vs LIBRARY_PATH

Jack Howarth howarth at bromo.med.uc.edu
Thu Jul 7 06:14:29 PDT 2011

   While clang seems to honor CPATH, it doesn't seem to do the same for LIBRARY_PATH. For example,
when building guile 1.8.8 under fink, in order to insure that guile links against the newly built
copy, we don't pass -L/sw/lib to LDFLAGS or -I/sw/include to CPPFLAGS. Instead fink has been using...

setenv CPATH /sw/include
setenv LIBRARY_PATH /sw/lib

which compiles the conftest for __gmpz_init in -lgmp fine under gcc or llvm-gcc in configure...

[MacPro:guile18-1.8.8-3/guile-1.8.8/build] root# gcc -o conftest -g -O2 -Dmacosx conftest.c -lgmp -lm -lltdl

however clang doesn't find libgmp via LIBRARY_PATH...

[MacPro:guile18-1.8.8-3/guile-1.8.8/build] root# clang -o conftest -g -O2 -Dmacosx conftest.c -lgmp -lm -lltdl
ld: library not found for -lgmp
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Is this expected behavior for clang or should I open a PR?

More information about the cfe-dev mailing list