LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-14-2007, 09:05 PM   #1
linuxcrazyguy
LQ Newbie
 
Registered: Mar 2007
Posts: 28

Rep: Reputation: 15
gcc compile static & .so


Is there a way to include all .so files inside a binary compiled with gcc?

And one more thing, are .so files architecture dependent? Is there such thing as an .so file that won't work on an older system ?

Thanks guys
 
Old 03-15-2007, 12:35 AM   #2
Junior Hacker
Senior Member
 
Registered: Jan 2005
Location: North America
Distribution: Debian testing Mandriva Ubuntu
Posts: 2,687

Rep: Reputation: 61
Usually .so refers to a "which-ever version", as there are different versions of packages due to updates and bug fixes or distribution specific. So the request is for a package by a given name, version depends on which distribution and/or which version your package manager decides is needed based on dependencies of packages already installed.
Most times I find it is a package not installed and with an rpm distro I go to http://rpm.pbone.net and put the name of the package with the .so and hit search to find which one is for my distribution.
Or one could just issue command:

yum install package.so
or
urpmi package.so
or
apt-get install package.so

Depending on which is your package manager.
 
Old 03-15-2007, 02:36 AM   #3
lorebett
Member
 
Registered: May 2004
Location: Italy
Distribution: Ubuntu, Gentoo
Posts: 57

Rep: Reputation: 16
To compile a package (that comes with configure script) in a static way I use these commands:

Code:
configure LDFLAGS=-static
make LDFLAGS=-all-static
 
Old 03-15-2007, 06:07 AM   #4
psisquare
Member
 
Registered: Sep 2004
Location: Germany
Distribution: Gentoo
Posts: 164

Rep: Reputation: 31
Well, technically you can't (to the best of my knowledge) statically link against .so files (= include them in the executable). What lorebett suggested will actually link against .a files and, depending on your distribution, these may reside in development packages of the corresponding libraries that you'll have to install separately.

How strongly .so and .a files are tied to a specific architecture depends on how they are compiled. Gcc accepts a lot of command line switches that optimize generated code for a specific CPU family, most notably -march. Depending again on your distribution, the installed libraries may run on any x86 system or only on 586 (Pentium) and beyond. In any case, you can't use the same libraries on completely different architectures like, say, x86 and PowerPC.
 
  


Reply



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
I need a static version of GCC d1s4st3r Programming 1 03-23-2006 11:59 AM
problem when trying to static link with gcc glvgfz Programming 11 09-18-2005 07:58 PM
about GCC compiler and static memory grupoapunte Programming 1 05-07-2005 07:11 PM
How can I use gcc to build a static library? vtluu Red Hat 1 04-12-2004 10:45 AM
gcc -static doesn't work ! tceast Programming 8 09-08-2003 07:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:45 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
Open Source Consulting | Domain Registration