Opened 5 years ago

Closed 8 months ago

#59837 closed defect (worksforme)

macOS 10.14 SDK does not appear to be installed even though Command Line Tools are installed

Reported by: manulcaux Owned by:
Priority: Normal Milestone:
Component: base Version:
Keywords: Cc: larsknipping (Lars Knipping)
Port:

Description (last modified by mf2k (Frank Schima))

When trying to upgrade my ports, some of them fail with the following message :

Warning: The macOS 10.14 SDK does not appear to be installed. Ports may not build correctly.
Warning: You can install it as part of the Xcode Command Line Tools package by running `xcode-select --install'.

For example, ds9 won't build :

Error: Failed to build ds9: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_science_ds9/ds9/main.log for details.

If I try to install the Xcode-tools, they are installed :

[Emmanuels:/Applications/cassis5.1last] caux% xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
[Emmanuels:/Applications/cassis5.1last] caux% 

How should I proceed ?

I am running MacOs 10.14.6 and Xcode 11.3

Change History (29)

comment:1 Changed 5 years ago by mf2k (Frank Schima)

Component: portsbase
Description: modified (diff)
Keywords: build fail removed
Port: some removed
Summary: Error building some port with inconsistent messageport incorrectly thinks Xcode command line tools are not installed

comment:2 Changed 5 years ago by mf2k (Frank Schima)

You are reporting 2 different issues. Please give an example of a port that gives the command line tools warning. The problem with ds9 not compiling is likely not related because it builds fine for me and the builders on Mojave. You should open another ticket for that and attach the main.log file.

Last edited 5 years ago by mf2k (Frank Schima) (previous) (diff)

comment:3 Changed 5 years ago by jmroot (Joshua Root)

Summary: port incorrectly thinks Xcode command line tools are not installedmacOS 10.14 SDK does not appear to be installed even though Command Line Tools are installed

The warning is not exactly saying that the CLTs are not installed, it is saying that no 10.14 SDK could be found. That really is a problem, and the SDK really is supposed to be installed by the CLTs.

However, that warning does not prevent trying to install things, and it appears that the build of ds9 was attempted and failed. We don't know why without the log, as Frank said.

comment:4 Changed 5 years ago by manulcaux

Here is the list I have in my terminal when the warning appeared :

--->  Attempting to fetch xorg-libice-1.0.10_0.darwin_18.x86_64.tbz2.rmd160 from http://nue.de.packages.macports.org/xorg-libice
--->  Installing xorg-libice @1.0.10_0
--->  Cleaning xorg-libice
--->  Computing dependencies for xorg-libice
--->  Deactivating xorg-libice @1.0.9_1
--->  Cleaning xorg-libice
--->  Activating xorg-libice @1.0.10_0
--->  Cleaning xorg-libice
Warning: The macOS 10.14 SDK does not appear to be installed. Ports may not build correctly.
Warning: You can install it as part of the Xcode Command Line Tools package by running `xcode-select --install'.

Just after it was trying to install ds9, it is why I thought the problem was for ds9, but may be it is better on xorg-libice

I will open another ticket for the ds9 problem

Last edited 5 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:5 Changed 5 years ago by jmroot (Joshua Root)

MacPorts looks for MacOSX10.14.sdk in /Library/Developer/CommandLineTools/SDKs, and if it's not there it looks in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs, and if it's not there it asks xcrun to find it by running xcrun --sdk macosx10.14 --show-sdk-path. If the SDK isn't found, it prints the warning. Do you in fact have a 10.14 SDK?

comment:6 Changed 5 years ago by manulcaux

Searching in the cited directories, I find :

No MacOSX10.14.sdk in /Library/Developer/CommandLineTools/SDKs

There is a MacOSX.sdk in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ :

[Emmanuels:MacOSX.platform/Developer/SDKs] caux% ls /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/
DriverKit19.0.sdk/ MacOSX.sdk/        MacOSX10.15.sdk@

But the alias is MacOSX10.15.sdk@ and not MacOSX10.14.sdk@ as it should be I think. I have no idea why and how this alias has been created as I never tried to install MacOSX10.15 on my computer !

Should I just rename MacOSX10.15.sdk@ as MacOSX10.14.sdk@ ?

