Swiftlint: dyld: Symbol not found error on 10.14.3 from bottled 0.32.0

Created on 30 Apr 2019  路  8Comments  路  Source: realm/SwiftLint

New Issue Checklist

Describe the bug

Simply running swiftlint 0.32.0 on macOS 10.14.3 when installed via the Homebrew bottle.

$ brew install swiftlint
==> Downloading https://homebrew.bintray.com/bottles/swiftlint-0.32.0.mojave.bottle.tar.gz
Already downloaded: /Users/chatelain/Library/Caches/Homebrew/downloads/4f9559ebeb4944bcaee86154b8822d5522813e7de93da3f2e947292b934176c6--swiftlint-0.32.0.mojave.bottle.tar.gz
==> Pouring swiftlint-0.32.0.mojave.bottle.tar.gz
馃嵑  /usr/local/Cellar/swiftlint/0.32.0: 6 files, 7.5MB
Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint
dyld: Symbol not found: _$s11SubSequenceSlTl
  Referenced from: /usr/local/bin/swiftlint
  Expected in: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/libswiftCore.dylib
 in /usr/local/bin/swiftlint
fish: 'swiftlint' terminated by signal SIGABRT (Abort)

Workaround

This appears to be an issue with the Homebrew bottle for Mojave. Building from source using Xcode 10.1 is sufficient to resolve the issue.

$ brew install swiftlint --build-from-source
...

Warning: Your Xcode (10.1) is outdated.
Please update to Xcode 10.2.1 (or delete it).
...
==> Checking out tag 0.32.0
HEAD is now at 6534946 release 0.32.0
...
==> make prefix_install PREFIX=/usr/local/Cellar/swiftlint/0.32.0 TEMPORARY_FOLDER=/private/tmp/swiftlint-20190429-85939-1ycfurt/SwiftLint.dst
馃嵑  /usr/local/Cellar/swiftlint/0.32.0: 6 files, 16.9MB, built in 3 minutes 46 seconds

$ swiftlint version
0.32.0

Environment

---
excluded:
- Carthage
- docs
- MasKitTests
  • Are you using nested configurations? no
    If so, paste their relative paths and respective contents.
  • Which Xcode version are you using (check xcode-select -p)? 10.1

    • Note: Xcode is symlinked to /Applications/Xcode.app -> /Applications/Xcode-10.1.app

    • Xcode 10.2 is not installed on this box.

  • macOS version: 10.14.3 (18D109)
  • Do you have a sample that shows the issue? n/a

Related

I noticed that Carthage 0.33.0 ran into this same issue last month. It sounds like having 10.2 installed at /Applications/Xcode.app resolves this issue on 10.14.0-.3, but I haven't verified this.

  • Carthage/Carthage#2757
  • Homebrew/homebrew-core#38656
  • Homebrew/homebrew-core#39009
  • Homebrew/homebrew-core#38646

I'm interested in the solution to this as packaging macOS CLI commands is now more complicated with Swift 5 and I'm waiting to update mas until we figure out how to deal with this issue.

Most helpful comment

I'm adding something to the readme about this, then will close.

All 8 comments

This issue is expected to homebrew distribution on macOS Mojave 10.14.0-.3 with Xcode 10.1 or earlier.

It sounds like having 10.2 installed at /Applications/Xcode.app resolves this issue on 10.14.0-.3, but I haven't verified this.

Another workarounds for homebrew distribution other than installing Xcode 10.2:

Ah, so this is a case where the box doesn't have the Swift 5 runtime and the bottle was built without the runtime embedded (on 10.14.4). I wish there was a way to require (at least with better messaging) the Swift 5 Runtime Support for Command Line Tools (public link).

One thing I'm confused about, I thought this behavior was only when an app is built with Swift 5, but SwiftLint is configured to build using Swift 4.2. So, it appears that even Swift 4 CLI executables built with Xcode 10.2 require the Swift 5 runtime to be installed?

SwiftLint's Homebrew bottle for macOS Mojave is created using Swift 5 compiler with -swift-version 4 flags that specified in Package.swift.
The Swift compiler in Xcode 10.2 is only version 5 and the -swift-version flag specifies the language version, not the compiler version. Swift 5 compiler links executables to the same Swift Runtime Libraries, regardless of whether -swift-version is4, 4.2, or 5.

Thanks for the explanation. The compiler version is what's important.

Can we close this?

I'm adding something to the readme about this, then will close.

Was this page helpful?
0 / 5 - 0 ratings