I have the same Problem with clang. If I specify the library path in the developer tools with:
clang helloworld.cpp -L /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
it compiles fine.
However I need clang to search this path by itself since it is called from another program.
Adding the path or exporting it as DYLNLIBRARYPATH didn't work.
Does anyone know how to do this?