NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.51k stars 13.69k forks source link

clang-11: error: linker command failed with exit code 1 (use -v to see invocation) on M1 #171090

Open teuffy opened 2 years ago

teuffy commented 2 years ago

Describe the bug

Installing quarto package with shell.nix

Steps To Reproduce

  1. shell.nix
    
    { pkgs ? import <nixpkgs> { } }:

with pkgs; mkShell { buildInputs = with rPackages; [ R quarto ];

shellHook = ''

...

''; } 3. nix-shell

Expected behavior

quarto should be installed with R

Screenshots

   > ld: library not found for -latomic
   > clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
   > make: *** [/nix/store/zvpvvi9jm16hca1gi1zf75hli7b9vib5-R-4.1.3/lib/R/share/make/shlib.mk:10: later.so] Error 1
   > ERROR: compilation failed for package 'later'

Metadata

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

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
output here
 - system: `"aarch64-darwin"`
 - host os: `Darwin 21.4.0, macOS 12.3.1`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.8.0`
 - channels(user): `"darmast-21.11-darwin.tar.gz, darwin, nixdarw-21.11-darwin, nixpkgs"`
 - channels(root): `"nixdarwro-21.11-darwin.tar.gz, nixpkgs, nixunst"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`

Extra

clang -Xlinker -v results: @(#)PROGRAM:ld PROJECT:ld64-762 BUILD 12:49:08 Mar 30 2022 configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em Library search paths: /usr/local/lib /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib Framework search paths: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ Undefined symbols for architecture arm64: "_main", referenced from: implicit entry/start for main executable ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

nixos-discourse commented 2 years ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/nixpkgs-aarch64-darwin-build-m1-uses-wrong-old-clang-how-to-fix/18368/5

neosimsim commented 2 years ago

I have a similar issue with rPackages.later #173497.

wegank commented 1 year ago

Cannot be reproduced here.

 - system: `"aarch64-darwin"`
 - host os: `Darwin 22.1.0, macOS 13.0.1`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.11.0`
 - channels(user): `"darwin, home-manager, nixpkgs, nur-packages"`
 - channels(root): `"nixpkgs"`
 - nixpkgs: `/Users/user/.nix-defexpr/channels/nixpkgs`