Xcode 11 & SDKROOT on macOS 10.14

Joshua Root jmr at macports.org
Wed Oct 2 04:04:56 UTC 2019


On 2019-10-2 13:33 , Aaron Madlon-Kay wrote:
>> Which port?
> 
> sequelpro-devel
> 
>> You mean SDKROOT in the environment?
> 
> I mean the SDKROOT=${configure.sdkroot} that is added to the
> build-phase args in the xcode-1.0 portgroup (see
> xcode::get_build_args).
> 
>> Does that mean you're running master?
> 
> I assume you're asking about my MacPorts version. I'm running 2.6.0.
> 
>> How does this cause problems exactly?
> 
> When xcodebuild is passed SDKROOT=(*CLT SDK path*) the build fails
> with an error about a DataModelCompile command not working (see
> below).
> 
> When I manually omit the SDKROOT arg, it compiles successfully. I took
> this to mean that the project requires the Xcode SDK and can't be
> built with the CLT. But I may be wrong about this.

The SDK is just headers and libraries, so I'm not sure how it would
affect something like that. It's possible that xcodebuild interprets the
SDKROOT variable in a way that affects more than the SDK used, so maybe
we should review how we're using it in the xcode portgroup.

> The full error:
> 
> DataModelCompile
> /Users/amake/Library/Developer/Xcode/DerivedData/sequel-pro-acqckjohvxujhddufmvyhhjemcvc/Build/Products/Release/Sequel\
> Pro.app/Contents/Resources/
> /Users/amake/Code/sequelpro/Models/SPUserManager.xcdatamodel (in
> target 'Sequel Pro' from project 'sequel-pro')
>     cd /Users/amake/Code/sequelpro
>     /Applications/Xcode.app/Contents/Developer/usr/bin/momc --sdkroot
> /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk
> --macosx-deployment-target 10.14 --module Sequel_Pro
> /Users/amake/Code/sequelpro/Models/SPUserManager.xcdatamodel
> /Users/amake/Library/Developer/Xcode/DerivedData/sequel-pro-acqckjohvxujhddufmvyhhjemcvc/Build/Products/Release/Sequel\
> Pro.app/Contents/Resources/
> /Users/amake/Code/sequelpro/Models/SPUserManager.xcdatamodel:: error:
> Cannot run cdtool because either it or the simulator runtime cannot be
> found. ('(null)' : 'Cannot find a simulator runtime for platform
> (null).') [0]

xcrun can't find cdtool on my system even without specifying an SDK:

% xcrun --find cdtool
xcrun: error: sh -c
'/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
-find cdtool 2> /dev/null' failed with exit code 17664: (null)
(errno=Invalid argument)
xcrun: error: unable to find utility "cdtool", not a developer tool or
in PATH

> As I understand it, though, some things really do need the Xcode SDK.
> In that case shouldn't we prefer the Xcode SDK even if the version
> doesn't match?

I don't think anything does need the SDK to be inside Xcode.app. It's
the same SDK no matter where it's located. The Xcode tools are another
matter, and we should be setting DEVELOPER_DIR correctly to allow them
to be found.

- Josh


More information about the macports-dev mailing list