LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to use a newly compiled dynamic linker (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-use-a-newly-compiled-dynamic-linker-862987/)

stephen26 02-16-2011 01:52 AM

How to use a newly compiled dynamic linker
 
Hello friends,

I want to install a newly compiled linker as the default linker on my VM running Ubuntu.

I compiled and installed a new custom kernel on my VM (linux-2.6.36) and also compiled (not install) a custom gnu c library (glibc-2.11.2) on the newly installed custom kernel. I am able to run a simple helloworld.c program to verify that my program worked successfully using the newly build dynamic linker in the /elf directory.

I am stuck here... I want to replace the real linker inside /lib with the new linker that I compiled. I tried to make the soft link named ld-linux-x86-64.so.2 that originally points to the real linker file ld-2.11.1.so, point to my newly compiled linker, but my VM crashed. I also tried moving the compiled linker and wrote it over the original linker, and the VM crashed.

None of the commands worked after that as they could not access any of the shared libraries and I received this error '/bin/bash: No such file or directory'.

I also tried to change the LD_LIBRARY_PATH to point to my linker and did not have any luck there either.

Could someone tell me what I should do or point me in the right direction. I would really appreciate your help.

Thanks in advance,
Steve

knudfl 02-17-2011 10:18 AM

Welcome to LQ.

Glibc is your system, and none of its components can usually be changed.

All installed libraries, all (most) commands, most applications :
They are compiled with the original glibc, and depend on ld-2.11.1.so, etc.
Please try the command : 'ldd /bin/bash' to see the dependencies.


If you want to understand in depth, how an OS works, suggest :
Build "Linux From Scratch", LFS http://www.linuxfromscratch.org/lfs/view/stable/
The LQ LFS Forum: http://www.linuxquestions.org/questi...om-scratch-13/

..

stephen26 02-17-2011 01:06 PM

Thank you for replying.

I am not trying to change the original glibc that is installed. I am trying to run a program using the newly compiled glibc and cross compile by making the dynamic linker point to the newly compiled shared libraries in glibc-2.11.2.

I did 'ldd /bin/bash' as you said and this is what I got
linux-vdso.so.1 => (0x00007ffff1bff000)
libncurses.so.5 => /lib/libncurses.so.5 (0x00007f69d1f3e000)
libdl.so.2 => /lib/libdl.so.2 (0x00007f69d1d3a000)
libc.so.6 => /lib/libc.so.6 (0x00007f69d19b6000)
/lib64/ld-linux-x86-64.so.2 (0x00007f69d2188000)

I can see that it is dependent on ld-linux-x86-64.so.2 which points to ld-2.11.1.so . Is there a way to make that soft link ld-linux-x86-64.so.2 point to the new linker which I compiled, which would then link everything with the new shared libraries?

Steve


All times are GMT -5. The time now is 01:22 AM.