Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


  Search this Thread
Old 04-02-2009, 10:28 AM   #1
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:

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

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

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

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


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
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 > Forums > Linux Forums > Linux - Software

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

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