-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
Description
Describe the bug
When trying to use the riscv64-none-elf toolchain to cross compile on macOS (10.15.1), the linker (riscv64-none-elf-ld) fails with error: unrecognised emulation mode: acosx_version_min.
To Reproduce
- Create a
shell.nixfile with the following:
let crossPkgs = import <nixpkgs> {
crossSystem = (import <nixpkgs/lib>).systems.examples.riscv64-embedded;
}; in crossPkgs.mkShell { }- Run
$ nix-shell, and wait for the cross compiler derivations to build. - Once the toolchain is built, run
[nix-shell]$ riscv64-none-elf-ld
Expected behavior
I expect the linker to output ld: no object files specified (or something similar).
Instead, I'm seeing the following output:
/nix/store/8apl30x7n9i8gm3dwsqsl1kcr80ab5zl-riscv64-none-elf-binutils-2.31.1/bin/riscv64-none-elf-ld: unrecognised emulation mode: acosx_version_min
Supported emulations: elf64lriscv elf32lriscv
Additional context
I suspect that there is something going on where the native macOS linker (/usr/bin/ld) is being invoked under the hood. I ran some analysis with dtruss, but couldn't find anything definitive.
Note that this error occurs no matter what flags are passed -- including riscv64-none-elf-ld --version.
Metadata
- system:
"x86_64-darwin" - host os:
Darwin 19.0.0, macOS 10.15.1 - multi-user?:
no - sandbox:
no - version:
nix-env (Nix) 2.3.3 - channels:
"nixpkgs-20.09pre216412.04d6123309f" - nixpkgs:
/Users/johnmurphy/.nix-defexpr/channels/nixpkgs
Maintainer information:
# a list of nixpkgs attributes affected by the problem
attribute:
- stdenv.cross
# a list of nixos modules affected by the problem
module:I'm not too sure who the maintainer is, or how the cross compiling setup works. (I'm fairly new to nix). Any help here would be greatly appreciated! Thank you :)