Closed asa08 closed 9 months ago
rosetta error: Failed to open libRosettaRuntime
Have you tried installing Rosetta?
@jpsim Very LQ: What is requiring Rosetta as of 0.54.0?
We don't install it on our CI, so wondering if there's a reason we should/need to going forward?
(We install via the bzlmod BCR)
Nothing requires Rosetta in SwiftLint itself.
If I run swift build -c release --product swiftlint -Xswiftc -target -Xswiftc x86_64-apple-macosx13.5
on an Apple Silicon Mac, I see the exact same error, even with Rosetta installed. The x86_64-apple-macosx13.5
target seems wrong to me. If the Mint command is run on an Arm-based Mac, we wouldn't see the x86_64
. On the other hand, running the command on an Intel-based Mac wouldn't require Rosetta.
@asa08: On which platform do you run the command?
The main change that I think could cause this in 0.54.0 is the addition of Swift macros.
Does Mint have trouble installing other projects using macros?
Sorry I should have clarified. We aren't using Mint, we're using Bazel with bzlmod.
bazel_dep(name = "swiftlint", version = "0.54.0")
We get the same Rosetta-ish error when (it appears) it's compiling macros
ERROR: /private/var/tmp/_bazel_buildkite/e21df498267afdbcbfd273d3ab407ad2/external/swiftlint~0.54.0/BUILD:48:14: Compiling Swift module @@swiftlint~0.54.0//:SwiftLintCore failed: (Exit 1): worker failed: error executing SwiftCompile command (from target @@swiftlint~0.54.0//:SwiftLintCore)
--
 | (cd /private/var/tmp/_bazel_buildkite/e21df498267afdbcbfd273d3ab407ad2/execroot/_main && \
 | exec env - \
 | APPLE_SDK_PLATFORM=MacOSX \
 | APPLE_SDK_VERSION_OVERRIDE=14.0 \
 | PATH=/bin:/usr/bin:/usr/local/bin \
 | SWIFT_AVOID_WARNING_USING_OLD_DRIVER=1 \
 | XCODE_VERSION_OVERRIDE=15.0.0.15A240d \
 | ZERO_AR_DATE=1 \
 | bazel-out/darwin_x86_64-opt-exec-ST-13d3ddad9198/bin/external/rules_swift~1.13.0/tools/worker/worker swiftc @bazel-out/darwin_x86_64-dbg/bin/external/swiftlint~0.54.0/SwiftLintCore.swiftmodule-0.params)
 | # Configuration: d18ff59a88335a8e65c7576b51d3557be72a9bdefd3da972549ee68dd90e23ee
 | # Execution platform: @@local_config_platform//:host
 | error: emit-module command failed with exit code 1 (use -v to see invocation)
 | rosetta error: Failed to open libRosettaRuntime
 | <unknown>:0: warning: compiler plugin not loaded: '/private/var/tmp/_bazel_buildkite/e21df498267afdbcbfd273d3ab407ad2/execroot/_main/bazel-out/darwin_x86_64-opt-exec-ST-13d3ddad9198/bin/external/swiftlint~0.54.0/SwiftLintCoreMacros; failed to initialize
 | external/swiftlint~0.54.0/Source/SwiftLintCore/Helpers/Macros.swift:7:14: warning: external macro implementation type 'SwiftLintCoreMacros.AutoApply' could not be found for macro 'AutoApply()'
 | public macro AutoApply() = #externalMacro(
