How to specify the path of libraries?

booleandomain booleandomain@gmail.com
Sun Jun 28 12:08:00 GMT 2009


Andi Hellmund wrote:
>> The problem is that all the binaries/libraries installed in "tools"
>> are linked against the libraries in the host system. All I want to do
>> now is to break this link and make the system contained in "tools"
>> self-sufficient. In other words, I'd like to recompile binutils and
>> gcc so that they link to the libraries installed in "tools" itself.
>>
> To accomplish your task you should use the -L  and -Wl,-rpath  option to
> rebuild binutils and gcc.  The -L option specifies  which library paths
> should be used by gcc during linking - this would then select your
> libraries in the "tools" directory when gcc/collect2/ld searches for
> unresolved symbol references. As a note: this is only used during
> compilation/linking. If you now run the ldd command on the executable,
> you'll see that the default (host) system libraries will still be used
> at runtime. To get around this, -Wl,-rpath specifies which paths should
> be searched by the  runtime linker.

First of all thanks for the answer.

I tried to compile binutils with the following configure options:

CC="gcc -L/tools/lib -L/tools/lib32 -L/tools/lib64 -L/tools/libexec 
-Wl,-rpath /tools/lib -Wl,-rpath /tools/lib32 -Wl,-rpath /tools/lib64 
-Wl,-rpath /tools/libexec" ../binutils-2.19.1/configure --prefix=/tools 
--build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu 
--target=x86_64-pc-linux-gnu

but during make it says me:

checking size of int... configure: error: in 
'/mnt/sda2/tmp/lfs/sources/binutils/binutils-build/libiberty':
configure: error: cannot compute sizeof (int), 77
See 'config.log' for more details.
Make[1]: *** [configure-libiberty] Error 1

I tried compiling gcc with similar configure options, but I obtain the 
very same make error message.

What's wrong?

Thanks.



More information about the Gcc-help mailing list