The Swift Package Index logo.Swift Package Index

Has it really been five years since Swift Package Index launched? Read our anniversary blog post!

Build Information

Failed to build swift-jni, reference main (747b49), with Swift 6.1 for Wasm on 27 Jun 2025 04:29:08 UTC.

Build Command

bash -c docker run --pull=always --rm -v "checkouts-4606859-0":/host -w "$PWD" registry.gitlab.com/finestructure/spi-images:wasm-6.1-latest swift build --swift-sdk wasm32-unknown-wasi 2>&1

Build Log

========================================
RunAll
========================================
Builder version: 4.64.0
Interrupt handler set up.
========================================
Checkout
========================================
Clone URL: https://github.com/skiptools/swift-jni.git
Reference: main
Initialized empty Git repository in /host/spi-builder-workspace/.git/
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: 	git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: 	git branch -m <name>
From https://github.com/skiptools/swift-jni
 * branch            main       -> FETCH_HEAD
 * [new branch]      main       -> origin/main
HEAD is now at 747b499 Merge pull request #3 from skiptools/unsigned
Cloned https://github.com/skiptools/swift-jni.git
Revision (git rev-parse @):
747b4999e9426bafb6fa676f5989b33694fba8ad
SUCCESS checkout https://github.com/skiptools/swift-jni.git at main
========================================
Build
========================================
Selected platform:         wasm
Swift version:             6.1
Building package at path:  $PWD
https://github.com/skiptools/swift-jni.git
https://github.com/skiptools/swift-jni.git
WARNING: environment variable SUPPRESS_SWIFT_6_FLAGS is not set
{
  "dependencies" : [
  ],
  "manifest_display_name" : "swift-jni",
  "name" : "swift-jni",
  "path" : "/host/spi-builder-workspace",
  "platforms" : [
  ],
  "products" : [
    {
      "name" : "SwiftJNI",
      "targets" : [
        "SwiftJNI"
      ],
      "type" : {
        "library" : [
          "dynamic"
        ]
      }
    }
  ],
  "targets" : [
    {
      "c99name" : "SwiftJNITests",
      "module_type" : "SwiftTarget",
      "name" : "SwiftJNITests",
      "path" : "Tests/SwiftJNITests",
      "sources" : [
        "SwiftJNITests.swift"
      ],
      "target_dependencies" : [
        "SwiftJNI"
      ],
      "type" : "test"
    },
    {
      "c99name" : "SwiftJNI",
      "module_type" : "SwiftTarget",
      "name" : "SwiftJNI",
      "path" : "Sources/SwiftJNI",
      "product_memberships" : [
        "SwiftJNI"
      ],
      "sources" : [
        "SwiftJNI.swift"
      ],
      "target_dependencies" : [
        "CJNI"
      ],
      "type" : "library"
    },
    {
      "c99name" : "CJNI",
      "module_type" : "ClangTarget",
      "name" : "CJNI",
      "path" : "Sources/CJNI",
      "product_memberships" : [
        "SwiftJNI"
      ],
      "sources" : [
        "cjni.c"
      ],
      "type" : "library"
    }
  ],
  "tools_version" : "5.9"
}
Running build ...
bash -c docker run --pull=always --rm -v "checkouts-4606859-0":/host -w "$PWD" registry.gitlab.com/finestructure/spi-images:wasm-6.1-latest swift build --swift-sdk wasm32-unknown-wasi -Xswiftc -Xfrontend -Xswiftc -stats-output-dir -Xswiftc -Xfrontend -Xswiftc .stats -Xswiftc -strict-concurrency=complete -Xswiftc -enable-upcoming-feature -Xswiftc StrictConcurrency -Xswiftc -enable-upcoming-feature -Xswiftc DisableOutwardActorInference -Xswiftc -enable-upcoming-feature -Xswiftc GlobalActorIsolatedTypesUsability -Xswiftc -enable-upcoming-feature -Xswiftc InferSendableFromCaptures 2>&1
wasm-6.1-latest: Pulling from finestructure/spi-images
Digest: sha256:8f9255989265d824b88e7d572b1a334a0dc9b701075ede1970390db95d315c35
Status: Image is up to date for registry.gitlab.com/finestructure/spi-images:wasm-6.1-latest
Building for debugging...
[0/6] Write sources
[1/6] Compiling CJNI cjni.c
[2/6] Write swift-version-24593BA9C3E375BF.txt
error: emit-module command failed with exit code 1 (use -v to see invocation)
[4/8] Emitting module SwiftJNI
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:102:23: warning: static property 'jni' is not concurrency-safe because it is nonisolated global shared mutable state; this is an error in the Swift 6 language mode
 100 | public class JNI {
 101 |     /// The single shared singleton JNI instance for the process.
 102 |     public static var jni: JNI! { // this should be set in "OnLoad" and so should always exist
     |                       |- warning: static property 'jni' is not concurrency-safe because it is nonisolated global shared mutable state; this is an error in the Swift 6 language mode
     |                       |- note: convert 'jni' to a 'let' constant to make 'Sendable' shared state immutable
     |                       |- note: add '@MainActor' to make static property 'jni' part of global actor 'MainActor'
     |                       `- note: disable concurrency-safety checks if accesses are protected by an external synchronization mechanism
 103 |         didSet {
 104 |             _ = JClassLoader.globalClassLoader // cache the global class loader on initialization
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:326:23: warning: static property 'kotlincompat' is not concurrency-safe because non-'Sendable' type 'JConvertibleOptions' may have shared mutable state; this is an error in the Swift 6 language mode
 322 |
 323 | /// Java conversion options.
 324 | public struct JConvertibleOptions: OptionSet {
     |               `- note: consider making struct 'JConvertibleOptions' conform to the 'Sendable' protocol
 325 |     /// Optimize for bridging to pure Kotlin code rather than transpiled Swift.
 326 |     public static let kotlincompat = JConvertibleOptions(rawValue: 1 << 0)
     |                       |- warning: static property 'kotlincompat' is not concurrency-safe because non-'Sendable' type 'JConvertibleOptions' may have shared mutable state; this is an error in the Swift 6 language mode
     |                       |- note: add '@MainActor' to make static property 'kotlincompat' part of global actor 'MainActor'
     |                       `- note: disable concurrency-safety checks if accesses are protected by an external synchronization mechanism
 327 |     /// Map to a Kotlin container type. Useful for passing an array or dictionary to a known List or Map, even when content might
 328 |     /// not be expected to be `.kotlincompat`.
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:329:23: warning: static property 'kotlincompatContainer' is not concurrency-safe because non-'Sendable' type 'JConvertibleOptions' may have shared mutable state; this is an error in the Swift 6 language mode
 322 |
 323 | /// Java conversion options.
 324 | public struct JConvertibleOptions: OptionSet {
     |               `- note: consider making struct 'JConvertibleOptions' conform to the 'Sendable' protocol
 325 |     /// Optimize for bridging to pure Kotlin code rather than transpiled Swift.
 326 |     public static let kotlincompat = JConvertibleOptions(rawValue: 1 << 0)
 327 |     /// Map to a Kotlin container type. Useful for passing an array or dictionary to a known List or Map, even when content might
 328 |     /// not be expected to be `.kotlincompat`.
 329 |     public static let kotlincompatContainer = JConvertibleOptions(rawValue: 1 << 1)
     |                       |- warning: static property 'kotlincompatContainer' is not concurrency-safe because non-'Sendable' type 'JConvertibleOptions' may have shared mutable state; this is an error in the Swift 6 language mode
     |                       |- note: add '@MainActor' to make static property 'kotlincompatContainer' part of global actor 'MainActor'
     |                       `- note: disable concurrency-safety checks if accesses are protected by an external synchronization mechanism
 330 |
 331 |     public let rawValue: Int
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:646:23: warning: static property 'errorConverter' is not concurrency-safe because it is nonisolated global shared mutable state; this is an error in the Swift 6 language mode
 644 |     private static let javaErrorExceptionConstructor = javaErrorExceptionClass.getMethodID(name: "<init>", sig: "(Ljava/lang/String;)V")!
 645 |     /// Handles converting the error pointer into the error that will ultimately be thrown
 646 |     public static var errorConverter: ((JavaObjectPointer, JConvertibleOptions) -> Error?) = { ptr, options in descriptionToError(ptr, options: options) }
     |                       |- warning: static property 'errorConverter' is not concurrency-safe because it is nonisolated global shared mutable state; this is an error in the Swift 6 language mode
     |                       |- note: convert 'errorConverter' to a 'let' constant to make 'Sendable' shared state immutable
     |                       |- note: add '@MainActor' to make static property 'errorConverter' part of global actor 'MainActor'
     |                       `- note: disable concurrency-safety checks if accesses are protected by an external synchronization mechanism
 647 |
 648 |     public static func toError(_ ptr: JavaObjectPointer?, options: JConvertibleOptions) -> Error? {
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1280:23: warning: static property 'default' is not concurrency-safe because non-'Sendable' type 'JVMOptions' may have shared mutable state; this is an error in the Swift 6 language mode
1277 | // MARK: JVM Management
1278 |
1279 | public struct JVMOptions {
     |               `- note: consider making struct 'JVMOptions' conform to the 'Sendable' protocol
1280 |     public static let `default` = JVMOptions()
     |                       |- warning: static property 'default' is not concurrency-safe because non-'Sendable' type 'JVMOptions' may have shared mutable state; this is an error in the Swift 6 language mode
     |                       |- note: add '@MainActor' to make static property 'default' part of global actor 'MainActor'
     |                       `- note: disable concurrency-safety checks if accesses are protected by an external synchronization mechanism
1281 |
1282 |     public var verboseGarbageCollection = false
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1324:23: error: cannot find 'dlopen' in scope
1322 |         for libname in [nil, "libnativehelper.so", "libart.so", "libdvm.so"] {
1323 |             // Windows TODO: need to use LoadLibraryW (see https://github.com/swiftlang/sourcekit-lsp/blob/main/Sources/SourceKitD/dlopen.swift)
1324 |             let lib = dlopen(libname, RTLD_NOW)
     |                       `- error: cannot find 'dlopen' in scope
1325 |             typealias JavaVMPtr = UnsafeMutablePointer<JavaVM?>
1326 |             typealias GetCreatedJavaVMs = @convention(c) (_ pvm: UnsafeMutablePointer<JavaVMPtr?>, _ count: Int32, _ num: UnsafeMutablePointer<Int32>) -> jint
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1324:39: error: cannot find 'RTLD_NOW' in scope
1322 |         for libname in [nil, "libnativehelper.so", "libart.so", "libdvm.so"] {
1323 |             // Windows TODO: need to use LoadLibraryW (see https://github.com/swiftlang/sourcekit-lsp/blob/main/Sources/SourceKitD/dlopen.swift)
1324 |             let lib = dlopen(libname, RTLD_NOW)
     |                                       `- error: cannot find 'RTLD_NOW' in scope
1325 |             typealias JavaVMPtr = UnsafeMutablePointer<JavaVM?>
1326 |             typealias GetCreatedJavaVMs = @convention(c) (_ pvm: UnsafeMutablePointer<JavaVMPtr?>, _ count: Int32, _ num: UnsafeMutablePointer<Int32>) -> jint
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1329:43: error: cannot find 'dlsym' in scope
1327 |
1328 |             // Windows TODO: need to use GetProcAddress
1329 |             guard let getCreatedJavaVMs = dlsym(lib, "JNI_GetCreatedJavaVMs").map({ unsafeBitCast($0, to: (GetCreatedJavaVMs).self) }) else {
     |                                           `- error: cannot find 'dlsym' in scope
1330 |                 continue
1331 |             }
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1364:44: error: cannot find 'dlsym' in scope
1362 |         typealias CreateJavaVM = @convention(c) (_ pvm: UnsafeMutablePointer<UnsafeMutablePointer<JavaVM?>?>?, _ penv: UnsafeMutablePointer<UnsafeMutablePointer<JNIEnv?>?>?, _ args: UnsafeMutableRawPointer) -> jint
1363 |
1364 |         guard let JNI_CreateJavaVM_dlsym = dlsym(library, "JNI_CreateJavaVM").map({ unsafeBitCast($0, to: (CreateJavaVM).self) }) else {
     |                                            `- error: cannot find 'dlsym' in scope
1365 |             throw JVMError(description: "Unable to dlsym JNI_CreateJavaVM")
1366 |         }
[5/8] Compiling SwiftJNI SwiftJNI.swift
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:102:23: warning: static property 'jni' is not concurrency-safe because it is nonisolated global shared mutable state; this is an error in the Swift 6 language mode
 100 | public class JNI {
 101 |     /// The single shared singleton JNI instance for the process.
 102 |     public static var jni: JNI! { // this should be set in "OnLoad" and so should always exist
     |                       |- warning: static property 'jni' is not concurrency-safe because it is nonisolated global shared mutable state; this is an error in the Swift 6 language mode
     |                       |- note: convert 'jni' to a 'let' constant to make 'Sendable' shared state immutable
     |                       |- note: add '@MainActor' to make static property 'jni' part of global actor 'MainActor'
     |                       `- note: disable concurrency-safety checks if accesses are protected by an external synchronization mechanism
 103 |         didSet {
 104 |             _ = JClassLoader.globalClassLoader // cache the global class loader on initialization
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:326:23: warning: static property 'kotlincompat' is not concurrency-safe because non-'Sendable' type 'JConvertibleOptions' may have shared mutable state; this is an error in the Swift 6 language mode
 322 |
 323 | /// Java conversion options.
 324 | public struct JConvertibleOptions: OptionSet {
     |               `- note: consider making struct 'JConvertibleOptions' conform to the 'Sendable' protocol
 325 |     /// Optimize for bridging to pure Kotlin code rather than transpiled Swift.
 326 |     public static let kotlincompat = JConvertibleOptions(rawValue: 1 << 0)
     |                       |- warning: static property 'kotlincompat' is not concurrency-safe because non-'Sendable' type 'JConvertibleOptions' may have shared mutable state; this is an error in the Swift 6 language mode
     |                       |- note: add '@MainActor' to make static property 'kotlincompat' part of global actor 'MainActor'
     |                       `- note: disable concurrency-safety checks if accesses are protected by an external synchronization mechanism
 327 |     /// Map to a Kotlin container type. Useful for passing an array or dictionary to a known List or Map, even when content might
 328 |     /// not be expected to be `.kotlincompat`.
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:329:23: warning: static property 'kotlincompatContainer' is not concurrency-safe because non-'Sendable' type 'JConvertibleOptions' may have shared mutable state; this is an error in the Swift 6 language mode
 322 |
 323 | /// Java conversion options.
 324 | public struct JConvertibleOptions: OptionSet {
     |               `- note: consider making struct 'JConvertibleOptions' conform to the 'Sendable' protocol
 325 |     /// Optimize for bridging to pure Kotlin code rather than transpiled Swift.
 326 |     public static let kotlincompat = JConvertibleOptions(rawValue: 1 << 0)
 327 |     /// Map to a Kotlin container type. Useful for passing an array or dictionary to a known List or Map, even when content might
 328 |     /// not be expected to be `.kotlincompat`.
 329 |     public static let kotlincompatContainer = JConvertibleOptions(rawValue: 1 << 1)
     |                       |- warning: static property 'kotlincompatContainer' is not concurrency-safe because non-'Sendable' type 'JConvertibleOptions' may have shared mutable state; this is an error in the Swift 6 language mode
     |                       |- note: add '@MainActor' to make static property 'kotlincompatContainer' part of global actor 'MainActor'
     |                       `- note: disable concurrency-safety checks if accesses are protected by an external synchronization mechanism
 330 |
 331 |     public let rawValue: Int
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:646:23: warning: static property 'errorConverter' is not concurrency-safe because it is nonisolated global shared mutable state; this is an error in the Swift 6 language mode
 644 |     private static let javaErrorExceptionConstructor = javaErrorExceptionClass.getMethodID(name: "<init>", sig: "(Ljava/lang/String;)V")!
 645 |     /// Handles converting the error pointer into the error that will ultimately be thrown
 646 |     public static var errorConverter: ((JavaObjectPointer, JConvertibleOptions) -> Error?) = { ptr, options in descriptionToError(ptr, options: options) }
     |                       |- warning: static property 'errorConverter' is not concurrency-safe because it is nonisolated global shared mutable state; this is an error in the Swift 6 language mode
     |                       |- note: convert 'errorConverter' to a 'let' constant to make 'Sendable' shared state immutable
     |                       |- note: add '@MainActor' to make static property 'errorConverter' part of global actor 'MainActor'
     |                       `- note: disable concurrency-safety checks if accesses are protected by an external synchronization mechanism
 647 |
 648 |     public static func toError(_ ptr: JavaObjectPointer?, options: JConvertibleOptions) -> Error? {
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1280:23: warning: static property 'default' is not concurrency-safe because non-'Sendable' type 'JVMOptions' may have shared mutable state; this is an error in the Swift 6 language mode
1277 | // MARK: JVM Management
1278 |
1279 | public struct JVMOptions {
     |               `- note: consider making struct 'JVMOptions' conform to the 'Sendable' protocol
1280 |     public static let `default` = JVMOptions()
     |                       |- warning: static property 'default' is not concurrency-safe because non-'Sendable' type 'JVMOptions' may have shared mutable state; this is an error in the Swift 6 language mode
     |                       |- note: add '@MainActor' to make static property 'default' part of global actor 'MainActor'
     |                       `- note: disable concurrency-safety checks if accesses are protected by an external synchronization mechanism
1281 |
1282 |     public var verboseGarbageCollection = false
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1324:23: error: cannot find 'dlopen' in scope
1322 |         for libname in [nil, "libnativehelper.so", "libart.so", "libdvm.so"] {
1323 |             // Windows TODO: need to use LoadLibraryW (see https://github.com/swiftlang/sourcekit-lsp/blob/main/Sources/SourceKitD/dlopen.swift)
1324 |             let lib = dlopen(libname, RTLD_NOW)
     |                       `- error: cannot find 'dlopen' in scope
1325 |             typealias JavaVMPtr = UnsafeMutablePointer<JavaVM?>
1326 |             typealias GetCreatedJavaVMs = @convention(c) (_ pvm: UnsafeMutablePointer<JavaVMPtr?>, _ count: Int32, _ num: UnsafeMutablePointer<Int32>) -> jint
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1324:39: error: cannot find 'RTLD_NOW' in scope
1322 |         for libname in [nil, "libnativehelper.so", "libart.so", "libdvm.so"] {
1323 |             // Windows TODO: need to use LoadLibraryW (see https://github.com/swiftlang/sourcekit-lsp/blob/main/Sources/SourceKitD/dlopen.swift)
1324 |             let lib = dlopen(libname, RTLD_NOW)
     |                                       `- error: cannot find 'RTLD_NOW' in scope
1325 |             typealias JavaVMPtr = UnsafeMutablePointer<JavaVM?>
1326 |             typealias GetCreatedJavaVMs = @convention(c) (_ pvm: UnsafeMutablePointer<JavaVMPtr?>, _ count: Int32, _ num: UnsafeMutablePointer<Int32>) -> jint
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1329:43: error: cannot find 'dlsym' in scope
1327 |
1328 |             // Windows TODO: need to use GetProcAddress
1329 |             guard let getCreatedJavaVMs = dlsym(lib, "JNI_GetCreatedJavaVMs").map({ unsafeBitCast($0, to: (GetCreatedJavaVMs).self) }) else {
     |                                           `- error: cannot find 'dlsym' in scope
1330 |                 continue
1331 |             }
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1364:44: error: cannot find 'dlsym' in scope
1362 |         typealias CreateJavaVM = @convention(c) (_ pvm: UnsafeMutablePointer<UnsafeMutablePointer<JavaVM?>?>?, _ penv: UnsafeMutablePointer<UnsafeMutablePointer<JNIEnv?>?>?, _ args: UnsafeMutableRawPointer) -> jint
1363 |
1364 |         guard let JNI_CreateJavaVM_dlsym = dlsym(library, "JNI_CreateJavaVM").map({ unsafeBitCast($0, to: (CreateJavaVM).self) }) else {
     |                                            `- error: cannot find 'dlsym' in scope
1365 |             throw JVMError(description: "Unable to dlsym JNI_CreateJavaVM")
1366 |         }
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1413:12: error: cannot find 'getenv' in scope
1411 |
1412 |         // if JAVA_HOME is unset, default to the Homebrew installation
1413 |         if getenv("JAVA_HOME") == nil {
     |            `- error: cannot find 'getenv' in scope
1414 |             if FileManager.default.fileExists(atPath: "/opt/homebrew/opt/java") {
1415 |                 setenv("JAVA_HOME", "/opt/homebrew/opt/java", 0) // Homebrew ARM location
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1415:17: error: cannot find 'setenv' in scope
1413 |         if getenv("JAVA_HOME") == nil {
1414 |             if FileManager.default.fileExists(atPath: "/opt/homebrew/opt/java") {
1415 |                 setenv("JAVA_HOME", "/opt/homebrew/opt/java", 0) // Homebrew ARM location
     |                 `- error: cannot find 'setenv' in scope
1416 |             } else if FileManager.default.fileExists(atPath: "/usr/local/opt/java") {
1417 |                 setenv("JAVA_HOME", "/usr/local/opt/java", 0) // Homebrew Intel location
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1417:17: error: cannot find 'setenv' in scope
1415 |                 setenv("JAVA_HOME", "/opt/homebrew/opt/java", 0) // Homebrew ARM location
1416 |             } else if FileManager.default.fileExists(atPath: "/usr/local/opt/java") {
1417 |                 setenv("JAVA_HOME", "/usr/local/opt/java", 0) // Homebrew Intel location
     |                 `- error: cannot find 'setenv' in scope
1418 |             } else {
1419 |                 throw JVMError(description: "No JAVA_HOME set, and could not locate default Java installation")
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1422:25: error: cannot find 'getenv' in scope
1420 |             }
1421 |         }
1422 |         let JAVA_HOME = getenv("JAVA_HOME")!
     |                         `- error: cannot find 'getenv' in scope
1423 |         let javaHome = URL(fileURLWithPath: String(validatingUTF8: JAVA_HOME)!)
1424 |
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1442:79: error: cannot infer key path type from context; consider explicitly specifying a root type
1440 |
1441 |         guard let lib = libs.first(where: { FileManager.default.isReadableFile(atPath: $0.path) }) else {
1442 |             throw JVMError(description: "Could not find libjvm in: \(libs.map(\.path))")
     |                                                                               `- error: cannot infer key path type from context; consider explicitly specifying a root type
1443 |         }
1444 |
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1446:27: error: cannot find 'dlopen' in scope
1444 |
1445 |         // TODO: on macOS, reduce signal interception debugging issues by locating libjsig.dylib and adding it to DYLD_INSERT_LIBRARIES
1446 |         guard let dylib = dlopen(lib.path, RTLD_NOW) else {
     |                           `- error: cannot find 'dlopen' in scope
1447 |             if let error = dlerror() {
1448 |                 throw JVMError(description: "dlopen error: \(String(cString: error))")
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1446:44: error: cannot find 'RTLD_NOW' in scope
1444 |
1445 |         // TODO: on macOS, reduce signal interception debugging issues by locating libjsig.dylib and adding it to DYLD_INSERT_LIBRARIES
1446 |         guard let dylib = dlopen(lib.path, RTLD_NOW) else {
     |                                            `- error: cannot find 'RTLD_NOW' in scope
1447 |             if let error = dlerror() {
1448 |                 throw JVMError(description: "dlopen error: \(String(cString: error))")
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1447:28: error: cannot find 'dlerror' in scope
1445 |         // TODO: on macOS, reduce signal interception debugging issues by locating libjsig.dylib and adding it to DYLD_INSERT_LIBRARIES
1446 |         guard let dylib = dlopen(lib.path, RTLD_NOW) else {
1447 |             if let error = dlerror() {
     |                            `- error: cannot find 'dlerror' in scope
1448 |                 throw JVMError(description: "dlopen error: \(String(cString: error))")
1449 |             } else {
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1464:27: error: cannot find 'strlen' in scope
1462 |     init(_ string: String) {
1463 |         (length, buffer) = string.withCString {
1464 |             let len = Int(strlen($0) + 1)
     |                           `- error: cannot find 'strlen' in scope
1465 |             let dst = UnsafePointer(strcpy(UnsafeMutablePointer<CChar>.allocate(capacity: len), $0))
1466 |             return (len, dst!)
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1465:37: error: cannot find 'strcpy' in scope
1463 |         (length, buffer) = string.withCString {
1464 |             let len = Int(strlen($0) + 1)
1465 |             let dst = UnsafePointer(strcpy(UnsafeMutablePointer<CChar>.allocate(capacity: len), $0))
     |                                     `- error: cannot find 'strcpy' in scope
1466 |             return (len, dst!)
1467 |         }
Running build ...
bash -c docker run --pull=always --rm -v "checkouts-4606859-0":/host -w "$PWD" registry.gitlab.com/finestructure/spi-images:wasm-6.1-latest swift build --swift-sdk wasm32-unknown-wasi 2>&1
wasm-6.1-latest: Pulling from finestructure/spi-images
Digest: sha256:8f9255989265d824b88e7d572b1a334a0dc9b701075ede1970390db95d315c35
Status: Image is up to date for registry.gitlab.com/finestructure/spi-images:wasm-6.1-latest
[0/1] Planning build
Building for debugging...
[0/4] Write swift-version-24593BA9C3E375BF.txt
error: emit-module command failed with exit code 1 (use -v to see invocation)
[2/6] Emitting module SwiftJNI
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1324:23: error: cannot find 'dlopen' in scope
1322 |         for libname in [nil, "libnativehelper.so", "libart.so", "libdvm.so"] {
1323 |             // Windows TODO: need to use LoadLibraryW (see https://github.com/swiftlang/sourcekit-lsp/blob/main/Sources/SourceKitD/dlopen.swift)
1324 |             let lib = dlopen(libname, RTLD_NOW)
     |                       `- error: cannot find 'dlopen' in scope
1325 |             typealias JavaVMPtr = UnsafeMutablePointer<JavaVM?>
1326 |             typealias GetCreatedJavaVMs = @convention(c) (_ pvm: UnsafeMutablePointer<JavaVMPtr?>, _ count: Int32, _ num: UnsafeMutablePointer<Int32>) -> jint
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1324:39: error: cannot find 'RTLD_NOW' in scope
1322 |         for libname in [nil, "libnativehelper.so", "libart.so", "libdvm.so"] {
1323 |             // Windows TODO: need to use LoadLibraryW (see https://github.com/swiftlang/sourcekit-lsp/blob/main/Sources/SourceKitD/dlopen.swift)
1324 |             let lib = dlopen(libname, RTLD_NOW)
     |                                       `- error: cannot find 'RTLD_NOW' in scope
1325 |             typealias JavaVMPtr = UnsafeMutablePointer<JavaVM?>
1326 |             typealias GetCreatedJavaVMs = @convention(c) (_ pvm: UnsafeMutablePointer<JavaVMPtr?>, _ count: Int32, _ num: UnsafeMutablePointer<Int32>) -> jint
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1329:43: error: cannot find 'dlsym' in scope
1327 |
1328 |             // Windows TODO: need to use GetProcAddress
1329 |             guard let getCreatedJavaVMs = dlsym(lib, "JNI_GetCreatedJavaVMs").map({ unsafeBitCast($0, to: (GetCreatedJavaVMs).self) }) else {
     |                                           `- error: cannot find 'dlsym' in scope
1330 |                 continue
1331 |             }
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1364:44: error: cannot find 'dlsym' in scope
1362 |         typealias CreateJavaVM = @convention(c) (_ pvm: UnsafeMutablePointer<UnsafeMutablePointer<JavaVM?>?>?, _ penv: UnsafeMutablePointer<UnsafeMutablePointer<JNIEnv?>?>?, _ args: UnsafeMutableRawPointer) -> jint
1363 |
1364 |         guard let JNI_CreateJavaVM_dlsym = dlsym(library, "JNI_CreateJavaVM").map({ unsafeBitCast($0, to: (CreateJavaVM).self) }) else {
     |                                            `- error: cannot find 'dlsym' in scope
1365 |             throw JVMError(description: "Unable to dlsym JNI_CreateJavaVM")
1366 |         }
[3/6] Compiling SwiftJNI SwiftJNI.swift
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1324:23: error: cannot find 'dlopen' in scope
1322 |         for libname in [nil, "libnativehelper.so", "libart.so", "libdvm.so"] {
1323 |             // Windows TODO: need to use LoadLibraryW (see https://github.com/swiftlang/sourcekit-lsp/blob/main/Sources/SourceKitD/dlopen.swift)
1324 |             let lib = dlopen(libname, RTLD_NOW)
     |                       `- error: cannot find 'dlopen' in scope
1325 |             typealias JavaVMPtr = UnsafeMutablePointer<JavaVM?>
1326 |             typealias GetCreatedJavaVMs = @convention(c) (_ pvm: UnsafeMutablePointer<JavaVMPtr?>, _ count: Int32, _ num: UnsafeMutablePointer<Int32>) -> jint
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1324:39: error: cannot find 'RTLD_NOW' in scope
1322 |         for libname in [nil, "libnativehelper.so", "libart.so", "libdvm.so"] {
1323 |             // Windows TODO: need to use LoadLibraryW (see https://github.com/swiftlang/sourcekit-lsp/blob/main/Sources/SourceKitD/dlopen.swift)
1324 |             let lib = dlopen(libname, RTLD_NOW)
     |                                       `- error: cannot find 'RTLD_NOW' in scope
1325 |             typealias JavaVMPtr = UnsafeMutablePointer<JavaVM?>
1326 |             typealias GetCreatedJavaVMs = @convention(c) (_ pvm: UnsafeMutablePointer<JavaVMPtr?>, _ count: Int32, _ num: UnsafeMutablePointer<Int32>) -> jint
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1329:43: error: cannot find 'dlsym' in scope
1327 |
1328 |             // Windows TODO: need to use GetProcAddress
1329 |             guard let getCreatedJavaVMs = dlsym(lib, "JNI_GetCreatedJavaVMs").map({ unsafeBitCast($0, to: (GetCreatedJavaVMs).self) }) else {
     |                                           `- error: cannot find 'dlsym' in scope
1330 |                 continue
1331 |             }
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1364:44: error: cannot find 'dlsym' in scope
1362 |         typealias CreateJavaVM = @convention(c) (_ pvm: UnsafeMutablePointer<UnsafeMutablePointer<JavaVM?>?>?, _ penv: UnsafeMutablePointer<UnsafeMutablePointer<JNIEnv?>?>?, _ args: UnsafeMutableRawPointer) -> jint
1363 |
1364 |         guard let JNI_CreateJavaVM_dlsym = dlsym(library, "JNI_CreateJavaVM").map({ unsafeBitCast($0, to: (CreateJavaVM).self) }) else {
     |                                            `- error: cannot find 'dlsym' in scope
1365 |             throw JVMError(description: "Unable to dlsym JNI_CreateJavaVM")
1366 |         }
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1413:12: error: cannot find 'getenv' in scope
1411 |
1412 |         // if JAVA_HOME is unset, default to the Homebrew installation
1413 |         if getenv("JAVA_HOME") == nil {
     |            `- error: cannot find 'getenv' in scope
1414 |             if FileManager.default.fileExists(atPath: "/opt/homebrew/opt/java") {
1415 |                 setenv("JAVA_HOME", "/opt/homebrew/opt/java", 0) // Homebrew ARM location
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1415:17: error: cannot find 'setenv' in scope
1413 |         if getenv("JAVA_HOME") == nil {
1414 |             if FileManager.default.fileExists(atPath: "/opt/homebrew/opt/java") {
1415 |                 setenv("JAVA_HOME", "/opt/homebrew/opt/java", 0) // Homebrew ARM location
     |                 `- error: cannot find 'setenv' in scope
1416 |             } else if FileManager.default.fileExists(atPath: "/usr/local/opt/java") {
1417 |                 setenv("JAVA_HOME", "/usr/local/opt/java", 0) // Homebrew Intel location
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1417:17: error: cannot find 'setenv' in scope
1415 |                 setenv("JAVA_HOME", "/opt/homebrew/opt/java", 0) // Homebrew ARM location
1416 |             } else if FileManager.default.fileExists(atPath: "/usr/local/opt/java") {
1417 |                 setenv("JAVA_HOME", "/usr/local/opt/java", 0) // Homebrew Intel location
     |                 `- error: cannot find 'setenv' in scope
1418 |             } else {
1419 |                 throw JVMError(description: "No JAVA_HOME set, and could not locate default Java installation")
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1422:25: error: cannot find 'getenv' in scope
1420 |             }
1421 |         }
1422 |         let JAVA_HOME = getenv("JAVA_HOME")!
     |                         `- error: cannot find 'getenv' in scope
1423 |         let javaHome = URL(fileURLWithPath: String(validatingUTF8: JAVA_HOME)!)
1424 |
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1442:79: error: cannot infer key path type from context; consider explicitly specifying a root type
1440 |
1441 |         guard let lib = libs.first(where: { FileManager.default.isReadableFile(atPath: $0.path) }) else {
1442 |             throw JVMError(description: "Could not find libjvm in: \(libs.map(\.path))")
     |                                                                               `- error: cannot infer key path type from context; consider explicitly specifying a root type
1443 |         }
1444 |
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1446:27: error: cannot find 'dlopen' in scope
1444 |
1445 |         // TODO: on macOS, reduce signal interception debugging issues by locating libjsig.dylib and adding it to DYLD_INSERT_LIBRARIES
1446 |         guard let dylib = dlopen(lib.path, RTLD_NOW) else {
     |                           `- error: cannot find 'dlopen' in scope
1447 |             if let error = dlerror() {
1448 |                 throw JVMError(description: "dlopen error: \(String(cString: error))")
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1446:44: error: cannot find 'RTLD_NOW' in scope
1444 |
1445 |         // TODO: on macOS, reduce signal interception debugging issues by locating libjsig.dylib and adding it to DYLD_INSERT_LIBRARIES
1446 |         guard let dylib = dlopen(lib.path, RTLD_NOW) else {
     |                                            `- error: cannot find 'RTLD_NOW' in scope
1447 |             if let error = dlerror() {
1448 |                 throw JVMError(description: "dlopen error: \(String(cString: error))")
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1447:28: error: cannot find 'dlerror' in scope
1445 |         // TODO: on macOS, reduce signal interception debugging issues by locating libjsig.dylib and adding it to DYLD_INSERT_LIBRARIES
1446 |         guard let dylib = dlopen(lib.path, RTLD_NOW) else {
1447 |             if let error = dlerror() {
     |                            `- error: cannot find 'dlerror' in scope
1448 |                 throw JVMError(description: "dlopen error: \(String(cString: error))")
1449 |             } else {
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1464:27: error: cannot find 'strlen' in scope
1462 |     init(_ string: String) {
1463 |         (length, buffer) = string.withCString {
1464 |             let len = Int(strlen($0) + 1)
     |                           `- error: cannot find 'strlen' in scope
1465 |             let dst = UnsafePointer(strcpy(UnsafeMutablePointer<CChar>.allocate(capacity: len), $0))
1466 |             return (len, dst!)
/host/spi-builder-workspace/Sources/SwiftJNI/SwiftJNI.swift:1465:37: error: cannot find 'strcpy' in scope
1463 |         (length, buffer) = string.withCString {
1464 |             let len = Int(strlen($0) + 1)
1465 |             let dst = UnsafePointer(strcpy(UnsafeMutablePointer<CChar>.allocate(capacity: len), $0))
     |                                     `- error: cannot find 'strcpy' in scope
1466 |             return (len, dst!)
1467 |         }
BUILD FAILURE 6.1 wasm