...
I also see darwin_x86_64-dbg
in there. This is on an Apple Silicon machine. It's 13.5 (my local machine is 14.1).
Trying and failing to reproduce this.
$ mint run realm/SwiftLint@0.54.0 version
0.54.0
So that works for me. I also tried with Bazel / bzlmod:
$ git clone https://github.com/jpsim/swiftlint-bazel-example
$ cd swiftlint-bazel-example
$ bazel run -c opt @SwiftLint//:swiftlint -- version
INFO: Analyzed target @swiftlint~0.54.0//:swiftlint (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target @swiftlint~0.54.0//:swiftlint up-to-date:
bazel-bin/external/swiftlint~0.54.0/swiftlint
INFO: Elapsed time: 0.072s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/external/swiftlint~0.54.0/swiftlint version
0.54.0
I'm on M1, macOS 14.1.1, with Xcode 15.0 (15A240d) installed and selected.
I'm on M1, macOS 14.1.1, with Xcode 15.0 (15A240d) installed and selected.
Same for me. Both work. Cross-compiling with swift build -c release --product swiftlint -Xswiftc -target -Xswiftc x86_64-apple-macosx14.1
produces the reported error though. Might be caused by SPM not yet supporting cross-compilation?
I was having the issue. Sharing my observations in case it helps somebody else
In my case the problem was that I had Homebrew installed for intel chipsets (prefix /usr/local). Migrating Homebrew to the M1 chipset, then install mint using the new Homebrew installation, did the trick
We were also spawning from an x86/Rosetta process (forgotten x86 Danger binary). Sorry for the added noise 🙇
Seems like this is resolved then. @asa08, feel free to reopen if not for you.
@SimplyDanny Hi Danny. I have a similar problems is occurring in my environment.
There're some fatalError in SeverityConfiguration.swift and ViolationSeverity.swift. You can see it in attached images.
Could you tell me the solution?
I let you know some information text in bellow.
â– fatalError
/private/var/folders/51/lhm4698x3gzb7_lxrw5gcgvw0000gn/T/mint/github.com_realm_SwiftLint/Source/SwiftLintCore/Models/SeverityConfiguration.swift:2:15 type 'SeverityConfiguration
' does not conform to protocol 'Equatable' /private/var/folders/51/lhm4698x3gzb7_lxrw5gcgvw0000gn/T/mint/github.com_realm_SwiftLint/Source/SwiftLintCore/Models/SeverityConfiguration.swift:8:6 generic struct 'ConfigurationElement' requires that 'ViolationSeverity' conform to 'AcceptableByConfigurationElement'
/private/var/folders/51/lhm4698x3gzb7_lxrw5gcgvw0000gn/T/mint/github.com_realm_SwiftLint/Source/SwiftLintCore/Models/SeverityConfiguration.swift:19:14 cannot assign to property: 'severity' is a get-only property
/private/var/folders/51/lhm4698x3gzb7_lxrw5gcgvw0000gn/T/mint/github.com_realm_SwiftLint/Source/SwiftLintCore/Models/SeverityConfiguration.swift:29:14 cannot assign to property: 'severity' is a get-only property
/private/var/folders/51/lhm4698x3gzb7_lxrw5gcgvw0000gn/T/mint/github.com_realm_SwiftLint/Source/SwiftLintCore/Models/ViolationSeverity.swift:3:13 external macro implementation type 'SwiftLintCoreMacros.MakeAcceptableByConfigurationElement' could not be found for macro 'MakeAcceptableByConfigurationElement()'
/private/var/folders/51/lhm4698x3gzb7_lxrw5gcgvw0000gn/T/mint/github.com_realm_SwiftLint/Source/SwiftLintCore/Models/ViolationSeverity.swift:3:13 type 'ViolationSeverity' does not conform to protocol 'AcceptableByConfigurationElement'
SwiftGen/SwiftGen@6.6.2
realm/SwiftLint@0.53.0
I send you more Information. I did comment out like bellow.
export PATH="/opt/homebrew/bin:$PATH"
if which mint >/dev/null; then
#xcrun --sdk macosx mint run swiftlint swiftlint --fix
#xcrun --sdk macosx mint run swiftlint swiftlint
echo "testtest"
else
echo "warning: Mint not installed, download from https://github.com/yonaskolb/Mint"
fi
Then, it start working.
The same problem happens while installing 0.54.0 using pre-commit. 0.53.0 works as expected.
0.54.0 is the first version requiring Swift 5.9 to make use of the macro feature.
@yamataku29: In your logs, we see that the macros cannot be resolved. I'm not a Mint user. So I cannot tell from my experience what's wrong.
my co-worker was encountered this issue, but we could resolved.
If you installed mint with homebrew, reinstall homebrew without Rosetta. And reinstall mint, SwiftLint without Rosetta.
my co-worker was encountered this issue, but we could resolved the issue with this approach.
https://github.com/realm/SwiftLint/issues/5348#issuecomment-1825389815
If homebrew was installed in Rosetta environment, homebrew is seems to install packages for x86_64 architecture even if Terminal launched without Rosetta.
In fact, mint
binary is built for x86_64 arch.
$ file /usr/local/bin/mint
/usr/local/bin/mint: Mach-O 64-bit executable x86_64
Again, it can't change architecture to arm64 even if reinstall mint with non rosetta emulated Terminal.app. Reinstall homebrew for x86_64 arch(without rosetta) to resolve this issue.
Steps:
Having similar issue:
mint run realm/SwiftLint@0.54.0 version
=>
🌱 Cloning SwiftLint 0.54.0
🌱 Resolving package
warning: could not determine XCTest paths: terminated(1): /usr/bin/xcrun --sdk macosx --show-sdk-platform-path output:
xcrun: error: unable to lookup item 'PlatformPath' from command line tools installation
xcrun: error: unable to lookup item 'PlatformPath' in SDK '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk'
error: 'github.com_realm_swiftlint': Invalid manifest (compiled with: ["/Library/Developer/CommandLineTools/usr/bin/swiftc", "-vfsoverlay", "/var/folders/xc/pq5jc85j6lx55bjmm1pzzcjm0000gn/T/TemporaryDirectory.leUMVO/vfs.yaml", "-L", "/Library/Developer/CommandLineTools/usr/lib/swift/pm/ManifestAPI", "-lPackageDescription", "-Xlinker", "-rpath", "-Xlinker", "/Library/Developer/CommandLineTools/usr/lib/swift/pm/ManifestAPI", "-target", "arm64-apple-macosx13.0", "-sdk", "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk", "-swift-version", "5", "-I", "/Library/Developer/CommandLineTools/usr/lib/swift/pm/ManifestAPI", "-sdk", "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk", "-package-description-version", "5.9.0", "/private/var/folders/xc/pq5jc85j6lx55bjmm1pzzcjm0000gn/T/mint/github.com_realm_SwiftLint/Package.swift", "-Xfrontend", "-disable-implicit-concurrency-module-import", "-Xfrontend", "-disable-implicit-string-processing-module-import", "-o", "/var/folders/xc/pq5jc85j6lx55bjmm1pzzcjm0000gn/T/TemporaryDirectory.9q94D0/github.com_realm_swiftlint-manifest"])
/private/var/folders/xc/pq5jc85j6lx55bjmm1pzzcjm0000gn/T/mint/github.com_realm_SwiftLint/Package.swift:2:8: error: no such module 'CompilerPluginSupport'
import CompilerPluginSupport
^
🌱 Encountered error during "swift package resolve". Use --verbose to see full output
🌱 Failed to resolve SwiftLint 0.54.0 with SPM
I hit the same thing k06a. You've probably got the SDK path set to something other than the XCode instance. See here: https://stackoverflow.com/a/43418980
Try running
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
Then rerun your mint command.
New Issue Checklist
Describe the bug
An error occurs when executing the following commands.
Complete output when running SwiftLint, including the stack trace and command used
Environment