Running

[Emmanuels:MacOSX.platform/Developer/SDKs] caux% xcrun --sdk macosx10.14 --show-sdk-path

gives :

xcodebuild: error: SDK "macosx10.14" cannot be located.
xcodebuild: error: SDK "macosx10.14" cannot be located.
xcrun: error: unable to lookup item 'Path' in SDK 'macosx10.14'
Last edited 5 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:7 Changed 5 years ago by jmroot (Joshua Root)

No, definitely do not rename the 10.15 SDK. Using the wrong SDK can cause problems, which is why the warning is printed in the first place.

It's normal for Xcode 11 to only provide a 10.15 SDK, but the 10.14 SDK should then be provided by the Command Line Tools and be in /Library/Developer/CommandLineTools/SDKs. I don't know why that is not the case for you.

comment:8 Changed 5 years ago by manulcaux

OK, but I am stuck now. I do not plan to upgrade my OS to Catalina before ~ 6 months. I have problems to update my ports, maybe because of this SDK problem (ds9 for example, there is another ticket open on this), so how should I proceed ? Remove completely my port install and restart from scratch ? This would be a problem as I have a lot of port installed and used by other software. Stay as it is, i.e. do not update my ports until I move to Catalina ? Is it viable for 6 more months / I have serious doubts about that...

Many thanks to give me some advice

comment:9 Changed 5 years ago by kencu (Ken)

perhaps ProblemHotlist#reinstall-clt might help you.

If you do that procedure, and still have no 10.14 SDK, then you would need to find a copy of the 10.14 SDK inside Xcode 10.x or from a similar location.

We have plans in place to make this easier for people, but as of right now, it's still a couple of manual steps.

Last edited 4 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:10 Changed 5 years ago by manulcaux

I downloaded the last version of MacOSX10.14 available on the Apple developper web site, i.e. Command Line Tools (macOS 10.14) for Xcode 10.3 Jul 16, 2019 and installed it. I had no error during the install and the message "software successfully installed" at the end, but checking if there is a sdk macosx10.14 still returns :

[macp2034:~] caux% xcrun --sdk macosx10.14 --show-sdk-path
xcodebuild: error: SDK "macosx10.14" cannot be located.
xcodebuild: error: SDK "macosx10.14" cannot be located.
xcrun: error: unable to lookup item 'Path' in SDK 'macosx10.14'
[macp2034:~] caux% 

Many thanks if you have an idea to proceed...

Last edited 4 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:11 Changed 5 years ago by kencu (Ken)

You don't want to do that. That will give you Xcode 11.x and the Command Line Tools 10.x. and the mismatch would be a disaster.

At most, you might need the MacOSX10.14.sdk from the CommandLineTools 10.x.

This is a serious PITA, and that is why we've talking about automating it somehow, someday, somewhere ... sounds like a song ;>

Hmm. At this point, you should probably copy the MacOSX10.14.sdk from the /Library/Developer folder, then delete the command line tools and start over. Install the latest 11.x command line tools, and if there is no MacOSX10.14.sdk in there, copy in your saved copy of it.

comment:12 Changed 5 years ago by manulcaux

Checking on my computer, as said in the last comment, although the install of CLT (macOS 10.14) for Xcode 10.3 Jul 16, 2019 went OK, it is not found when running xcrun --sdk macosx10.14 --show-sdk-path :

xcodebuild: error: SDK "macosx10.14" cannot be located.
xcodebuild: error: SDK "macosx10.14" cannot be located.
xcrun: error: unable to lookup item 'Path' in SDK 'macosx10.14'
[macp2034:~] caux%

On the other hand, the SDK macOS10.15 is still present :

xcrun --sdk macosx10.15 --show-sdk-path
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk

Please note that I was doing all that because the SDK macOS10.14 is not present on my computer, nor in the /Library/Developer folder, neither elsewhere...

I do not now how to copy this from another location, if you can help, you'll be welcome !

Last edited 4 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:13 Changed 5 years ago by kencu (Ken)

If you have installed any version of the command line tools, at least one SDK should be at /Library/Developer/CommandLineTools/SDKs

If you have nothing in that location, there is a good place to start sorting out your problem...why is there nothing there????

