Skip to content

Commit

Permalink
qmake5 pg: use xcrun to test for SDK availability
Browse files Browse the repository at this point in the history
Instead of testing for the path, just use `xcrun` to verify the
availability of the desired SDK version.

The existence of an appropriately named SDK directory (e.g.
`MacOSX${configure.sdk_version}.sdk`) is not sufficient to determine
whether the desired SDK actually exists; e.g., a compatibility symlink
might exist, but actually point to a later SDK version.

Without this change, qmake builds will fail when the toolchain actually
attempts to resolve such an SDK version.
  • Loading branch information
landonf committed Apr 21, 2021
1 parent a65f3d1 commit 9887e90
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions _resources/port1.0/group/qmake5-1.0.tcl
Expand Up @@ -54,16 +54,7 @@ pre-configure {

# starting with Xcode 7.0, the SDK for build OS version might not be available
# see https://trac.macports.org/ticket/53597
if { ${use_xcode} } {
if {[vercmp $xcodeversion 4.3] < 0} {
set sdks_dir ${configure.developer_dir}/SDKs
} else {
set sdks_dir ${configure.developer_dir}/Platforms/MacOSX.platform/Developer/SDKs
}
} else {
set sdks_dir ${configure.developer_dir}/SDKs
}
if { ![file exists ${sdks_dir}/MacOSX${configure.sdk_version}.sdk] } {
if {[catch {exec /usr/bin/xcrun --sdk macosx${configure.sdk_version} --show-sdk-path} result]} {
configure.sdk_version
}

Expand Down

6 comments on commit 9887e90

@kencu
Copy link
Contributor

@kencu kencu commented on 9887e90 Apr 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ /usr/bin/xcrun --sdk macosx10.7 --show-sdk-path
xcrun: error: unrecognized option: --show-sdk-path
Usage: xcrun [options] <utility> ... arguments ...

Find and execute the named command line utility from
the installed Xcode.

Options:
  -h, --help           show this help message and exit
  -v, --verbose        show verbose logging output
  --sdk <sdk name>     find the tool for the given SDK name
  --toolchain <name>   find the tool for the given toolchain
  -l, --log            show commands to be executed (with --run)
  -f, --find           only find and print the utility path
  -r, --run            find and execute the utility (this is the default behavior)
  -n, --no-cache       do not use the lookup cache
  -k, --kill-cache     remove any existing cache file (and perhap

@kencu
Copy link
Contributor

@kencu kencu commented on 9887e90 Apr 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xcodebuild doesn't seem to cut it either.

There are some open source replacements for xcrun that I have been looking at that work like newer versions of xcrun. Perhaps one day one of those might be useable for this, with a path that works (ie won't be /usr/bin).

@landonf
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xcodebuild doesn't seem to cut it either.

There are some open source replacements for xcrun that I have been looking at that work like newer versions of xcrun. Perhaps one day one of those might be useable for this, with a path that works (ie won't be /usr/bin).

Well, shoot; what about searching for some known-to-exist tool? E.g. xcrun —sdk macosx10.7 -f ld?

@kencu
Copy link
Contributor

@kencu kencu commented on 9887e90 Apr 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm with you -- not good to bring the whole system down to the level of the oldest systems we support. We'll figure something out.

@kencu
Copy link
Contributor

@kencu kencu commented on 9887e90 Apr 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MarcusCalhoun-Lopez : if you have a moment, can you take a peek here and see how we can keep @landonf 's modernizations without losing support for the older systems in the process?

@MarcusCalhoun-Lopez
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The suggestion @landonf to use -f ld instead of --show-sdk-path seems to work.
There is a pull request that attempt to implement this idea.
Any feedback would be appreciated.

Please sign in to comment.