Opened 12 days ago

Closed 10 days ago

Last modified 8 days ago

#70951 closed defect (fixed)

Linker ld warning -ld_classic is deprecated when compiling with gcc14

Reported by: haberg-1 (Hans Åberg) Owned by:
Priority: Normal Milestone:
Component: ports Version:
Keywords: sequoia Cc: markmentovai (Mark Mentovai), cjones051073 (Chris Jones)
Port: gcc14

Description

There is a linker warning when compiling a C++ program with gcc14 on macOS 15 x86_64: ld: warning: -ld_classic is deprecated and will be removed in a future release

It does not appear when using clang-18.

Change History (11)

comment:1 Changed 12 days ago by markmentovai (Mark Mentovai)

Cc: markmentovai added

comment:2 Changed 12 days ago by markmentovai (Mark Mentovai)

This was forked from #70866. Here’s the relevant portion of what I said at ticket:70866#comment:34:

This warning doesn’t come from gcc. It comes from Apple’s ld, as of Xcode 16 (and the corresponding Command Line Tools version). MacPorts gcc requests this linker: lang/gcc14/Portfile. (${prefix}/bin/ld-classic is this wrapper that finds and runs ld -ld_classic.)

It’s possible that MacPorts gcc no longer needs the ld-classic workaround as long as gcc 0fe7962afc7c is in effect. That change has been cherry-picked as far back as gcc-11.

comment:3 Changed 12 days ago by cjones051073 (Chris Jones)

Yes, we should test if the ld classic workaround is still required. Quite likely it isn’t….

comment:4 Changed 12 days ago by cjones051073 (Chris Jones)

Cc: cjones051073 added

comment:5 Changed 12 days ago by cjones051073 (Chris Jones)

https://github.com/macports/macports-ports/blob/755679b00daff20ef9151e97ada04b379007dc41/lang/gcc14/Portfile#L230

Currently its enabled open ended. I am testing turning it off for <16.

It may well be gcc14 does not need it at all, but I would prefer to start with the least invasive changes. I personally cannot test with Xcode 15 any more so someone else would have to do that test anyway.

Version 0, edited 12 days ago by cjones051073 (Chris Jones) (next)

comment:6 Changed 10 days ago by cjones051073 (Chris Jones)

Resolution: fixed
Status: newclosed

Should be addressed now.

comment:7 Changed 8 days ago by haberg-1 (Hans Åberg)

It may be the removal from GCC of the ld option -ld_classic that causes the 'make check' fails, as this option is deprecated on MacOS 15. See: https://trac.macports.org/ticket/70951

With 'make check' tests on gmp-6.3.0 using both port clang-18 and gcc14, on MacOS 15, the fails are the same.

I have reported this on the GMP Bugs list: https://gmplib.org/list-archives/gmp-bugs/2024-October/005537.html

comment:8 Changed 8 days ago by cjones051073 (Chris Jones)

Just to note, the fix above is only on the macports side, to limit the explicit use of ld-classic during build. However, internally gcc14 (and other older versions) configure themselves to potentially still use this classic option, so this will remain a warning until upstream GCC fixes it.

It is only a warning though at this stage, it should not cause any build failures. the option will likely remain for the lifetime of Xcode 16, but for the next release, 17 onwards, we should consider its removal a possibility (its basically up to Apple to decide when they do this).

Last edited 8 days ago by cjones051073 (Chris Jones) (previous) (diff)

comment:9 Changed 8 days ago by haberg-1 (Hans Åberg)

It is the removal of ld_classic that seems to cause the GMP 'make check' fails. Before the change, I got the warning when compiling a program, so it was not only during the build, and why I reported it, but also why I suspect its removal results in the fails.

comment:10 Changed 8 days ago by cjones051073 (Chris Jones)

Please do not abuse this ticket for GMP related issues. If there is not one already you should open a new ticket for that and attach examples of complete build logs showing the issues.

comment:11 Changed 8 days ago by haberg-1 (Hans Åberg)

Sorry, wrong ticket—please remove.

Note: See TracTickets for help on using tickets.