LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-16-2011, 01:52 AM   #1
stephen26
LQ Newbie
 
Registered: Feb 2011
Posts: 2

Rep: Reputation: 0
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
 
Old 02-17-2011, 10:18 AM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2016 CentOS6.9 CentOS7.3 + 50+ other Linux OS, for test only.
Posts: 16,625

Rep: Reputation: 3266Reputation: 3266Reputation: 3266Reputation: 3266Reputation: 3266Reputation: 3266Reputation: 3266Reputation: 3266Reputation: 3266Reputation: 3266Reputation: 3266
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/

..
 
Old 02-17-2011, 01:06 PM   #3
stephen26
LQ Newbie
 
Registered: Feb 2011
Posts: 2

Original Poster
Rep: Reputation: 0
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Stuck on dynamic linker jmc1987 Linux From Scratch 1 10-11-2009 12:06 AM
how to choose dynamic linker for a.out file? surfer41 Programming 4 07-03-2008 02:32 PM
Linker is linking to the latest compiled changes manikan Programming 2 03-02-2006 10:41 AM
Linux dynamic linker thedevilsjester Programming 4 09-20-2005 07:11 PM
can't load dynamic linker '/lib/ld.so schatoor Linux - General 4 01-06-2003 06:19 AM


All times are GMT -5. The time now is 11:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration