LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 04-02-2009, 10:28 AM   #1
kmccall
LQ Newbie
 
Registered: Apr 2008
Location: Houston, TX
Distribution: Centos 2.4
Posts: 2

Rep: Reputation: 0
Possible misuse of g++ -static link option


I used the g++ -static link option and am getting some odd results. My question is, does -static interfere with the dynamic linking of shared libraries other than the one that I specify on the command line?

The details: my original compilation command was this:

Code:
g++ -o mav <...snip...> -lm  -lgfortran
The specified library libgfortran.a is not available on our system, but libgfortran.so.1 is. I replaced the "-lgfortran" as follows, hoping that I could link statically with only libgfortran.so.1 and not affect linking with any other shared library:

Code:
g++ -o mav <...snip...> -lm  -static  /usr/lib/libgfortran.so.1
The code compiles and links without any error messages, but when I run "mav", I get this error:

bash: ./mav: /usr/lib/libc.so.1: bad ELF interpreter: No such file or directory

Did my use of the -static option prevent the linker from finding libc.so.1 and/or any other shared libraries?
 
  


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
ld static link failed ???? SkinnerC Ubuntu 2 11-27-2008 02:03 PM
Not able to link static library in makefie dsouza_jack Linux - General 9 12-20-2007 10:26 AM
Static Link Compile Tutorial firefly2442 Programming 1 12-30-2006 01:35 PM
problem when trying to static link with gcc glvgfz Programming 11 09-18-2005 07:58 PM
how to static link a specific library? koodailar Programming 3 07-26-2004 03:35 PM

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

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