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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
06-24-2009, 03:12 PM
|
#1
|
LQ Newbie
Registered: Jun 2009
Posts: 18
Rep:
|
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
|
|
|
06-24-2009, 03:20 PM
|
#2
|
LQ Guru
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594
|
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.
|
|
|
06-25-2009, 09:05 AM
|
#3
|
LQ Newbie
Registered: Jun 2009
Posts: 18
Original Poster
Rep:
|
Quote:
Originally Posted by GrapefruiTgirl
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?
|
|
|
06-25-2009, 09:33 AM
|
#4
|
LQ Guru
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594
|
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
|
|
|
06-25-2009, 10:11 AM
|
#5
|
LQ Newbie
Registered: Jun 2009
Posts: 18
Original Poster
Rep:
|
When I searched for libg2c.so, it said that there was no such file or directory. Where can I get this file?
|
|
|
06-25-2009, 10:18 AM
|
#6
|
LQ Guru
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594
|
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
|
|
|
06-25-2009, 10:24 AM
|
#7
|
LQ Newbie
Registered: Jun 2009
Posts: 18
Original Poster
Rep:
|
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.
|
|
|
06-25-2009, 10:58 AM
|
#8
|
LQ Newbie
Registered: Jun 2009
Posts: 18
Original Poster
Rep:
|
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.
|
|
|
06-25-2009, 12:32 PM
|
#9
|
LQ Newbie
Registered: Jun 2009
Posts: 18
Original Poster
Rep:
|
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...
|
|
|
06-25-2009, 01:54 PM
|
#10
|
LQ Guru
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594
|
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
|
|
|
06-25-2009, 02:47 PM
|
#11
|
LQ Newbie
Registered: Jun 2009
Posts: 18
Original Poster
Rep:
|
Okay, I was able to edit the makefile successfully. Thanks for your help!
|
|
|
06-25-2009, 02:54 PM
|
#12
|
LQ Guru
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594
|
Excellent, Well done!
Sasha
|
|
|
All times are GMT -5. The time now is 10:52 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|