LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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-03-2012, 04:16 AM   #1
ammayappan
LQ Newbie
 
Registered: Sep 2011
Posts: 14

Rep: Reputation: Disabled
To compile against particular version of library


Hi,
I want to compile my program against particular version(like libc.so.0 than the default libc.so.6)of library.How to do that?


thanks and regards
appan.
 
Old 02-03-2012, 10:44 PM   #2
lisle2011
Member
 
Registered: Mar 2011
Location: Surrey B.C. Canada (Metro Vancouver)
Distribution: Slackware 2.6.33.4-smp
Posts: 183
Blog Entries: 1

Rep: Reputation: 25
Compiling against different libraries

Number One, make a good backup, restore it to test it's integrity.

Now go ahead and try if you have libc.so.0 There will be copious problems.
Difficulties between libraries built for different versions will certainly give you a headache.

If you were super keen and happy to track down all the bits I still wouldn't mix versions.


---------------------------------------------------------------------------
If the information was valuable to you give me a pat on the back (click my rep)
 
Old 02-03-2012, 11:08 PM   #3
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
Caveat: I have not done this myself, but according to two pages I found online (linked at the bottom of this reply), you simply include the specific .so or .a file in the gcc command line. For instance:

Quote:
Code:
gcc -Wall calc.c /usr/lib/libm.a -o calc
Keep in mind, I assume that works with any library you would normally link with using the -l or -L options to gcc. However, because libc is automatically linked, this may not work for it. You may need to do some research to disable ld's automatic inclusion of '-lc' when linking.

The pages I mentioned earlier:
Stack Overflow: How do you link to a specific version of a shared library in GCC
Excerpt from: An Introduction to GCC
 
Old 02-07-2012, 06:30 AM   #4
ammayappan
LQ Newbie
 
Registered: Sep 2011
Posts: 14

Original Poster
Rep: Reputation: Disabled
Hi,
Thanks for your suggestions.

I am actually cross compiling Eglibc for the ARM architecture using the Linaro Tool chain.
I cross compiled Eglibc.When i tried to verify it, by linking an application against the eglibc's libc.so.6, it was taking the default libc.so.6, that was actaully present in the Cross-compiler and not my copy of libc.so.6.

As per the caveat of Dark Helmet, it was not working.

So how should i proceed.As per my understanding,in x86,the linker ie ld, reads /etc/ld.so.conf and also the directories specified in the LD_LIBRARY_PATH to take the libraries.
In that way, is there any path or file that needs to be modified?
And any hints on how to disable the automatic inclusion of -lc while loading and link my version of libc.

thanks and regards
appan.
 
  


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
How to compile against an alternate library version klappnase Linux - General 5 12-07-2011 03:44 PM
library version ust Linux - Software 1 01-07-2008 06:55 AM
library version sha_neb Linux - Software 3 08-01-2007 03:07 AM
library version?? kaz2100 Debian 1 11-11-2006 10:58 AM
howto compile bin with my library using all-static and shared linked standart library stpg Programming 4 06-29-2004 05:20 AM


All times are GMT -5. The time now is 09:07 AM.

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