I am building a small embedded system for a x86_64 target, with a Linux kernel and an initramfs which contains a dynamically linked busybox.
I tried to install the needed libraries (
/lib and the linker
/lib64( because the busybox binary request it at this place).
lib ├── libc.so.6 └── libm.so.6 lib64 └── ld-linux-x86-64.so.2
but it failed to link:
/sbin/init: error while loading shared libraries: libm.so.6: cannot open shared object file: No such file or directory
I managed to make it work by moving everything in
lib64 ├── ld-linux-x86-64.so.2 ├── libc.so.6 └── libm.so.6
or by creating a symlink between
lib ├── ld-linux-x86-64.so.2 ├── libc.so.6 └── libm.so.6 lib64 -> lib
But I still don't understand why the first configuration do not work. Why the linker is not able to find libraries in
EDIT: To make it working properly (Thanks to yaegashi):
- Go into your initramfs root directory.
Create a file
/etc/ld.so.confwith the library path you need.
echo /lib > etc/ld.so.conf
ldconfig -r .
- Re generate your initramfs. It's done