powerpc-apple-darwin8-gcc-4.0.1: unrecognized option '-shared' .....

bimai rodrigue

Registered
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
 
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.
 
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
 
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)
 
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
 
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
 
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
 
Back
Top