Can't build shared or dynamic libraries on Mac OS X

Tron Thomas tron.thomas@verizon.net
Sun Nov 9 02:10:00 GMT 2003


I just downloaded, built, and installed GCC 3.3.2 on Mac OS X 10.2.8.

I am unable to compile either a shared object library or a dynamic 
linked shared library

If I use:
gcc -shared -o Shared Shared.c

I get:
unrecognized option `-shared'

This is not unreasonable because the version of GCC that ship with the 
operating system (version 3.1) doesn't accept this syntax either.

However, if I use:
gcc -dynamiclib -o Shared Shared.c

I get a lot of output like:

warning: unrecognized gcc debugging option: m
Starting parse
Entering state 0
Reading a token: Next token is 261 (SCSPEC `typedef')
Reducing via rule 3 (line 496),  -> @1
state stack now 0

and finally an error about no reference to main implying that GCC was 
trying to build an application rather than a library.

The same command will successfully build a library when used with 
version 3.1 of GCC that ships with the operating system.

What do I need to do so I can build dynamic libraries with GCC?



More information about the Gcc-help mailing list