comment:14 Changed 5 years ago by manulcaux

I do not have a directory named CommandLineTools in ~/Library/Developer/ ...

Is there a way to create and populate it ? Obviously running the package inside Command_Line_Tools_macOS_10.14_for_Xcode_10.3.dmg does not do the job ! Should I try an older one ?

comment:15 Changed 5 years ago by kencu (Ken)

That is not the directory we are looking for, though. Please reread my last message.

comment:16 Changed 5 years ago by manulcaux

Hi, Checking the right directory, I have the macosx10.14 present in it :

[Emmanuels:~] caux% cd /Library/Developer/CommandLineTools/SDKs/
[Emmanuels:Developer/CommandLineTools/SDKs] caux% ls
MacOSX.sdk/      MacOSX10.14.sdk@

But if I type the command to find it, it is not found :

[Emmanuels:~] caux% xcrun --sdk MacOSX10.14 --show-sdk-path                                                                           
xcodebuild: error: SDK "MacOSX10.14" cannot be located.
xcodebuild: error: SDK "MacOSX10.14" cannot be located.
xcrun: error: unable to lookup item 'Path' in SDK 'MacOSX10.14'

Is it the origin of the problem ? And if yes, what should I do ?

Thanks

Last edited 4 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:17 Changed 5 years ago by kencu (Ken)

I believe you have the current xcode installed (with SDK 10.15), and the CLI tools from the last version that came with SDK 10.14. That situation is unworkable, as you have mismatched tools.

Here is what I would do, exactly.

  1. Save the 10.14 SDK you already have:
    sudo mkdir /Library/Developer/SavedSDKS
    sudo mv    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk /Library/Developer/SavedSDKS/MacOSX10.14.sdk
    
  1. Remove the outdated CLTs:
    sudo rm -rf /Library/Developer/CommandLineTools
    
  1. Install the current CLTs using the current CLT installer.
  1. Add a symlink for the MacOSX10.14.sdk into the current CLTs:
    sudo ln -s /Library/Developer/SavedSDKS/MacOSX10.14.sdk /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk
    
  1. Add a symlink for the MacOSX10.14.sdk into Xcode:
    sudo ln -s /Library/Developer/SavedSDKS/MacOSX10.14.sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk 
    

Then I believe you should be in business.

comment:18 Changed 5 years ago by manulcaux

HI,

I followed all the steps you suggested :

[Emmanuels:/Library/Developer] caux% sudo mkdir /Library/Developer/SavedSDKS
Password:
[Emmanuels:/Library/Developer] caux% sudo mv /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk /Library/Developer/SavedSDKS/MacOSX10.14.sdk
[Emmanuels:/Library/Developer] caux% sudo rm -rf /Library/Developer/CommandLineTools
[Emmanuels:/Library/Developer] caux% xcode-select --install
xcode-select: note: install requested for command line developer tools
[Emmanuels:/Library/Developer] caux% sudo ln -s /Library/Developer/SavedSDKS/MacOSX10.14.sdk /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk
[Emmanuels:/Library/Developer] caux% sudo ln -s /Library/Developer/SavedSDKS/MacOSX10.14.sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk

Up to there, I didn't get any error message.

But running this command :

[Emmanuels:/Library/Developer] caux% xcrun --sdk macosx10.14 --show-sdk-path 
xcodebuild: error: SDK "macosx10.14" cannot be located.
xcodebuild: error: SDK "macosx10.14" cannot be located.
xcrun: error: unable to lookup item 'Path' in SDK 'macosx10.14'
[Emmanuels:/Library/Developer] caux% 

shows the problem is still there, and impeds me to upgrade any ports...

Many thanks to continue to help me !

Last edited 4 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:19 Changed 5 years ago by RiotNrrrd

The responses in this ticket all seem to come from an attitude of "User error", as if the OP has done something wrong.

I have two Macs running Mojave 10.14.6 that have this same exact problem. I doubt I did anything wrong when it comes to Xcode installation, yet I am in the same boat.

