SwiftLint: SwiftLint v0.54.0 fails to be installed with Mint

New Issue Checklist

Describe the bug

An error occurs when executing the following commands.

mint bootstrap
Complete output when running SwiftLint, including the stack trace and command used
$ mint bootstrap
🌱 Cloning SwiftLint 0.54.0
🌱 Resolving package
🌱 Building product swiftlint
Building for production...
[0/11] Compiling SourceKit SourceKit.c
[1/11] Compiling Clang_C Clang_C.c
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
[3/13] Compiling SwiftSyntax509 Empty.swift
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
[3/13] Compiling DyldWarningWorkaround DyldWarningWorkaround.c
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
[4/15] Compiling writer.c
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
[5/16] Compiling parser.c
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
[6/16] Compiling reader.c
[7/17] Compiling emitter.c
[8/17] Compiling scanner.c
[9/17] Compiling api.c
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
[11/18] Compiling CollectionConcurrencyKit CollectionConcurrencyKit.swift
[12/18] Compiling ArgumentParserToolInfo ToolInfo.swift
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
[13/19] Compiling SwiftyTextTable TextTable.swift
[14/19] Compiling SWXMLHash XMLAttributeDeserializable.swift
[15/19] Compiling Yams Constructor.swift
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
[16/20] Compiling ArgumentParser BashCompletionsGenerator.swift
[17/20] Compiling SourceKittenFramework ByteCount.swift
[18/20] Compiling SwiftSyntax AbsolutePosition.swift
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
[19/24] Compiling SwiftIDEUtils SwiftIDEUtilsCompatibility.swift
[20/24] Compiling SwiftBasicFormat BasicFormat.swift
[21/24] Compiling SwiftDiagnostics Convenience.swift
[22/24] Compiling SwiftParser Attributes.swift
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
[23/26] Compiling SwiftOperators Operator.swift
[24/26] Compiling SwiftParserDiagnostics DiagnosticExtensions.swift
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
[25/27] Compiling SwiftSyntaxBuilder ConvenienceInitializers.swift
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
[26/28] Compiling SwiftSyntaxMacros AbstractSourceLocation.swift
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
[27/29] Compiling SwiftSyntaxMacroExpansion BasicMacroExpansionContext.swift
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
[28/30] Compiling SwiftCompilerPluginMessageHandling CompilerPluginMessageHandler.swift
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
[29/31] Compiling SwiftCompilerPlugin CompilerPlugin.swift
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
[30/32] Compiling SwiftLintCoreMacros RuleConfigurationMacros.swift
[30/32] Linking SwiftLintCoreMacros
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
[32/33] Compiling SwiftLintCore RuleDocumentation.swift
rosetta error: Failed to open libRosettaRuntime
 <unknown>:0: warning: compiler plugin not loaded: '/private/var/folders/rj/r1dvm6cd12s1cwvfk70xzx780000gn/T/mint/github.com_realm_SwiftLint/.build/x86_64-apple-macosx/release/SwiftLintCoreMacros; failed to initialize
