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
{{ message }}
Repository navigation
Swift target (x86_64-pc-linux-gnu) and compiled output (x86_64-unknown-linux-gnu) does not align #311565
0.kind: bugSomething is broken2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md6.topic: swiftProgramming language (swift.org)
<unknown>:0: warning: glibc not found for 'x86_64-pc-linux-gnu'; C stdlib may be unavailable
Swift version 5.8 (swift-5.8-RELEASE)
Target: x86_64-pc-linux-gnu
and when trying to compile my program, get:
<unknown>:0: error: could not find module '_Concurrency' for target 'x86_64-pc-linux
Steps To Reproduce
Steps to reproduce the behavior:
Follow the documentation and run nix-shell -p swift --run 'swiftc -' <<< 'print("Hello world!")'
<unknown>:0: error: could not find module '_Concurrency' for target 'x86_64-pc-linux-gnu'; found: x86_64-unknown-linux-gnu, at: /nix/store/hfbzr5nzd2h90fs7ymbxvk505bcgynsi-swift-5.8-lib/lib/swift/linux/_Concurrency.swiftmodule
Expected behavior
Swift builds an executable ./main, which, when run, prints "Hello world!".
Reacted by Suraj, Kristoffer Dalby, Tarek Nawara, Michael Evans, Dom Egginton, Jonas Fierlings, Alon Sirota, Anomalocaridid, LOSEARDES77, Yiannis Marangos and 4 more
The libdispatch.so problem can also be worked around by adding ${swiftPackages.Dispatch}/lib to LD_LIBRARY_PATH, because sometimes it is not trivial to add import Foundation to every Swift file:
0.kind: bugSomething is broken2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md6.topic: swiftProgramming language (swift.org)
Activity
nixos-discourse commentedon May 14, 2024
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/swift-target-x86-64-pc-linux-gnu-and-compiled-output-x86-64-unknown-linux-gnu-does-not-align/39393/4
chuangzhu commentedon May 18, 2024
Cc @Samasaur1 @annalee @Ma27 @trofi for the recent changes in swiftc
trofi commentedon May 20, 2024
Do you know when it was working last time? We can try to bisect to get the idea what change caused it.
chuangzhu commentedon Jun 1, 2024
Using
swift.stdenvseems to be the trick, as described in #242779 (comment) (although he missed thecinswiftc):The
libdispatch.soproblem can also be worked around by adding${swiftPackages.Dispatch}/libtoLD_LIBRARY_PATH, because sometimes it is not trivial to addimport Foundationto every Swift file:oblique commentedon Jan 16, 2025
If someone came here because this issue in devenv, this this the solution:
reckenrode commentedon Sep 29, 2026
Fixed by #557896.