Swift target (x86_64-pc-linux-gnu) and compiled output (x86_64-unknown-linux-gnu) does not align


There has been a lot of impressive movement in the Swift dev tooling for NixOS lately and in general it looks really good now thanks to StephanK.

I am however running into an issue which seem to be rooted in how uname is used when compiling underlying Swift assets and how Swift itself decides on the target triplet.

When I run swift --version, I get:

<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-gnu'; found: x86_64-unknown-linux-gnu, at: /nix/store/z2s6ijgdlvj04vvscj5gfwi9qgakb2m7-swift-5.8-lib/lib/swift/linux/_Concurrency.swiftmodule

Which seem to imply that the swift module was created by some call to uname, I just cannot seem to track it down.

Anyone has any good ideas on where to start? A recent CI job for my program can be found here.

and this is my flake file.



Hey I encounter same error today. I tried to install swift using nix-shell:

{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
  name = "swift-env";

  buildInputs = with pkgs; [

result was exactlly the same as yours. My walk around this problem is to install swift using enviroment.systemPackages atribute in NixOs configuration.

I’m having the same issue. Installed swift using environment.systemPackages and still seeing the glibc warning. I’m learning, any help would be helpful.

Seems to be a bug to me. Reposted to Swift target (x86_64-pc-linux-gnu) and compiled output (x86_64-unknown-linux-gnu) does not align · Issue #311565 · NixOS/nixpkgs · GitHub since it’s a better place to track bugs