/usr/lib/swift - folder missing on iMac with High Sierra

I created a project in Xcode 11.4. But I was checking with otool and I see that LC_RPATH is referencing a folder that doesn't exist on that machine.

The lib /usr/lib/swift is not present on either of my two machines with the High Sierra operating system.

Load command 21
cmd LC_RPATH
cmdsize 32
path /usr/lib/swift (offset 12)

79244512-97e92d00-7e3c-11ea-87e2-cfc0f2082956

What is the deployment target for your project?

It is a Command Line Tool.

I'm asking what setting is shown here:

Sorry, my fault! Deployment Target 10.14

Code compiled with a deployment target of 10.14 is not expected to run on 10.13. Please try setting the deployment target to an appropriate value.

I did it but the lib /usr/lib/swift is still not present on High Sierra. And the LC_RPATH is still looking for this directory.

Load command 21
cmd LC_RPATH
cmdsize 32
path /usr/lib/swift (offset 12)

Perhaps you need the Swift 5 Runtime since it's not included with High Sierra?

1 Like

Your link is private. :cry:

You should just need to log into the dev center, it's a free download. If the link itself doesn't work you can find it in the More section of downloads. Search for Swift 5.

1 Like

I logged in with my free developer account and will not let me see the link ... I will check the other way. Thanks a lot @Jon_Shier.

However, if I install Swift 5 runtime on this pc, it would have to be done on every PC that uses the program. Is it possible to use something like Cocoapods to embed all the Swift 5 dependencies that I need?

This is a common pain point but I don’t know know if there’s an official dependency solution, but someone may have created something. This is an unfortunate limitation of Apple’s Swift 5 strategy.

it would have to be done on every [Mac] that uses the program.

Not every Mac. Macs running 10.14.4 and later have the Swift runtime built in, and thus this issue goes away.

Is it possible to use something like Cocoapods to embed all the Swift
5 dependencies that I need?

No.

The easiest way to solve this problem is to raise your deployment target to 10.14.4. Right now your deployment target is 10.14, so raising it to 10.14.4 shouldn’t be a big deal.

Note While the Xcode popup for this only shows major OS releases, it’s possible to manually enter minor releases.

If you want to support older OS releases, things get more complex. There is simply no one-size-fit-all approach. You’ll have tailor your approach based on how you play to deploy your product. If you can provide details on your deployment strategy, I’m happy to make further suggestions.

Share and Enjoy

Quinn “The Eskimo!” @ DTS @ Apple

2 Likes

I am working on an application that uses the following dependencies: Foundation, CoreLocation, and Contacts. The idea is for the application to be compatible with multiple Mac OS versions.

import Foundation

import CoreLocation

import Contacts

Taking into account what they are, it is possible to package them so that they are embedded in the code. Or considering what they are, how can I know which operating systems I can support?

Are you using “application” in the general sense? Or, specifically, a Mac application that a user would double click in the Finder to launch?

Share and Enjoy

Quinn “The Eskimo!” @ DTS @ Apple