Default linker changed when installing GCC 5.3.0 on Tiger

Ryan Schmidt ryandesign at macports.org
Tue Apr 26 15:15:18 PDT 2016


On Apr 26, 2016, at 5:11 PM, César wrote:

> El martes, 26 de abril de 2016, Ryan Schmidt escribió:
> 
>> On Apr 26, 2016, at 4:31 PM, César wrote:
>> 
>> > After installing GCC 5.3.0 in Tiger, I realized that if I invoke ld from the command line, I'm actually invoking /opt/local/bin/ld. I realize that GCC 5.3.0 may require a newer linker than the default in Xcode for Tiger, but even if I select GCC 4.0.1 as the current compiler, ld still invokes /opt/local/bin/ld.
>> >
>> > Is there any way I can select /usr/bin/ld as the default linker when I'm not using GCC 5.3.0?
>> 
>> Tiger is so old that all the compilers included in its Xcode are too old and buggy for MacPorts to use. So MacPorts installs and uses the apple-gcc42 port and uses that compiler to build all ports on Tiger (unless a port specifies otherwise). The apple-gcc42 port requires the ld64 port, which is where /opt/local/bin/ld comes from. You should probably use /opt/local/bin/ld and the gcc installed by the apple-gcc42 port, even for things you compile on Tiger outside of MacPorts, rather than the ancient versions that come in Tiger's Xcode.
> 
> Yes, that's reasonable, but I like the flexibility of being able to use the Tiger's Xcode tools versions if I need it for testing or for comparisons. Isn't it possible to revert to the Xcode linker with the same ease I can select the active GCC version?

The "select" mechanism relies on the fact that no port installs the program of the name that you will ultimately use. For example, no gcc port installs /opt/local/bin/gcc. Instead, "port select" creates /opt/local/bin/gcc as a symlink to whatever gcc program you wish.

The ld64 port doesn't work like that. It directly installs /opt/local/bin/ld so there is no opportunity for "port select" to put a symlink there.

We typically use "select" for situations where there is more than one port providing an equivalent program, for example multiple versions of gcc. There is only one ld64 port, no multiple versions, so we don't provide "select" support in those cases.

You can still call Apple's old ld by calling /usr/bin/ld. If you really need to, you can deactivate the ld64 port, but expect some things to break if you do so, so I wouldn't do that longer than just temporarily.



More information about the macports-users mailing list