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

Mike Stump mrs@apple.com
Fri Jun 10 22:27:00 GMT 2005


On Friday, June 10, 2005, at 02:48  PM, Mathieu Malaterre wrote:
>>> 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

#3.

> 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 ?

I refuse to answer that on that basis that marketing people might see 
my answer.  :-)  Let's just call it a `bug'.

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

They use libtool, and it `knows' about -fno-common:

     darwin* | rhapsody*)
       # PIC is the default on this platform
       # Common symbols not allowed in MH_DYLIB files
       _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
       ;;



More information about the Gcc mailing list