Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

llvmPackages_15.libcxxStdenv's clang++ is broken in nixos-unstable #213901

Closed
amnore opened this issue Feb 1, 2023 · 1 comment
Closed

llvmPackages_15.libcxxStdenv's clang++ is broken in nixos-unstable #213901

amnore opened this issue Feb 1, 2023 · 1 comment
Labels
0.kind: bug Something is broken 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related

Comments

@amnore
Copy link

amnore commented Feb 1, 2023

Describe the bug

clang++ cannot compile a simple c++ program.

Steps To Reproduce

  1. cat flake.nix flake.lock a.cpp

flake.nix:

{
  outputs = { nixpkgs, ... }: {
    devShell.x86_64-linux =
      let
        pkgs = nixpkgs.legacyPackages.x86_64-linux;
        mkShell = pkgs.mkShell.override {
          stdenv = pkgs.llvmPackages_15.libcxxStdenv;
        };
      in
      mkShell {};
  };
}

flake.lock: (latest commit of nixos-unstable as of 2023-02-01)

{
  "nodes": {
    "nixpkgs": {
      "locked": {
        "lastModified": 1675115703,
        "narHash": "sha256-4zetAPSyY0D77x+Ww9QBe8RHn1akvIvHJ/kgg8kGDbk=",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "2caf4ef5005ecc68141ecb4aac271079f7371c44",
        "type": "github"
      },
      "original": {
        "id": "nixpkgs",
        "type": "indirect"
      }
    },
    "root": {
      "inputs": {
        "nixpkgs": "nixpkgs"
      }
    }
  },
  "root": "root",
  "version": 7
}

a.cpp:

int main() {}
  1. nix develop
  2. clang++ a.cpp

output:

-/nix/store/178vvank67pg2ckr5ic5gmdkm3ri72f3-binutils-2.39/bin/ld: cannot find l: No such file or directory
clang-15: error: linker command failed with exit code 1 (use -v to see invocation)

Expected behavior

The program compiles.

Additional context

I did a strace of the compiler. The command that fails is:

"/nix/store/178vvank67pg2ckr5ic5gmdkm3ri72f3-binutils-2.39/bin/ld" "-z" "relro" "-z" "now" "-pie" "--eh-frame-hdr" "-m" "elf_x86_64" "-o" "a.out" "/nix/store/yzjgl0h6a3qh1mby405428f16xww37h0-glibc-2.35-224/lib/Scrt1.o" "/nix/store/yzjgl0h6a3qh1mby405428f16xww37h0-glibc-2.35-224/lib/crti.o" "/nix/store/z1yw9cw97bcdfmxz5wk7j1bycw42r1mw-gcc-11.3.0/lib64/gcc/x86_64-unknown-linux-gnu/11.3.0/crtbeginS.o" "-L/nix/store/yvrj6nxc7iyngicpd5d13pzfd6m1vari-libcxx-15.0.7/lib" "-L/nix/store/rr6bk84i67k8pk7nap0pzfc4pwgsk66w-libcxxabi-15.0.7/lib" "-L/nix/store/yvrj6nxc7iyngicpd5d13pzfd6m1vari-libcxx-15.0.7/lib" "-L/nix/store/rr6bk84i67k8pk7nap0pzfc4pwgsk66w-libcxxabi-15.0.7/lib" "-L/nix/store/yzjgl0h6a3qh1mby405428f16xww37h0-glibc-2.35-224/lib" "-L/nix/store/5dr46cz3z9ggvqbxyqfa0zl7lyzj4739-clang-15.0.7-lib/lib" "-L/nix/store/z1yw9cw97bcdfmxz5wk7j1bycw42r1mw-gcc-11.3.0/lib64/gcc/x86_64-unknown-linux-gnu/11.3.0" "-L/nix/store/z1yw9cw97bcdfmxz5wk7j1bycw42r1mw-gcc-11.3.0/lib64/gcc/x86_64-unknown-linux-gnu/11.3.0/../../../../lib64" "-dynamic-linker=/nix/store/yzjgl0h6a3qh1mby405428f16xww37h0-glibc-2.35-224/lib/ld-linux-x86-64.so.2" "/tmp/nix-shell.akOXrp/a-aa3c1a.o" "-lc++abi" "-rpath" "/tmp/x/outputs/out/lib64" "-rpath" "/tmp/x/outputs/out/lib" "-lc++" "-lm" "-lgcc_s" "-lgcc" "-lc" "-lgcc_s" "-lgcc" "/nix/store/z1yw9cw97bcdfmxz5wk7j1bycw42r1mw-gcc-11.3.0/lib64/gcc/x86_64-unknown-linux-gnu/11.3.0/crtendS.o" "/nix/store/yzjgl0h6a3qh1mby405428f16xww37h0-glibc-2.35-224/lib/crtn.o" "-rpath" "/nix/store/yvrj6nxc7iyngicpd5d13pzfd6m1vari-libcxx-15.0.7/lib" "-rpath" "/nix/store/rr6bk84i67k8pk7nap0pzfc4pwgsk66w-libcxxabi-15.0.7/lib" "-rpath" "/nix/store/yzjgl0h6a3qh1mby405428f16xww37h0-glibc-2.35-224/lib"

After removing -lc++ from the arguments, ld no longer complains about not finding l.

Notify maintainers

@Ericson2314 @sternenseemann @lovek323 @dtzWill @primeos

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

 - system: `"x86_64-linux"`
 - host os: `Linux 5.15.89, NixOS, 23.05 (Stoat), 23.05.20230130.2caf4ef`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.13.2`
 - channels(root): `""`
 - nixpkgs: `/etc/nixos-flake-input/nixpkgs`
@amnore amnore added the 0.kind: bug Something is broken label Feb 1, 2023
@amnore
Copy link
Author

amnore commented Mar 22, 2023

Dup of #214524

@amnore amnore closed this as completed Mar 22, 2023
@rrbutani rrbutani added the 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related label May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related
Projects
None yet
Development

No branches or pull requests

2 participants