/private/var/folders/rj/r1dvm6cd12s1cwvfk70xzx780000gn/T/mint/github.com_realm_SwiftLint/Source/SwiftLintCore/Models/ViolationSeverity.swift:3:13: error: external macro implementation type 'SwiftLintCoreMacros.MakeAcceptableByConfigurationElement' could not be found for macro 'MakeAcceptableByConfigurationElement()'
public enum ViolationSeverity: String, Comparable, Codable, InlinableOptionType {
            ^
/private/var/folders/rj/r1dvm6cd12s1cwvfk70xzx780000gn/T/mint/github.com_realm_SwiftLint/Source/SwiftLintCore/Helpers/Macros.swift:18:14: note: 'MakeAcceptableByConfigurationElement()' declared here
public macro MakeAcceptableByConfigurationElement() = #externalMacro(
             ^
/private/var/folders/rj/r1dvm6cd12s1cwvfk70xzx780000gn/T/mint/github.com_realm_SwiftLint/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(
             ^
/private/var/folders/rj/r1dvm6cd12s1cwvfk70xzx780000gn/T/mint/github.com_realm_SwiftLint/Source/SwiftLintCore/Helpers/Macros.swift:18:14: warning: external macro implementation type 'SwiftLintCoreMacros.MakeAcceptableByConfigurationElement' could not be found for macro 'MakeAcceptableByConfigurationElement()'
public macro MakeAcceptableByConfigurationElement() = #externalMacro(
             ^
/private/var/folders/rj/r1dvm6cd12s1cwvfk70xzx780000gn/T/mint/github.com_realm_SwiftLint/Source/SwiftLintCore/Helpers/Macros.swift:37:14: warning: external macro implementation type 'SwiftLintCoreMacros.SwiftSyntaxRule' could not be found for macro 'SwiftSyntaxRule(foldExpressions:explicitRewriter:)'
public macro SwiftSyntaxRule(foldExpressions: Bool = false, explicitRewriter: Bool = false) = #externalMacro(
             ^
/private/var/folders/rj/r1dvm6cd12s1cwvfk70xzx780000gn/T/mint/github.com_realm_SwiftLint/Source/SwiftLintCore/Models/SeverityConfiguration.swift:8:6: error: generic struct 'ConfigurationElement' requires that 'ViolationSeverity' conform to 'AcceptableByConfigurationElement'
    @ConfigurationElement(key: "severity")
     ^
/private/var/folders/rj/r1dvm6cd12s1cwvfk70xzx780000gn/T/mint/github.com_realm_SwiftLint/Source/SwiftLintCore/Models/RuleConfigurationDescription.swift:393:15: note: where 'T' = 'ViolationSeverity'
public struct ConfigurationElement<T: AcceptableByConfigurationElement & Equatable>: Equatable {
              ^
/private/var/folders/rj/r1dvm6cd12s1cwvfk70xzx780000gn/T/mint/github.com_realm_SwiftLint/Source/SwiftLintCore/Models/SeverityConfiguration.swift:8:6: note: did you mean to use '.rawValue'?
    @ConfigurationElement(key: "severity")
     ^
                         .rawValue
/private/var/folders/rj/r1dvm6cd12s1cwvfk70xzx780000gn/T/mint/github.com_realm_SwiftLint/Source/SwiftLintCore/Models/SeverityConfiguration.swift:8:6: error: generic struct 'ConfigurationElement' requires that 'ViolationSeverity' conform to 'AcceptableByConfigurationElement'
    @ConfigurationElement(key: "severity")
     ^
/private/var/folders/rj/r1dvm6cd12s1cwvfk70xzx780000gn/T/mint/github.com_realm_SwiftLint/Source/SwiftLintCore/Models/RuleConfigurationDescription.swift:393:15: note: where 'T' = 'ViolationSeverity'
public struct ConfigurationElement<T: AcceptableByConfigurationElement & Equatable>: Equatable {
              ^
/private/var/folders/rj/r1dvm6cd12s1cwvfk70xzx780000gn/T/mint/github.com_realm_SwiftLint/Source/SwiftLintCore/Models/SeverityConfiguration.swift:8:6: note: did you mean to use '.rawValue'?
    @ConfigurationElement(key: "severity")
     ^
                         .rawValue
/private/var/folders/rj/r1dvm6cd12s1cwvfk70xzx780000gn/T/mint/github.com_realm_SwiftLint/Source/SwiftLintCore/Models/SeverityConfiguration.swift:8:6: error: generic struct 'ConfigurationElement' requires that 'ViolationSeverity' conform to 'AcceptableByConfigurationElement'
    @ConfigurationElement(key: "severity")
     ^
/private/var/folders/rj/r1dvm6cd12s1cwvfk70xzx780000gn/T/mint/github.com_realm_SwiftLint/Source/SwiftLintCore/Models/RuleConfigurationDescription.swift:393:15: note: where 'T' = 'ViolationSeverity'
public struct ConfigurationElement<T: AcceptableByConfigurationElement & Equatable>: Equatable {
              ^
/private/var/folders/rj/r1dvm6cd12s1cwvfk70xzx780000gn/T/mint/github.com_realm_SwiftLint/Source/SwiftLintCore/Models/SeverityConfiguration.swift:8:6: note: did you mean to use '.rawValue'?
    @ConfigurationElement(key: "severity")
     ^
                         .rawValue
/private/var/folders/rj/r1dvm6cd12s1cwvfk70xzx780000gn/T/mint/github.com_realm_SwiftLint/Source/SwiftLintCore/Models/SeverityConfiguration.swift:2:15: error: type 'SeverityConfiguration<Parent>' does not conform to protocol 'Equatable'
public struct SeverityConfiguration<Parent: Rule>: SeverityBasedRuleConfiguration {
              ^
/private/var/folders/rj/r1dvm6cd12s1cwvfk70xzx780000gn/T/mint/github.com_realm_SwiftLint/Source/SwiftLintCore/Models/SeverityConfiguration.swift:9:9: note: stored property type '<<error type>>' does not conform to protocol 'Equatable', preventing synthesized conformance of 'SeverityConfiguration<Parent>' to 'Equatable'
    var severity = ViolationSeverity.warning
        ^
Swift.==:1:24: note: candidate would match if 'SeverityConfiguration<Parent>' conformed to 'RawRepresentable'
@inlinable public func == <T>(lhs: T, rhs: T) -> Bool where T : RawRepresentable, T.RawValue : Equatable
                       ^
Swift.FloatingPoint:2:24: note: candidate would match if 'SeverityConfiguration<Parent>' conformed to 'FloatingPoint'
    public static func == (lhs: Self, rhs: Self) -> Bool
                       ^
Swift.BinaryInteger:2:24: note: candidate would match if 'SeverityConfiguration<Parent>' conformed to 'BinaryInteger'
    public static func == <Other>(lhs: Self, rhs: Other) -> Bool where Other : BinaryInteger
                       ^
Swift._Pointer:2:24: note: candidate would match if 'SeverityConfiguration<Parent>' conformed to '_Pointer'
    public static func == (lhs: Self, rhs: Self) -> Bool
                       ^
Swift._Pointer:3:35: note: candidate would match if 'SeverityConfiguration<Parent>' conformed to '_Pointer'
    @inlinable public static func == <Other>(lhs: Self, rhs: Other) -> Bool where Other : _Pointer
                                  ^
Swift.Strideable:3:35: note: candidate would match if 'SeverityConfiguration<Parent>' conformed to 'Strideable'
    @inlinable public static func == (x: Self, y: Self) -> Bool
                                  ^
Swift.StringProtocol:2:35: note: candidate would match if 'SeverityConfiguration<Parent>' conformed to 'StringProtocol'
    @inlinable public static func == <RHS>(lhs: Self, rhs: RHS) -> Bool where RHS : StringProtocol
                                  ^
Swift.SIMD:4:24: note: candidate would match if 'SeverityConfiguration<Parent>' conformed to 'SIMD'
    public static func == (a: Self, b: Self) -> Bool
                       ^
Swift.Equatable:2:17: note: protocol requires function '==' with type '(SeverityConfiguration<Parent>, SeverityConfiguration<Parent>) -> Bool'
    static func == (lhs: Self, rhs: Self) -> Bool
                ^
/private/var/folders/rj/r1dvm6cd12s1cwvfk70xzx780000gn/T/mint/github.com_realm_SwiftLint/Source/SwiftLintCore/Models/SeverityConfiguration.swift:19:14: error: cannot assign to property: 'severity' is a get-only property
        self.severity = severity
        ~~~~~^~~~~~~~
/private/var/folders/rj/r1dvm6cd12s1cwvfk70xzx780000gn/T/mint/github.com_realm_SwiftLint/Source/SwiftLintCore/Models/SeverityConfiguration.swift:29:14: error: cannot assign to property: 'severity' is a get-only property
        self.severity = severity
        ~~~~~^~~~~~~~
/private/var/folders/rj/r1dvm6cd12s1cwvfk70xzx780000gn/T/mint/github.com_realm_SwiftLint/Source/SwiftLintCore/Models/ViolationSeverity.swift:3:13: error: type 'ViolationSeverity' does not conform to protocol 'AcceptableByConfigurationElement'
public enum ViolationSeverity: String, Comparable, Codable, InlinableOptionType {
            ^
/private/var/folders/rj/r1dvm6cd12s1cwvfk70xzx780000gn/T/mint/github.com_realm_SwiftLint/Source/SwiftLintCore/Models/RuleConfigurationDescription.swift:354:17: note: type 'ViolationSeverity' does not conform to inherited protocol 'AcceptableByConfigurationElement'
public protocol InlinableOptionType: AcceptableByConfigurationElement {}
                ^
error: fatalError
🌱 Encountered error during "swift build -c release --product swiftlint -Xswiftc -target -Xswiftc x86_64-apple-macosx13.5". Use --verbose to see full output
🌱  Failed to build SwiftLint 0.54.0 with SPM
iMac-mm-6201:newspicks-app-ios mu$ mint install realm/SwiftLint@0.54.0
🌱 Cloning SwiftLint 0.54.0
🌱 Resolving package
🌱 Building product swiftlint

Environment

  • SwiftLint version 0.54.0
  • Installation method used Mint version 0.17.5.
  • Paste your configuration file:
disabled_rules:
  - identifier_name
  - line_length
  - file_length
  - type_body_length
  - force_cast
  - type_name
  - cyclomatic_complexity
  - function_body_length
  - force_try
  - nesting
  - function_parameter_count
  - large_tuple

included:
  - xxx(Confidential information)
  • Xcode Version 15.0

About this issue

  • Original URL
  • State: closed
  • Created 8 months ago
  • Reactions: 4
  • Comments: 15

Most upvoted comments

my co-worker was encountered this issue, but we could resolved.

tl;dr

If you installed mint with homebrew, reinstall homebrew without Rosetta. And reinstall mint, SwiftLint without Rosetta.

details

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:

  • Uninstall homebrew(in Rosetta environment)
  • Install homebrew(in non Rosetta environment)
  • Install mint by homebrew
  • Install SwiftLint by mint
  • It will work…!

The same problem happens while installing 0.54.0 using pre-commit. 0.53.0 works as expected.

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

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?