1

I use ubuntu 14.10 and crosstool-ng-1.20.0 to create toolchain from host: x86_64 to target: i686, I know glibc will create ld.so but i don't know how to change the default path in ld.so from "/lib, /usr/lib" to "/lib32, /usr/lib32".

  1. I want to change the the default path from "/lib, /usr/lib" to my setting "/lib32, /usr/lib32" in ld.so on my target machine. (because I put every .so file in /lib32 for 32 bit library, and will put other .so file to /lib for x86_64 not i686)

  2. I don't want to add someflag(like "-z nodeflib", "--rpath=dir") on host in compile time to change every binary's search path on target machine. I want every binary without using theses flags can use ld.so to find the correct library

Does anyone know how to do this?

ps. I use crosstool-ng to make gcc-4.9 linaro, glibc-2.20 linaro, binutl ...etc...

SleepFish
  • 11
  • 2

1 Answers1

0

You probably do not need to change the default path, but rather add paths to the configuration.

Depending on your system, ld.so is configurable with a file in /etc/, and possibly with files under '/etc/ld.so.conf.d or /etc/ld.so.d. The manual pages for ld.so and ldconfig are a good place to start reading.

Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105
  • Thanks for Thomas~ but in my case the method won't work. In my target system, we have no /etc/ld.so* in my target machine. in my target system we don't use ld.so.d to put additional path. – SleepFish Apr 11 '15 at 12:53
  • 1
    I know library will search dependency on: 1. DT_RPATH 2. environment variable LD_LIBRARY_PATH 3. DT_RUNPATH 4. From the cache file /etc/ld.so.cache 5. In the default path /lib, and then /usr/lib. But we don't want to change the env value and binary's cflag, so 1~3 method we won't use. And in my target system, we have no /etc/ld.so* in my target machine. in my target system we don't use ld.so.d to put additional path. so method 4 won't work. so I still have to change the default path in ld.so on method 5. – SleepFish Apr 11 '15 at 12:57