Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > help(teach) me (to) compile this app?

help(teach) me (to) compile this app?
Thread Tools
Senior User
Join Date: Sep 2000
Location: Shallow Alto, CA
Status: Offline
Reply With Quote
Oct 19, 2003, 07:56 PM
 
Only having a limited knowledge of compiling UNIX apps, I have immediately run into problems compiling an app that I need. The authors say that it compiles on linux, IRIX, Solaris, AIX, Cygwin, etc so I thought it would be trivial to compile it for OSX, but alas I was wrong.

The app is located
here

Here's the makefile

Code:
CC = gcc CFLAGS = -O3 -Wall -Wno-char-subscripts -DLinux .SUFFIXES : .dg .dh .dgd .dhd .DG .DH .DGD .DHD .dg.DG : machine.pl 999999 $< .dh.DH : machine.pl 0 $< .dgd.DGD : machine.pl 999999 $< .dhd.DHD : machine.pl 0 $< all : progs utils data-rna data-dna progs : Bin/hybrid-ss-min Bin/hybrid-min utils : Bin/ct-energy Bin/energy.o : Src/energy.c Src/energy.h Src/os.h $(CC) $(CFLAGS) -c Src/energy.c -o Bin/energy.o Bin/hybrid-ss-min.o : Src/hybrid-ss-min.c Src/energy.h Src/getopt.h Src/os.h Src/util.h Src/version.h Src/options.h $(CC) $(CFLAGS) -c Src/hybrid-ss-min.c -o Bin/hybrid-ss-min.o Bin/hybrid-ss-min : Bin/energy.o Bin/hybrid-ss-min.o $(CC) $(CFLAGS) Bin/energy.o Bin/hybrid-ss-min.o -lm -o Bin/hybrid-ss-min -liberty strip Bin/hybrid-ss-min Bin/hybrid-min.o : Src/hybrid-min.c Src/energy.h Src/getopt.h Src/os.h Src/util.h Src/version.h Src/options.h $(CC) $(CFLAGS) -c Src/hybrid-min.c -o Bin/hybrid-min.o Bin/hybrid-min : Bin/energy.o Bin/hybrid-min.o $(CC) $(CFLAGS) Bin/energy.o Bin/hybrid-min.o -lm -o Bin/hybrid-min -liberty strip Bin/hybrid-min Bin/ct-energy.o : Src/ct-energy.c Src/energy.h Src/getopt.h Src/os.h Src/util.h Src/version.h $(CC) $(CFLAGS) -c Src/ct-energy.c -o Bin/ct-energy.o Bin/ct-energy : Bin/energy.o Bin/ct-energy.o $(CC) $(CFLAGS) Bin/energy.o Bin/ct-energy.o -o Bin/ct-energy -lm -liberty strip Bin/ct-energy data-rna : Dat/asint1x2.DG Dat/asint1x2.DH Dat/dangle.DG (TRUNCATED TO MAKE READABLE) data-dna : Dat/asint1x2.DGD Dat/asint1x2.DHD (TRUNCATED TO MAKE READABLE) clean : -rm Bin/*.o Bin/hybrid-ss-min Bin/ct-energy
running make gives me this

Code:
gcc -O3 -Wall -Wno-char-subscripts -DDarwin Bin/energy.o Bin/hybrid-ss-min.o -lm -o Bin/hybrid-ss-min -liberty ld: can't locate file for: -liberty make: *** [Bin/hybrid-ss-min] Error 1
I have no idea what -liberty is and commenting it out gives

Code:
gcc -O3 -Wall -Wno-char-subscripts -DDarwin Bin/energy.o Bin/hybrid-ss-min.o -lm -o Bin/hybrid-ss-min ld: Undefined symbols: _getopt_long make: *** [Bin/hybrid-ss-min] Error 1
So at this point I have completely exhausted my knowledge of compiling Unix apps.

Any help/suggestions would be greatly appreciated. Thanks in advance for any help you can provide.
     
P
Moderator
Join Date: Apr 2000
Location: Gothenburg, Sweden
Status: Offline
Reply With Quote
Oct 20, 2003, 04:25 PM
 
You're missing some code library called liberty.a or something like that. Check the ReadMe about what libs you should have installed before compiling. Also make sure that the libs in question are in the directories searched by make.
     
Registered User
Join Date: Oct 2003
Status: Offline
Reply With Quote
Oct 20, 2003, 10:06 PM
 
'-liberty' is telling the linker that you want libiberty.dylib or libiberty.a linked into your executable.

Could be a typo. Maybe it's supposed to be -lliberty (note the extra lowercase 'L' at the beginning).

Though, I looked in my /usr/lib and didn't see a libliberty.dylib or libliberty.a anywhere (and anyway, they don't sound familiar either).

Hmm... evidently, this library contains some exported symbol named _getopt_long which looks to me like some very basic function for getting "--longoptions" from the command line.

Isn't that part of some very basic GNU library?

Does this project have a mailing list? Try there, or maybe on the project's web site message board (if there is one). Otherwise, maybe email the author? Let us know how it goes.
     
   
Thread Tools
Forum Links
Forum 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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 04:05 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2