woshiccm / Pecker

CodePecker is a tool to detect unused Swift code.
MIT License
1.46k stars 63 forks source link

Cannot install Pecker on macOS Big Sur 11.3 (beta) #62

Open christiankm opened 3 years ago

christiankm commented 3 years ago

I cannot install Pecker on Big Sur (possibly due to being beta, but maybe you know).

If trying via Homebrew it throws an error, and trying a manual install via make install throws the following build error:

Cloning https://github.com/apple/swift-argument-parser.git
Resolving https://github.com/apple/swift-argument-parser.git at main
warning: Swift compiler no longer supports statically linking the Swift libraries. They're included in the OS by default starting with macOS Mojave 10.14.4 beta 3. For macOS Mojave 10.14.3 and earlier, there's an optional Swift library package that can be downloaded from "More Downloads" for Apple Developers at https://developer.apple.com/download/more/
warning: Swift compiler no longer supports statically linking the Swift libraries. They're included in the OS by default starting with macOS Mojave 10.14.4 beta 3. For macOS Mojave 10.14.3 and earlier, there's an optional Swift library package that can be downloaded from "More Downloads" for Apple Developers at https://developer.apple.com/download/more/
warning: Swift compiler no longer supports statically linking the Swift libraries. They're included in the OS by default starting with macOS Mojave 10.14.4 beta 3. For macOS Mojave 10.14.3 and earlier, there's an optional Swift library package that can be downloaded from "More Downloads" for Apple Developers at https://developer.apple.com/download/more/
/Users/christian/Pecker/.build/checkouts/Yams/Sources/Yams/Emitter.swift:338:32: warning: initialization of 'UnsafeMutablePointer<yaml_version_directive_t>' (aka 'UnsafeMutablePointer<yaml_version_directive_s>') results in a dangling pointer
            versionDirective = UnsafeMutablePointer(&versionDirectiveValue)
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/christian/Pecker/.build/checkouts/Yams/Sources/Yams/Emitter.swift:338:53: note: implicit argument conversion from 'yaml_version_directive_t' (aka 'yaml_version_directive_s') to 'UnsafeMutablePointer<yaml_version_directive_t>' (aka 'UnsafeMutablePointer<yaml_version_directive_s>') produces a pointer valid only for the duration of the call to 'init(_:)'
            versionDirective = UnsafeMutablePointer(&versionDirectiveValue)
                                                    ^~~~~~~~~~~~~~~~~~~~~~
/Users/christian/Pecker/.build/checkouts/Yams/Sources/Yams/Emitter.swift:338:53: note: use 'withUnsafeMutablePointer' in order to explicitly convert argument to pointer valid for a defined scope
            versionDirective = UnsafeMutablePointer(&versionDirectiveValue)
                                                    ^
/Users/christian/Pecker/Sources/Pecker/PeckerCommand.swift:22:6: error: referencing initializer 'init(name:help:)' on 'Flag' requires the types 'Bool' and 'Int' be equivalent
    @Flag(name: .shortAndLong, help: "Print the version and exit")
     ^
/Users/christian/Pecker/.build/checkouts/swift-argument-parser/Sources/ArgumentParser/Parsable Properties/Flag.swift:273:1: note: where 'Value' = 'Bool'
extension Flag where Value == Int {
^

make: *** [build] Error 1
christian@Christians-MacBook-Pro Pecker % 
SattarFalahati commented 3 years ago

I have the same problem. @christiankm did you resolve this problem ?

christiankm commented 3 years ago

I have the same problem. @christiankm did you resolve this problem ?

No, I have not looked further into this. But it does not work on 11.3 Beta 1.

SattarFalahati commented 3 years ago

I have the same problem. @christiankm did you resolve this problem ?

No, I have not looked further into this. But it does not work on 11.3 Beta 1.

I did it (finally). But the problem wasn't the Big Sur, It was Xcode itself I had to select the correct version of xcode using sudo xcode-select -s /Applications/Xcode-12.4.0.app then run the make instal command.

Iaroslav-kolesnik commented 3 years ago

For me the error was following:

.build/checkouts/swift-argument-parser/Sources/ArgumentParser/Parsable Properties/Flag.swift:273:1: note: where 'Value' = 'Bool' extension Flag where Value == Int { ^

I think the issue is in the wrong dependency.

.package(url: "https://github.com/apple/swift-argument-parser.git", .branch("main"))

change it to some stable release

.package(url: "https://github.com/apple/swift-argument-parser.git", from: "0.3.2")

dirtyhabits97 commented 3 years ago

I have the same problem. @christiankm did you resolve this problem ?

No, I have not looked further into this. But it does not work on 11.3 Beta 1.

I was hitting this same issue. Looks like the compiler cannot differentiate between the init for Bool and Int, so I replaced line 22 in /Sources/Pecker/PeckerCommand.swift:

// before
@Flag(name: .shortAndLong, help: "Print the version and exit")
// after
@Flag(name: .shortAndLong, inversion: .prefixedNo,  help: "Print the version and exit")