You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi!
We would like to create Linux binaries/executables on macOS using cross compilation possibilities.
Some projects works fine, but we have an issue compiling a project using the new predicate functionality from swift-foundation package.
There is a minimised test, which compiles fine on macOS and Linux, but does not compile on macOS for Linux using a cross-compile.
We created a cross-compile toolchain according to directions in the README:
mbpro~ macros-cross-compile % swift experimental-sdk list
5.9-RELEASE_ubuntu_jammy_aarch64
and when using it have the following:
mbpro~ macros-cross-compile % swift build --experimental-swift-sdk 5.9-RELEASE_ubuntu_jammy_aarch64
Building for debugging...
warning: Could not read SDKSettings.json for SDK at: /Users/user/Library/org.swift.swiftpm/swift-sdks/5.9-RELEASE_ubuntu_jammy_aarch64.artifactbundle/5.9-RELEASE_ubuntu_jammy_aarch64/aarch64-unknown-linux-gnu/ubuntu-jammy.sdk
warning: Could not read SDKSettings.json for SDK at: /Users/user/Library/org.swift.swiftpm/swift-sdks/5.9-RELEASE_ubuntu_jammy_aarch64.artifactbundle/5.9-RELEASE_ubuntu_jammy_aarch64/aarch64-unknown-linux-gnu/ubuntu-jammy.sdk
<unknown>:0: warning: glibc not found for 'aarch64-unknown-linux-gnu'; C stdlib may be unavailable
.....
Macros: Operation not permitted
<unknown>:0: warning: glibc not found for 'aarch64-unknown-linux-gnu'; C stdlib may be unavailable
<unknown>:0: warning: glibc not found for 'aarch64-unknown-linux-gnu'; C stdlib may be unavailable
warning: Could not read SDKSettings.json for SDK at: /Users/user/Library/org.swift.swiftpm/swift-sdks/5.9-RELEASE_ubuntu_jammy_aarch64.artifactbundle/5.9-RELEASE_ubuntu_jammy_aarch64/aarch64-unknown-linux-gnu/ubuntu-jammy.sdk
error: emit-module command failed with exit code 1 (use -v to see invocation)
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Operation not permitted
/Users/user/external-reproducers/swift/macros-cross-compile/.build/aarch64-unknown-linux-gnu/debug/FoundationMacros: /Users/user/external-reproducers/swift/macros-cross-compile/.build/aarch64-unknown-linux-gnu/debug/FoundationMacros: Operation not permitted
<unknown>:0: warning: compiler plugin not loaded: '/Users/user/external-reproducers/swift/macros-cross-compile/.build/aarch64-unknown-linux-gnu/debug/FoundationMacros; failed to initialize
/Users/user/external-reproducers/swift/macros-cross-compile/Sources/MacrosCrossCompile/Main.swift:8:17: error: external macro implementation type 'FoundationMacros.PredicateMacro' could not be found for macro 'Predicate'
let predicate = #Predicate<Monster> { monster in
^
/Users/user/external-reproducers/swift/macros-cross-compile/.build/checkouts/swift-foundation/Sources/FoundationEssentials/Predicate/Predicate.swift:33:14: note: 'Predicate' declared here
public macro Predicate<each Input>(_ body: (repeat each Input) -> Bool) -> Predicate<repeat each Input> = #externalMacro(module: "FoundationMacros", type: "PredicateMacro")
^
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Operation not permitted
/Users/user/external-reproducers/swift/macros-cross-compile/.build/aarch64-unknown-linux-gnu/debug/FoundationMacros: /Users/user/external-reproducers/swift/macros-cross-compile/.build/aarch64-unknown-linux-gnu/debug/FoundationMacros: Operation not permitted
<unknown>:0: warning: compiler plugin not loaded: '/Users/user/external-reproducers/swift/macros-cross-compile/.build/aarch64-unknown-linux-gnu/debug/FoundationMacros; failed to initialize
/Users/user/external-reproducers/swift/macros-cross-compile/Sources/MacrosCrossCompile/Main.swift:8:17: error: external macro implementation type 'FoundationMacros.PredicateMacro' could not be found for macro 'Predicate'
let predicate = #Predicate<Monster> { monster in
^
/Users/user/external-reproducers/swift/macros-cross-compile/.build/checkouts/swift-foundation/Sources/FoundationEssentials/Predicate/Predicate.swift:33:14: note: 'Predicate' declared here
public macro Predicate<each Input>(_ body: (repeat each Input) -> Bool) -> Predicate<repeat each Input> = #externalMacro(module: "FoundationMacros", type: "PredicateMacro")
^
error: fatalError
The source code of the minimised test available in the repo
Macros are currently not supported in cross-compilation. This is not something we can address in Swift SDK Generator, the issue is on SwiftPM side. Closing as a duplicate of swiftlang/swift-package-manager#6950.
Hi!
We would like to create Linux binaries/executables on macOS using cross compilation possibilities.
Some projects works fine, but we have an issue compiling a project using the new predicate functionality from swift-foundation package.
There is a minimised test, which compiles fine on macOS and Linux, but does not compile on macOS for Linux using a cross-compile.
We created a cross-compile toolchain according to directions in the README:
and when using it have the following:
The source code of the minimised test available in the repo
Steps to reproduce
The text was updated successfully, but these errors were encountered: