-shared

Bradley Giesbrecht brad at pixilla.com
Fri Aug 6 18:42:24 PDT 2010


On Aug 6, 2010, at 6:26 PM, Ryan Schmidt wrote:

> On Aug 6, 2010, at 19:27, Bradley Giesbrecht wrote:
>
>> I read that -shared is ignored by Apples gcc compiler.
>>
>> man gcc says not supported.
>> ...
>> -shared
>>          Produce a shared object which can then be linked with  
>> other objects to form an executable.  Not all systems support this  
>> option.  For predictable
>>          results, you must also specify the same set of options  
>> that were used to generate code (-fpic, -fPIC, or model suboptions)  
>> when you specify this
>>          option.[1]
>>
>>          This option is not supported on Mac OS X.
>> ...
>>
>> The final command of my port looks like this and the result seems  
>> to be working.
>>
>> cc -c -dynamiclib -fno-common -undefined dynamic_lookup -fPIC - 
>> shared -Wall -Wextra ......
>>
>> I can patch the -shared out but if it is safely ignored I'd rather  
>> not because I'm trying to get a patch excepted upstream and for  
>> some to other lines and would rather have as little impact as  
>> necessary.
>>
>> Can anyone confirm that -shared will just be ignored by Apple gcc  
>> and thereby be safe in our MacPorts environment?
>
> My recollection is that -shared is ignored by Snow Leopard's  
> compiler but it throws a fatal error on Leopard's. If that's true,  
> you'll want to remove -shared for compatibility. If you can't test  
> on Leopard, send me a portfile and I can.

I'm on Leopard and it's building without error and so far seems to run  
fine, well since this morning anyways. What about Tiger?

// Brad


More information about the macports-dev mailing list