LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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 10-13-2010, 05:21 PM   #1
Philmac
LQ Newbie
 
Registered: Sep 2010
Distribution: Fedora 9
Posts: 11

Rep: Reputation: 1
Question /usr/bin/ld: cannot find -lfoo when trying to compile


Hello,

I'm trying to compile a program in Fedora 9 2.6.27.25-78.2.56.fc9.x86_64 and I get the following errors:

Code:
g++  -o"test"  ./sample1.o   -lfoo -lbar
/usr/bin/ld: skipping incompatible /usr/local/lib/libfoo.a when searching for -lfoo
/usr/bin/ld: cannot find -lfoo
collect2: ld returned 1 exit status
make: *** [test] Error 1
I've tried to compile in both Eclipse and using the makefile I was provided and I get the exact same errors both ways. libfoo.a and libbar.a do exist and are in /usr/local/lib/ and I have executed ranlib on both of them. I also don't know what to make of "skipping incompatible"; I'm new to Linux and am not a programmer by trade so I am completely unfamiliar with this type of error. After some Googeling I found solutions ranging from "just ignore it, it doesn't matter" to needing to install missing devel packages.

Any ideas?

Thanks in advance
 
Old 10-13-2010, 07:52 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,671
Blog Entries: 54

Rep: Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953
Quote:
Originally Posted by Philmac View Post
I also don't know what to make of "skipping incompatible"; (..) After some Googeling I found solutions ranging from "just ignore it, it doesn't matter" to needing to install missing devel packages.
I think it expects to find compatible libs in /usr/local/lib64/. Maybe explicitly using "-L/usr/local/lib64" may help if you have got your x86_64 library versions there?
 
Old 10-14-2010, 10:06 AM   #3
Philmac
LQ Newbie
 
Registered: Sep 2010
Distribution: Fedora 9
Posts: 11

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by unSpawn View Post
I think it expects to find compatible libs in /usr/local/lib64/. Maybe explicitly using "-L/usr/local/lib64" may help if you have got your x86_64 library versions there?
Thanks for the response unSpawn. I copied the libraries to .../lib64 but I get the same errors, although the compiler complains about the libraries in /lib64 now. What's strange about this is that before I installed the libraries in .../lib(64) the compiler complained about missing definitions, now that the libraries are installed the compiler complains about not being able to find the libraries.

Code:
g++  -o"test"  ./sample1.o   -lfoo -lbar
/usr/bin/ld: skipping incompatible /usr/local/lib64/libfoo.a when searching for -lfoo
/usr/bin/ld: skipping incompatible /usr/local/lib/libfoo.a when searching for -lfoo
/usr/bin/ld: cannot find -lfoo
collect2: ld returned 1 exit status
make: *** [test] Error 1
 
Old 10-14-2010, 04:15 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,671
Blog Entries: 54

Rep: Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953
Sorry if I'm stating the obvious but as it still is skipping the incompatible /usr/local/lib64/libfoo.a I wonder if you've got the right version? Just moving it to another directory doesn't turn a ELF32 object into a ELF64 one. Did you build the libraries yourself? If not, did you install from a x86_64 package? Could I suggest you revisit all development tools you installed as you might not have all required multilib / or x86_64 development packages?
 
Old 10-15-2010, 11:56 AM   #5
Philmac
LQ Newbie
 
Registered: Sep 2010
Distribution: Fedora 9
Posts: 11

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by unSpawn View Post
Sorry if I'm stating the obvious but as it still is skipping the incompatible /usr/local/lib64/libfoo.a I wonder if you've got the right version? Just moving it to another directory doesn't turn a ELF32 object into a ELF64 one. Did you build the libraries yourself? If not, did you install from a x86_64 package? Could I suggest you revisit all development tools you installed as you might not have all required multilib / or x86_64 development packages?
I was provided with the .a files and do not have the source. According to the vendor, only 32 bit architecture is supported, does that mean it's impossible for me to compile on my 64 bit OS? I tried compiling on another computer running RHEL3 32 bit and got the error "undefined reference to __ctype_b", which I fixed using the solution outlined in comment #8 here: http://oss.sgi.com/bugzilla/show_bug.cgi?id=243 (not sure if this actually fixes the problem), so now it compiles but when I try to run the program I get a segmentation fault error. On the PC running Fedora 64 bit I have the most recent versions of Eclipse and gcc.
 
Old 10-18-2010, 10:22 AM   #6
Philmac
LQ Newbie
 
Registered: Sep 2010
Distribution: Fedora 9
Posts: 11

Original Poster
Rep: Reputation: 1
Solved this issue (albeit revealing yet another issue) using make -n and manually entering the gcc commands and adding the -m32 switch. For some reason adding the -m32 flag did not work in Eclipse.
 
  


Reply

Tags
compile error, eclipse, g++, 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
echo $PATH = /home/g3rc4n/bin:/usr/local/bin:/usr/bin:/bin:/usr/games ? i_heart_pandas Linux - Software 7 09-18-2009 09:33 AM
Failed to chck remot comnd executin using shells /usr/bin/ssh and /usr/bin/rsh farnaw4u Linux - Software 2 04-06-2009 01:08 AM
Is '/usr/bin/find' reliable if '/bin/ls' has been replaced? DigaMe Linux - Security 2 11-12-2004 11:42 PM
/usr/bin/find :No such file or Directory errors while trying to compile kernel. Zero-0-Effect Linux From Scratch 2 05-29-2004 04:46 PM
Xawtv - Wont compile - /usr/bin/ld: cannot find -lXpm Bubba256 Linux - Software 0 10-26-2003 01:38 AM


All times are GMT -5. The time now is 08:04 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration