ld: common symbols not allowed with MH_DYLIB output format with the -multi_module option

Mathieu Malaterre mmalater@nycap.rr.com
Fri Jun 10 21:48:00 GMT 2005


On Jun 10, 2005, at 3:45 PM, Mike Stump wrote:

> I'd put this more simply...
>
> On Monday, June 6, 2005, at 02:06  PM, Mathieu Malaterre wrote:
>>    I have a question about a valid C code. I am trying to compile the 
>> following code in MacOSX (*). I don't understand what the problem is?
>
> You must use -fno-common when you are building dynamic libraries on 
> darwin.
>
>> Could someone please explain me what is going on?
>
> You didn't use -fno-common.
>
>
>
Can someone please tell me then which one of the three possibilities is 
the right one:

#1. I need to tell the linker to use -single_module
#2. Rewrite the code to make a fake initialization
#3. I need to pass -fno-common to the compiler

I really don't understand why I need to do that, since this is valid C 
code. Why the linker does not default to proper option, or why the 
-fno-common option isn't used. At compile time gcc should figure that 
out, right ?

Now compared to the linker option, at least the compiler flag I can 
specify it for the specific file I want, which is great. But then again 
why is this up to the user to do it ? Is there a performance reason ? 
Why isn't it the default ?

How do other people do when porting *nix lib to MacOSX ? Is this is 
trial-and-error process to get the lib compiled ?

Thanks
Mathieu



More information about the Gcc mailing list