Opened 2 years ago
Last modified 11 months ago
#70144 new defect
Incorrect conditions for making decisions based on Xcode or Xcode command line tools version
| Reported by: | ryandesign (Ryan Carsten Schmidt) | Owned by: | |
|---|---|---|---|
| Priority: | Normal | Milestone: | |
| Component: | ports | Version: | |
| Keywords: | Cc: | barracuda156, catap (Kirill A. Korinsky), cjones051073 (Chris Jones), dbevans (David B. Evans), jeremyhu (Jeremy Huddleston Sequoia), mascguy (Christopher Nielsen), mojca (Mojca Miklavec), cooljeanius (Eric Gallager), cgimenez (Christophe Gimenez), Dave-Allured (Dave Allured) | |
| Port: | basix ffmpeg ffmpeg-devel ffmpeg6 gcc-devel gcc10 gcc10-bootstrap gcc11 gcc12 gcc13 gcc14 gcc15 gcc8 gcc9 root6 scip sundials5 zig |
Description
Multiple ports and the mpi 1.0 portgroup use code such as this to decide whether to use the pre-Xcode-15 linker:
platform darwin { if {([vercmp ${xcodeversion} >= 15]) || ([vercmp ${xcodecltversion} >= 15])} { configure.ldflags-append -Wl,-ld_classic } }
This is wrong because it does not take into consideration whether Xcode or the Xcode command line tools will be used for the build.
- If the user only has the Xcode command line tools installed, then the Xcode command line tools will be used.
- If the user only has Xcode installed, then Xcode will be used.
- If the user has both Xcode and the Xcode command line tools installed, then Xcode will be used if
use_xcode yesis set, otherwise the Xcode command line tools will be used.
The current code works fine if the user has the same version of Xcode and the Xcode command line tools but that is not necessarily the case. Even two of the GitHub Actions CI runners are currently configured with mismatched Xcode and Xcode command line tools versions; see #69668.
I found these affected ports: gcc-devel, gcc10-bootstrap, gcc11, gcc12, gcc13, zig, scip, sundials5, ffmpeg-devel, ffmpeg, ffmpeg6, basix, root6. gcc8, gcc9, and gcc10 use a similarly incorrect check for Xcode or CLT version 12.5.
I don't know what the correct code would be but once it's figured out what it is it can be fixed in all the places.
Change History (16)
comment:1 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)
comment:2 follow-up: 3 Changed 2 years ago by cjones051073 (Chris Jones)
It is also incorrect now that these are open ended, as the issue was eventually fixed by apple in a subsequent Xcode/CLT release (not known at the time they where added).
So if we want to keep these that should also be taken into account now.
comment:3 follow-up: 4 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)
comment:4 Changed 2 years ago by cjones051073 (Chris Jones)
Replying to ryandesign:
Replying to cjones051073:
fixed by apple in a subsequent Xcode/CLT release
Which one?
If I knew I would have said ;)
comment:5 Changed 2 years ago by cjones051073 (Chris Jones)
We could of course just remove them all, which would amount to an implicit assumption that anyway using one of the affected Xcode versions has since updated...
comment:6 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)
I don't think removing the code is a good idea. Our GitHub Actions CI runners have not, for example, been updated to fixed Xcode versions, and while we could and should update them, there is no guarantee that users have updated. We do not want to expend more time re-investigating this problem with such users. polyml, for example, is a port that failed to build and would be fixed by applying this workaround, but I did not do so yet since the then-known workaround was wrong, and I filed this ticket to discover the correct workaround that can then be applied to polyml and all other affected ports or placed into a common portgroup.
comment:7 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)
We have Xcode 15.2 on the macOS 14 buildbot workers and polyml failed to build there. If you have a newer Xcode on macOS 14, can you try building polyml and let us know the result?
comment:8 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)
| Cc: | Gcenx added |
|---|---|
| Port: | basix ffmpeg ffmpeg-devel ffmpeg6 game-porting-toolkit gcc-devel gcc10 gcc10-bootstrap gcc11 gcc12 gcc13 gcc8 gcc9 root6 scip sundials5 zig basix ffmpeg ffmpeg-devel ffmpeg6 game-porting-toolkit gcc-devel gcc10 gcc10-bootstrap gcc11 gcc12 gcc13 gcc8 gcc9 root6 scip sundials5 zig added |
Newly-added game-porting-toolkit is also affected, using the more convoluted:
set clt150 [expr { ${xcodeversion} eq "none" && ${xcodecltversion} ne "none" && [vercmp ${xcodecltversion} >= "15.0"] } ] set xcode150 [expr { ${xcodeversion} ne "none" && [vercmp ${xcodeversion} >= "15.0"] } ] if { ${clt150} || ${xcode150} } {
comment:9 Changed 2 years ago by cooljeanius (Eric Gallager)
| Cc: | cooljeanius added |
|---|
comment:10 Changed 18 months ago by ryandesign (Ryan Carsten Schmidt)
| Cc: | cgimenez added |
|---|
Has duplicate #72091.
comment:11 Changed 18 months ago by Gcenx
You can remove game-porting-toolkit as I’d removed that in [53bbcfac6c32320ee4421989c809a7497077a47b/macports-ports]
comment:12 Changed 14 months ago by Dave-Allured (Dave Allured)
| Cc: | Dave-Allured added |
|---|
comment:13 Changed 11 months ago by ryandesign (Ryan Carsten Schmidt)
| Port: | gcc14 gcc15 added |
|---|
This caused a build failure for a user building libgcc15; see #72964.
comment:14 Changed 11 months ago by Gcenx
Again please remove game-porting-toolkit from this as if removed the Xcode check months ago and lined to the relevant commit, it’s actually listed twice for some reason.
comment:15 Changed 11 months ago by reneeotten (Renee Otten)
| Cc: | Gcenx removed |
|---|---|
| Port: | game-porting-toolkit game-porting-toolkit removed |
comment:16 Changed 11 months ago by reneeotten (Renee Otten)
I admit that I don't fully understand the reason for using configure.ldflags-append -Wl,-ld_classic, but presumably the ports listed here failed to build at some point without...
In any case, doing this for the ffmpeg* ports causes dependents now to fail with errors like:
ld: chained fixups, seg_count exceeds number of segments in '/opt/local/libexec/ffmpeg7/lib/libswresample.5.3.100.dylib'
Removing the code that uses the pre-XCode-15 linker from the Portfiles resolves that issue, and the ports build fine on the CI system (which are the macOS versions that were presumably affected) and locally on macOS Tahoe (cf. https://github.com/macports/macports-ports/pull/29417). So are we sure that any of this is still needed and can we not just remove it instead? To me it seems like reasonable for us to assume that end-user will have updated to the latest XCode version supported on their system (or ask/require them to do so).

Replying to ryandesign:
How about: