objecthub / swift-lispkit

Interpreter framework for Lisp-based extension and scripting languages on macOS and iOS. LispKit is based on the R7RS standard for Scheme. Its compiler generates bytecode for a virtual machine. LispKit is fully implemented in Swift 5.
https://lisppad.app
Apache License 2.0
392 stars 16 forks source link

Unable to build from command line #20

Closed jerekapyaho closed 1 year ago

jerekapyaho commented 1 year ago

Using Xcode 14.2 in macOS Monterey 12.6.4, I can build the LispKitREPL scheme just fine, but building from command line fails.

There are a couple of dozen errors, and they all seem to be related to availability of APIs.

Example of the output from make repl in Terminal, after the dependencies have been fetched and built:

Building for production...
/Users/jerekapyaho/Projects/swift-lispkit/Sources/LispKit/Base/Data.swift:27:12: error: 'init(unsafeUninitializedCapacity:initializingUTF8With:)' is only available in macOS 11.0 or newer
    return String(unsafeUninitializedCapacity: 2 * self.count) { (ptr) -> Int in
           ^
/Users/jerekapyaho/Projects/swift-lispkit/Sources/LispKit/Base/Data.swift:27:12: note: add 'if #available' version check
    return String(unsafeUninitializedCapacity: 2 * self.count) { (ptr) -> Int in
           ^
/Users/jerekapyaho/Projects/swift-lispkit/Sources/LispKit/Base/Data.swift:25:8: note: add @available attribute to enclosing instance method
  func hexEncodedString(upperCase: Bool = false) -> String {
       ^
/Users/jerekapyaho/Projects/swift-lispkit/Sources/LispKit/Base/Data.swift:23:1: note: add @available attribute to enclosing extension
extension Data {
^
/Users/jerekapyaho/Projects/swift-lispkit/Sources/LispKit/Primitives/CryptoLibrary.swift:150:47: warning: conformance of 'Insecure.MD5Digest' to 'Sequence' is only available in macOS 10.15 or newer
    return BytevectorLibrary.bytevector(from: Data(Insecure.MD5.hash(data: Data(subvec))))
                                              ^
/Users/jerekapyaho/Projects/swift-lispkit/Sources/LispKit/Primitives/CryptoLibrary.swift:150:47: note: add 'if #available' version check
    return BytevectorLibrary.bytevector(from: Data(Insecure.MD5.hash(data: Data(subvec))))
                                              ^
/Users/jerekapyaho/Projects/swift-lispkit/Sources/LispKit/Primitives/CryptoLibrary.swift:148:16: note: add @available attribute to enclosing instance method
  private func md5(expr: Expr, args: Arguments) throws -> Expr {
               ^

...and so on. make clean does not change the situation.

It almost looks like I was on macOS 10.14 or older, but this is Monterey with the latest security updates as of 2023-03-29. Latest repository updates from master are included (commit 506e9199f5a295a934c7463b49bd0add31d39869)

I can't see anything obviously wrong with my Xcode installation, since the LispKitREPL scheme and also other macOS and iOS applications can be built. It's just the command line that is failing. Any idea what might be causing this?

jerekapyaho commented 1 year ago

Additional information: the command line build also fails in the same way in macOS Ventura 13.3 (with Xcode 14.2 installed, and Xcode command line tools just updated).

objecthub commented 1 year ago

Thanks for the detailed bug report. Package.swift wasn't correctly updated wrt. minimum platform requirements, which is now macOS 11. Recently, a crypto library was added to LispKit and that pushed up the platform requirements to macOS 11. I've fixed Package.swift. Would be great if you could retry building the framework.

jerekapyaho commented 1 year ago

Thanks for fixing this! After pulling the latest change to Package.swift, the command line build make repl succeeds as expected. I was also able to execute the tests from the command line with make test. Awesome!