devmac:~ root# port install mercurial
Warning: The macOS 10.14 SDK does not appear to be installed. Ports may not build correctly.
Warning: You can install it as part of the Xcode Command Line Tools package by running `xcode-select --install'.
--->  Computing dependencies for mercurial
--->  Fetching archive for mercurial
--->  Attempting to fetch mercurial-5.3_1.darwin_18.x86_64.tbz2 from https://packages.macports.org/mercurial
--->  Attempting to fetch mercurial-5.3_1.darwin_18.x86_64.tbz2 from http://aus.us.packages.macports.org/macports/packages/mercurial
--->  Attempting to fetch mercurial-5.3_1.darwin_18.x86_64.tbz2 from https://ywg.ca.packages.macports.org/mirror/macports/packages/mercurial
--->  Building mercurial
Error: Failed to build mercurial: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mercurial/mercurial/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets to report a bug.
Error: Processing of port mercurial failed

I have Xcode installed and the command-line tools and xcrun --sdk macosx10.14 --show-sdk-path finds the SDK in both places mentioned by "Joshua Root":

devmac:~ root# ls -ldhF `locate MacOSX10.14`
lrwxr-xr-x  1 root  wheel    10B Nov  1 18:49 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk@ -> MacOSX.sdk
lrwxr-xr-x  1 root  wheel    10B Nov  1 18:56 /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk@ -> MacOSX.sdk

devmac:~ root# xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates

devmac:~ root# xcrun --sdk macosx10.14 --show-sdk-path
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk

So why am I getting the warning?

Last edited 5 years ago by RiotNrrrd (previous) (diff)

comment:20 Changed 5 years ago by RiotNrrrd

So why am I getting the warning?

[Updating my own comment.]

I found this Web page:

https://donatstudios.com/MojaveMissingHeaderFiles

which says to run

$ sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

This worked, and I was able to install ports like mercurial that previously errored on 10.14.6 due to missing header files.

But I'm still getting the

Warning: The macOS 10.14 SDK does not appear to be installed. Ports may not build correctly.
Warning: You can install it as part of the Xcode Command Line Tools package by running `xcode-select --install'.

warnings on this system, even after having done that.

I think it might be complaining because I have Xcode 11.3.1 on this system, and it installed a Catalina SDK in the Xcode tree instead of a Mojave one.

(Even though the SDK installed by the Command Line Tools installer is still the version for Mojave.)

mymac:~ root# locate /MacOSX10.1
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk
Last edited 5 years ago by RiotNrrrd (previous) (diff)

comment:21 in reply to:  5 ; Changed 5 years ago by RiotNrrrd

Replying to jmroot:

MacPorts looks for MacOSX10.14.sdk in /Library/Developer/CommandLineTools/SDKs, and if it's not there it looks in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs, and if it's not there it asks xcrun to find it by running xcrun --sdk macosx10.14 --show-sdk-path. If the SDK isn't found, it prints the warning. Do you in fact have a 10.14 SDK?

P.S. It looks to me like this statement (by "Joshua Root") is incorrect:

mymac:/ root# xcrun --sdk macosx10.15 --show-sdk-path
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk

mymac:/ root# xcrun --sdk macosx10.14 --show-sdk-path
xcodebuild: error: SDK "macosx10.14" cannot be located.
xcodebuild: error: SDK "macosx10.14" cannot be located.
xcrun: error: unable to lookup item 'Path' in SDK 'macosx10.14'

mymac:/ root# ls -d /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk

The SDK is right there in the path "Joshua Root" claims it is looked for in, yet xcrun doesn't find it.

Meanwhile, on the dev Mac with the 10.14 SDK in both places:

devmac:~ root# ls -d /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk

devmac:~ root# ls -d /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk

devmac:~ root# xcrun --sdk macosx10.14 --show-sdk-path
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk

