image
image

Go Back   macosx.com > Mac Help Forums > Unix & X11

Reply
 
Thread Tools
  #1  
Old April 3rd, 2007, 09:04 AM
Registered User
 
Join Date: Apr 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
bimai rodrigue is on a distinguished road
powerpc-apple-darwin8-gcc-4.0.1: unrecognized option '-shared' .....

Hi to all of you,

first of all my english is not that good but i hope i can express myself so that everybody can understand me.

I'm trying to compile a code using a makefile. This has been implemented for Unix platform and now i am trying to run it on Mac OS X(Tiger). My makefile looks like this:

SHELL=/bin/bash

PREFIX=/usr/local

.PHONY : all
all : fnf.tgt

fnf.tgt : fnf.c ivl_target.h
gcc -Wall -O2 -shared -o fnf.tgt fnf.c

.PHONY : install
install : all
install fnf.tgt $(PREFIX)/lib/ivl/fnf.tgt
install fnf.conf $(PREFIX)/lib/ivl/fnf.conf

.PHONY : uninstall
uninstall :
-rm $(PREFIX)/lib/ivl/fnf.tgt
-rm $(PREFIX)/lib/ivl/fnf.conf

clean:
-rm fnf.tgt

The first error is :
powerpc-apple-darwin8-gcc-4.0.1: unrecognized option '-shared'

and then:

/usr/bin/ld: Undefined symbols:
_main
_ivl_const_bits
_ivl_const_pin
_ivl_const_pins

etc ...

_ivl_signal_port
collect2: ld returned 1 exit status
make: *** [fnf.tgt] Error 1

The real problem occurs in the line : gcc .... fnf.c
This line must generate a file(image) named fnf.tgt.
Has anybody idea how i can fix the problem?

Thanx
Reply With Quote
  #2  
Old April 5th, 2007, 02:53 PM
Registered User
 
Join Date: Mar 2005
Posts: 197
Thanks: 0
Thanked 1 Time in 1 Post
artov is on a distinguished road
gcc has normally an option -shared , but the manual page says:

This option is not supported on Mac OS X.

So, even if -shared is allowed option, OS X's gcc drops it.

But, I do not understand your problem. Your makefile says that the you
like to make a file named fnt.tgt. So when you run make, you get the
file. So what problem you have ?

If you do not like the name, rename it to something else.

Undefined _main tells that your program does not make program. Ooops
I mean that on C programs, function named main() is run when you start
the program. Linker has to find the main (renamed as _main), otherwise
it cannot build the program.
Reply With Quote
  #3  
Old April 6th, 2007, 06:46 AM
Registered User
 
Join Date: Apr 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
bimai rodrigue is on a distinguished road
Hi artov,

thank you for helping me. First i did not get the file fnf.tgt when i run make because of this error:

/usr/bin/ld: Undefined symbols:
_main
_ivl_const_bits
_ivl_const_pin
_ivl_const_pins

etc ...

_ivl_signal_port
collect2: ld returned 1 exit status
make: *** [fnf.tgt] Error 1

normally these symbols are defined in my header-file "ivl_target.h". My problem is that, when i run make, instead of getting the file "fnf.tgt" i get an error.
Do you have any idea how i can fix this problem?

Thank you
Reply With Quote
  #4  
Old April 6th, 2007, 11:18 AM
macbri's Avatar
Mac (r)evolution
 
Join Date: Jun 2005
Location: Ireland
Posts: 250
Thanks: 1
Thanked 0 Times in 0 Posts
macbri is on a distinguished road
You need to find where routines such as ilv_const_pin() etc. are. For example if they're in a library file that's built before fnf.tgt, that library needs to be used when linking the target app (e.g. gcc -o fnf.tgt fnf.o -L. -livllib or something). Or provide the source files directly if that will work, (e.g. gcc -o fnf.tgc fnf.c ivl.c)
Reply With Quote
  #5  
Old April 6th, 2007, 02:17 PM
Registered User
 
Join Date: Apr 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
bimai rodrigue is on a distinguished road
Hi Macbri,

all these routines are in my header file ivl_target.h ... i tried both:
1: gcc -L/usr/include -o fnf.tgt fnf.c
2: gcc -o fnf.tgt fnf.c ivl_target.h
3: gcc -L/usr/local/lib/ivl -o fnf.tgt fnf.c

where /usr/include is the path where the headers files are saved and /usr/local/lib/ivl is the path where the librairies are stored, but it doesn't work.

do you have more idea? Thank you
Reply With Quote
  #6  
Old April 6th, 2007, 11:47 PM
macbri's Avatar
Mac (r)evolution
 
Join Date: Jun 2005
Location: Ireland
Posts: 250
Thanks: 1
Thanked 0 Times in 0 Posts
macbri is on a distinguished road
The arguments you're passing to gcc aren't quite right. You use the "-I" flag to specify directories to search for include files, and "-L" to specify directories to search during the link stage for libraries. So your command should be:

Code:
gcc -I/usr/include -o fnf.tgt fnf.c -L/usr/local/lib/ivl
However, two things about this:

1: /usr/include is searched by default for include files so you can omit that
2: Although we've provided the library *directory* we haven't provided any library *names*.

To provide the library names, use the "-l" (minus small el) flag and the library name minus the extension and the "lib" prefix. For example, if you have a library called libABC.a, the link argument would be "-lABC". So take a look in /usr/local/lib/ivl and see what library files are in there, and be sure to link against them.

For example, let's say your library files are libone.a, libtwo.a, then your compile/link command would be:

Code:
gcc -o fnf.tgt fnf.c -L/usr/local/include/ivl -lone -ltwo
Reply With Quote
  #7  
Old April 7th, 2007, 07:17 AM
Registered User
 
Join Date: Apr 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
bimai rodrigue is on a distinguished road
Hi Macbri,

i tried what you said but it still doesn't work. I don't what i can do ... does somebody know what file with extension .tgt are? i didn't find nothing about it. The reason why i need fnf.tgt is: i am installing a software "confluence", you can find it in internet free ... This makes it easy to construct “verification-benches” to prove the correctness of a model without simulation. Everything works well but when i try to generate a NuSMV-Model(verification bench) from a Verilog program(simulation bench) i get the error that the fnf.tgt file missed ... then i look up under the directories from confluence and i found this makefile which generates this fnf.tgt. May be you can take a look at this software and see if you can install it on mac osx ... thank you for all
Reply With Quote
  #8  
Old April 9th, 2007, 02:09 PM
Registered User
 
Join Date: Mar 2005
Posts: 197
Thanks: 0
Thanked 1 Time in 1 Post
artov is on a distinguished road
http://filext.com/detaillist.php?extdetail=TGT says, that .tgt is "Watcom c" individual target. The link it gives cannot be
opened, however.

You might like to check http://www.openwatcom.org/index.php/Main_Page about makefiles Watcom uses etc.
Reply With Quote
Reply

Thread Tools

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump


All times are GMT -5. The time now is 06:44 AM.


Mac Support® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2000-2008 DigitalCrowd, Inc.