LinuxQuestions.org
Help answer threads with 0 replies.
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 06-24-2009, 03:12 PM   #1
Rituparna
LQ Newbie
 
Registered: Jun 2009
Posts: 18

Rep: Reputation: 0
Error: collect 2: ld returned 1 exit status


I am trying to install the program "r8s" onto my RHEL 5 through its makefile.

I am getting the following error. Any help would be appreciated.

Code:
[Ritu@localhost src]$ make
gcc   -o r8s  -L/sw/lib   DrawTree.o TreeSim.o moment.o powell.o ConstrOpt.o MyUtilities.o WuLi.o DistrFuncs.o NRCvectorUtils.o distance.o penalty.o ObjFunc.o main.o relativeRates.o ReadNexusFile2.o  memory.o root3taxa.o TimeAlgorithms.o nextToken2.o storeNexusFile.o MinND.o TreeUtils.o structures.o blas.o tn.o TNwrapper.o continuousML.o ancestral.o -lg2c -lm  
/usr/bin/ld: cannot find -lg2c
collect2: ld returned 1 exit status
make: *** [r8s] Error 1
 
Old 06-24-2009, 03:20 PM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
That is an error from the linker, telling you that it cannot find a library it is looking for, called libg2c.so or something very similar to that.

Verify that the library it seeks is actually on the machine somewhere, and add a linker include argument directing the linker where to look for it.

If there is a ./configure script you are using first, before the 'make', you can probably add an argument to that script when you execute it, which will be passed on to the linker.

Cheers,
Sasha

Last edited by GrapefruiTgirl; 06-24-2009 at 03:22 PM.
 
Old 06-25-2009, 09:05 AM   #3
Rituparna
LQ Newbie
 
Registered: Jun 2009
Posts: 18

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by GrapefruiTgirl View Post
Verify that the library it seeks is actually on the machine somewhere, and add a linker include argument directing the linker where to look for it.
Thanks for the response. I am new to Linux, so I am not sure how to do the things you have mentioned. Could you or someone else please elaborate?

How do I verify if this library exists and then how do I add a linker?
 
Old 06-25-2009, 09:33 AM   #4
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Well, if you use a configure script first, then type `configure --help` and near the bottom of the output, it will show (or it should show) how to add a location for the linker to look in for the libraries it wants. Something like:

EXTRA_LIBS=-L/usr/local/lib


or

EXTRA_LIB=-l/usr/lib/libg2c.so

Though these are rough examples; you can also "export" these type of arguments, so you don't need to give them with the configure/make commands.

To see if a library actually exists on the machine, try the `locate` or `find` commands.

Sasha
 
Old 06-25-2009, 10:11 AM   #5
Rituparna
LQ Newbie
 
Registered: Jun 2009
Posts: 18

Original Poster
Rep: Reputation: 0
When I searched for libg2c.so, it said that there was no such file or directory. Where can I get this file?
 
Old 06-25-2009, 10:18 AM   #6
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Best I can tell from a quick Google search, is that it is part of the GCC compiler package.

On my system, libg2c.so is in /usr/lib.

Sasha
 
Old 06-25-2009, 10:24 AM   #7
Rituparna
LQ Newbie
 
Registered: Jun 2009
Posts: 18

Original Poster
Rep: Reputation: 0
I found libg2c.so in my /usr/lib. Now I just have to figure out how to link it...

Last edited by Rituparna; 06-25-2009 at 10:27 AM.
 
Old 06-25-2009, 10:58 AM   #8
Rituparna
LQ Newbie
 
Registered: Jun 2009
Posts: 18

Original Poster
Rep: Reputation: 0
I am still not sure how to add a location for the linker to look in to find this library. There is no configure script.
 
Old 06-25-2009, 12:32 PM   #9
Rituparna
LQ Newbie
 
Registered: Jun 2009
Posts: 18

Original Poster
Rep: Reputation: 0
Can I edit the makefile itself?

This is a portion of the original makefile:

PHP Code:
# Make file for r8s
# Updated April 2003 for Linux and Mac OS 10.2. No other builds currently supported
#

FC g77  # Fortran compiler; standard on Linux, may have to go fetch this on OS X! (get it from Fink)
CC gcc  # GNU C compiler
LIBS =  -lg2c -lm  # FORTRAN to C library, and standard C library 
LPATH = -L/sw/lib  # This is the directory where Mac's Fink stuck the g2c library 
#CFLAGS = -g -std=c99 -pedantic  # for debugging, etc. 
CFLAGS =  # usual case 
I edited LPATH to equal -L/usr/lib, which is where libg2c.so and libm.so can be found. It still gives the same error, though...
 
Old 06-25-2009, 01:54 PM   #10
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Yes, you probably *could* edit the makefile, either to add/adjust the LIBS path, and/or maybe the very gcc command that failed, you could put a linker search path there.
If you do, keep comments anywhere you change something so if you get mixed up, you know what you've done. Of course, you must have an archive of the sourcecode for this anyway, just in case.

Depending how long/complex the Makefile is, it may take a while to figure out all the locations!

Sasha
 
Old 06-25-2009, 02:47 PM   #11
Rituparna
LQ Newbie
 
Registered: Jun 2009
Posts: 18

Original Poster
Rep: Reputation: 0
Okay, I was able to edit the makefile successfully. Thanks for your help!
 
Old 06-25-2009, 02:54 PM   #12
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Excellent, Well done!

Sasha
 
  


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
cannot find -lpcap collect2: ld returned 1 exit status nasim751 Programming 1 02-12-2008 01:57 PM
ld: cannot find -lc collect2: ld returned 1 exit status ArbuZz Linux From Scratch 3 09-27-2005 12:52 AM
collect2: ld returned 1 exit status abirami Linux - Software 0 03-02-2005 01:07 AM
konstruct error collect2: ld returned 1 exit status X2O Linux - Software 2 08-11-2004 08:48 PM
popa3d collect2: ld returned 1 exit status datapunk Linux - Software 1 01-02-2004 06:48 PM

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

All times are GMT -5. The time now is 10:52 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