Compiling GCC with -rpath

Mike Pelley mike@solidum.com
Thu Aug 23 07:50:00 GMT 2001


I'm trying to compile GCC (c,c++,java) with -rpath and -L flags to link
against the proper runtime libraries.  My thought was to set
CFLAGS="-L${LIB_DIR}/lib -Wl,-rpath,${LIB_DIR}/lib"

ldd shows me that these flags create executables that are linking
against the proper libraries and they work well.  However, I noticed my
gcj is incorrectly linked against /lib libraries.  I figured this was
because it was c++ code, so CFLAGS wouldn't apply.  No problem, just set
CPPFLAGS="-L${LIB_DIR}/lib -Wl,-rpath,${LIB_DIR}/lib".

However, a lot of the compile lines include both CFLAGS and CPPFLAGS and
the make dies if the flags are included twice.  How can I have these
flags applied against each dynamically linked executable only once?

Thanks!  Mike.



More information about the Gcc-help mailing list