LIBRARY_PATH Ignored but -L Works in Development Environment Script?
Adrien Guillon
aj.guillon@gmail.com
Wed Jun 27 14:54:00 GMT 2012
Hi everyone,
I am attempting to setup a development environment on my system, which
uses the latest gcc and new libraries for my projects. I don't want
my programming environment to interfere with my actual production
system, and this approach has the advantage that I can easily try out
different combinations of libraries. The environment will be entered
by executing a shell script that allows me to just use the new
libraries and binaries without much fuss.
Since I have installed other libraries into this environment, I need
to tell gcc where to find them. I set the LIBRARY_PATH variable, but
it seems to be ignored. When I compile a program depending on
libraries aside from those bundled with gcc, I get linker errors (with
LIBRARY_PATH set as shown below), if I pass -L everything is okay. It
looks as if LIBRARY_PATH is getting ignored.
Here is the script I am running right now:
# Where the new compiler is located
DEVELOPMENT_ENV=/opt/development_env_2012_06
# Setup path
export PATH=$DEVELOPMENT_ENV/gcc-compiler/bin:$PATH
# Runtime access to libraries
export LD_LIBRARY_PATH=$DEVELOPMENT_ENV/gcc-compiler/lib64:$DEVELOPMENT_ENV/lib:$LD_LIBRARY_PATH
# LIBRARY PATHS
export LIBRARY_PATH="$DEVELOPMENT_ENV/gcc-compiler/lib64:$DEVELOPMENT_ENV/lib"
# INCLUDES
export CPATH=$DEVELOPMENT_ENV/usr/include
export CPPFLAGS="-L$DEVELOPMENT_ENV/lib -L$DEVELOPMENT_ENV/gcc-compiler/lib64"
export CFLAGS="-L$DEVELOPMENT_ENV/lib -L$DEVELOPMENT_ENV/gcc-compiler/lib64"
More information about the Gcc-help
mailing list