You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
swiftlint always crashes after updating to version 0.39 via Homebrew. We've tried this on 3 systems and seen the same issue.
We have tried installing "Swift 5 Runtime Support for Command Line Tools" as per the known issues but the systems are too new to allow this to be installed.
We have downgraded to 0.38.2 which is working fine.
Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint lint
dyld: Library not loaded: @rpath/lib_InternalSwiftSyntaxParser.dylib
Referenced from: /usr/local/bin/swiftlint
Reason: image not found
Abort trap: 6
Environment
SwiftLint version: 0.39
macOS versions: 10.15.3 && 10.14.6
Installation method used: Homebrew
Are you using nested configurations?
If so, paste their relative paths and respective contents.
Which Xcode version are you using: 11.3
Do you have a sample that shows the issue? Run `swiftlint"
Reacted by AnthonyMillerSF, Gökhan KOCA, Islam Temirbek, Pawel Pluskota and Bill Chan
This update broke our CI build system.
Currently it's pulling always the last version.
I'm testing a fix by copying the latest Xcode and renaming it to: Xcode-11.3.1.app
FYI
We use autoupdate with HomeBrew to keep our development systems and CI system using the same version of SwiftLint and other tools. If using HomeBrew I recommend using:
IMO we should avoid copying lib_InternalSwiftSyntaxParser.dylib and vending it with SwiftLint. We've been able to avoid doing that for SourceKit & libclang and we should be able to avoid it for SwiftSyntax too.
There is a significant difference here in that sourcekitd.framework and libclang.dylibcannot be separated from the toolchain they came from, they will stop functioning if you try to copy them out of the toolchain.
lib_InternalSwiftSyntaxParser.dylib is completely self-contained so it can be copied out. We are even considering having it be a SwiftPM binary dependency, in which case it may not be in the toolchain anymore (or at least building SwiftSyntax from source will not require having that library in the toolchain).
Thanks for that useful insight @akyrtzi! If we re-vend the binary as part of SwiftLint distributions, this also impacts our software license, so we'll need to carefully consider the implications there.
I was able to dynamically load it, but executing the binary still fails because of dyld: Library not loaded: @rpath/lib_InternalSwiftSyntaxParser.dylib (as @rpath/lib_InternalSwiftSyntaxParser.dylib is still mentioned in otool -L swiftlint) 🤔
I discovered a similar issue in a library I'm writing. A workaround was to rename Xcode-xyz.app to Xcode.app. It seems there's something in SwiftSyntax that assumes that swift toolchain will be under /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift.
I'm still investigating what's going on, but thought I'd share in case it's useful to anybody.
Activity
marcelofabri commentedon Feb 11, 2020
@Oliver-Kirkland-Evoke does it work if you try
brew reinstall --build-from-source swiftlint?Doxxer commentedon Feb 11, 2020
Same issue, Installation method used: Cocoapods
marcelofabri commentedon Feb 11, 2020
Can you post my details about your environment? I can image why using homebrew wouldn't work, but using CP should work fine 🤔
PatrickGaissert commentedon Feb 11, 2020
We have the same problem. Integration is also via Cocoapods, Xcode 11.3.1.
marcelofabri commentedon Feb 11, 2020
OK, so looks like the issue is that the binary is somehow hardcoding the path to the Xcode path from the machine that created the binary:
I'm not sure how to fix that and won't have time to look into this until later, so I recommend using 0.38.2 for now.
marcelofabri commentedon Feb 11, 2020
@nathawes do you have any ideas on how to fix this? Ideally we'd statically link
lib_InternalSwiftSyntaxParser, but maybe that's not possible?RicardoKoch commentedon Feb 11, 2020
This update broke our CI build system.
Currently it's pulling always the last version.
I'm testing a fix by copying the latest Xcode and renaming it to: Xcode-11.3.1.app
Oliver-Kirkland-Evoke commentedon Feb 11, 2020
FYI
We use autoupdate with HomeBrew to keep our development systems and CI system using the same version of SwiftLint and other tools. If using HomeBrew I recommend using:
This will keep SwiftLint at version 0.38.2 until
brew unpin swiftlintis run.rfree18 commentedon Feb 11, 2020
My team is also experiencing this problem on Xcode 11.3.1. We're installing it with CocoaPods as well
serges147 commentedon Feb 11, 2020
My team as well experiencing this problem on Xcode 11.3.1. We're installing it via CocoaPods.
nathawes commentedon Feb 11, 2020
@akyrtzi what's the right thing to do here?
RicardoKoch commentedon Feb 11, 2020
I was able to temporarily fix this issue by renaming Xcode.app to Xcode-11.3.1.app (inside Applications).
leifktaylor commentedon Feb 11, 2020
This broke my team's CI build.
We resolved the issue for the time being by locking our Swiftlint version to 0.38.2 in our podfile.
bskendig commentedon Feb 11, 2020
brew reinstall --build-from-source swiftlintbuilt a copy of 0.39 for me that works properly, so that's a workaround.7 remaining items
akyrtzi commentedon Feb 11, 2020
There is a significant difference here in that
sourcekitd.frameworkandlibclang.dylibcannot be separated from the toolchain they came from, they will stop functioning if you try to copy them out of the toolchain.lib_InternalSwiftSyntaxParser.dylibis completely self-contained so it can be copied out. We are even considering having it be a SwiftPM binary dependency, in which case it may not be in the toolchain anymore (or at least building SwiftSyntax from source will not require having that library in the toolchain).jpsim commentedon Feb 11, 2020
Thanks for that useful insight @akyrtzi! If we re-vend the binary as part of SwiftLint distributions, this also impacts our software license, so we'll need to carefully consider the implications there.
Temporarily remove all SwiftSyntax rules and support (#3107)
norio-nomura commentedon Feb 12, 2020
As far as I tested,
lib_InternalSwiftSyntaxParser.dylibis not compatible between Xcode 11.3.1 and Xcode 11.4.So it needs to check if the version of
lib_InternalSwiftSyntaxParser.dylibis compatible with swiftlint before dynamic loading.jpsim commentedon Feb 12, 2020
Yeah that's what @akyrtzi mentioned above in #3105 (comment)
marcelofabri commentedon Feb 12, 2020
I was able to dynamically load it, but executing the binary still fails because of
dyld: Library not loaded: @rpath/lib_InternalSwiftSyntaxParser.dylib(as@rpath/lib_InternalSwiftSyntaxParser.dylibis still mentioned inotool -L swiftlint) 🤔norio-nomura commentedon Feb 12, 2020
It needs to mark
lib_InternalSwiftSyntaxParser.dylibas weak import like:swift build --configuration release -Xlinker -weak-l_InternalSwiftSyntaxParserkylebrowning commentedon Feb 20, 2020
Confirmed, broken on CI.
jpsim commentedon Feb 20, 2020
This issue shouldn’t happen with 0.39.1, which removed SwiftSyntax integration until we can improve the packaging situation.
fdiaz commentedon Apr 8, 2020
I discovered a similar issue in a library I'm writing. A workaround was to rename
Xcode-xyz.apptoXcode.app. It seems there's something inSwiftSyntaxthat assumes that swift toolchain will be under/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift.I'm still investigating what's going on, but thought I'd share in case it's useful to anybody.
jpsim commentedon Apr 8, 2020
Closing as we resolved this in 0.39.1 and 0.39.2.
Add ability to bundle dylibs into CLI binary and load at startup
Add ability to bundle dylibs into CLI binary and load at startup
Add ability to bundle dylibs into CLI binary and load at startup