This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Can not link to shared libraries with LD_LIBRARY_PATH.
- From: Ian Lance Taylor <iant at google dot com>
- To: Helcio Wagner <hwsilva at yahoo dot com dot br>
- Cc: "gcc-help\ at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Thu, 21 Jun 2012 22:49:01 -0700
- Subject: Re: Can not link to shared libraries with LD_LIBRARY_PATH.
- References: <1340341524.44430.YahooMailNeo@web140804.mail.bf1.yahoo.com>
Helcio Wagner <hwsilva@yahoo.com.br> writes:
> Â ÂI am using gccÂ4.6.3 on Ubuntu 12.04.Â
>
> Â ÂFirst of all, I have no LD_LIBRARY_PATH environment variable set. Should I have it?
>
> Â ÂWell, I've edited '.bashrc' file to define LD_LIBRARY_PATH and pointed it to '/usr/lib' and '/usr/local/lib' directories:
>
> export LD_LIBRARY_PATH=/usr/lib:/usr/local/lib
It is not normally necessary to add these directories to
LD_LIBRARY_PATH. See "man ldconfig".
> Â ÂMy executable (named 'test') needs to be linked to two shared libraries to be generated: 'libncx.so.2.2' and 'libagt.so.2.2'. Both are located on '/usr/lib' directory. However, when I type 'gcc -Wall test2.c', there is a message relating undefined references. The executable was not generated.
A problem at link time is most likely not due to LD_LIBRARY_PATH.
When reporting an error message, please cut and paste the exact,
complete, error output. Otherwise we don't know what happened.
Ian