devmac:~ root# port install wine-devel
Warning: The macOS 10.14 SDK does not appear to be installed. Ports may not build correctly.
Warning: You can install it as part of the Xcode Command Line Tools package by running `xcode-select --install'.
[...]

Riddle me that, Batman ...

Last edited 5 years ago by RiotNrrrd (previous) (diff)

comment:22 Changed 5 years ago by szhorvat (Szabolcs Horvát)

I see the exact same problem. I have Xcode 11.3.1 on macOS 10.14.6. I see the same warning about the macOS 10.14 SDK missing.

xcrun --sdk macosx10.14 --show-sdk-path

does not find the 10.14 SDK. It does not find the 10.15 one.

The 10.14 SDK is present in /Library/Developer/CommandLineTools/SDKs/, but xcrun does not find it.

One big difference is that no port actually failed to build so far for me. ds9, which the OP mentioned, builds fine. I only see the warnings with some ports.

comment:23 Changed 5 years ago by kencu (Ken)

how exactly did the 10.14 SDK get into the clt's SDK folder? Are you sure it's right?

comment:24 in reply to:  21 Changed 5 years ago by jmroot (Joshua Root)

Replying to RiotNrrrd:

The SDK is right there in the path "Joshua Root" claims it is looked for in, yet xcrun doesn't find it.

I don't know what xcrun does internally, but it's only used as a last resort anyway. You can look at the code for yourself to verify it does in fact directly check for the existence of the SDK directory first: https://github.com/macports/macports-base/blob/v2.6.2/src/port1.0/portconfigure.tcl#L475-L481 (after installation that file is at /opt/local/libexec/macports/lib/port1.0/portconfigure.tcl).

It is puzzling that that doesn't seem to be working for some users.

comment:25 Changed 5 years ago by jmroot (Joshua Root)

Is it possible that /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk is a broken symlink?

comment:26 Changed 5 years ago by larsknipping (Lars Knipping)

Cc: larsknipping added

comment:27 Changed 5 years ago by cktse (C.K. Tse)

I encountered similar error with MacOS10.14 SDK not found from Xcode command line tools, as the main Xcode build had already been updated to 10.15. Here's how I managed to fix it. See if this also helps in your case.

Here's the path to 10.14 SDK in the command line SDK:

$ ls -l /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk

Create symlink to 10.14 SDK within the main Xcode SDK directory:

$ cd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
$ ls -l
total 0
drwxr-xr-x  4 root  wheel  128 Jan 14 07:14 DriverKit19.0.sdk
drwxr-xr-x  8 root  wheel  256 Jan 14 07:14 MacOSX.sdk
lrwxr-xr-x  1 root  wheel   10 Nov 18 16:10 MacOSX10.15.sdk -> MacOSX.sdk

$ sudo ln -s /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk
$ ls -l
total 0
drwxr-xr-x  4 root  wheel  128 Jan 14 07:14 DriverKit19.0.sdk
drwxr-xr-x  8 root  wheel  256 Jan 14 07:14 MacOSX.sdk
lrwxr-xr-x  1 root  wheel   56 May 10 12:53 MacOSX10.14.sdk -> /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk
lrwxr-xr-x  1 root  wheel   10 Nov 18 16:10 MacOSX10.15.sdk -> MacOSX.sdk

Confirm that xcrun can now locate 10.14 SDK:

$ xcrun --sdk macosx10.14 --show-sdk-path -v
xcrun: note: looking up SDK with '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk macosx10.14 -version Path'
xcrun: note: PATH = '/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/texbin'
xcrun: note: SDKROOT = 'macosx10.14'
xcrun: note: TOOLCHAINS = ''
xcrun: note: DEVELOPER_DIR = '/Applications/Xcode.app/Contents/Developer'
xcrun: note: XCODE_DEVELOPER_USR_PATH = ''
xcrun: note: xcrun_db = '/var/folders/vk/zmf77rhs3w15b_qkn7b46lch0000gn/T/xcrun_db'
xcrun: note: lookup resolved to: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk'
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk

Previously xcrun returned an error:

$ xcrun --sdk macosx10.14 --show-sdk-path
xcodebuild: error: SDK "macosx10.14" cannot be located.
xcodebuild: error: SDK "macosx10.14" cannot be located.
xcrun: error: unable to lookup item 'Path' in SDK 'macosx10.14'

Hope this helps.

CK

Last edited 5 years ago by cktse (C.K. Tse) (previous) (diff)

comment:28 Changed 5 years ago by manulcaux

Hi,

Many thanks for the suggestion, I applied it and was finally able to upgrade all my port packages !

comment:29 Changed 8 months ago by kencu (Ken)

Resolution: worksforme
Status: newclosed

nothing to fix here for macports.

Note: See TracTickets for help on using tickets.