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

riscv64-embedded fails to link anything, discovered as spike build failure #267859

Closed
widlarizer opened this issue Nov 16, 2023 · 5 comments · Fixed by #268026
Closed

riscv64-embedded fails to link anything, discovered as spike build failure #267859

widlarizer opened this issue Nov 16, 2023 · 5 comments · Fixed by #268026

Comments

@widlarizer
Copy link

widlarizer commented Nov 16, 2023

Describe the bug

riscv64-none-elf-gcc fails to link basic file. This breaks the build of spike. . You will see riscv64-none-elf-ld: cannot find crt0.o: No such file or directory cannot find -lgloss: No such file or directory

Steps To Reproduce

Steps to reproduce the behavior:
nix-shell -p pkgs.spike, or nix-shell -p pkgsCross.riscv64-embedded.stdenv.cc followed by touch nothing.c && riscv64-none-elf-gcc nothing.c

Expected behavior

Spike builds, or linker errors are only related to the empty C file, not to default linking options failing.

Notify maintainers

team gcc:

@Synthetica9
@vcunat
@Ericson2314

Metadata

emil@fridge ~> nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.62, NixOS, 23.11 (Tapir), 23.11pre546599.e44462d6021b`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - channels(root): `"nixos, nixos-23.05-23.05"`
 - channels(emil): `""`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
@trepetti
Copy link
Contributor

trepetti commented Nov 17, 2023

Bisected here: 1e47c87

Repro:

# builds
nix shell https://github.com/NixOS/nixpkgs/archive/1e47c87fd239258c2e5e8259765053c24b5f50d9.zip#pkgsCross.riscv32-embedded.riscv-pk
# fails to build due to this configure error
nix shell https://github.com/NixOS/nixpkgs/archive/4c5a455ca5c09a15edca42e83e8b65773da4394a.zip#pkgsCross.riscv32-embedded.riscv-pk

I think 1e47c87 may not take into account the fact that, with standalone none/eabi toolchains, you actually need those built with the compiler. Maybe we add an optional argument for such platforms? Let me know what you think @amjoseph-nixpkgs

@trepetti
Copy link
Contributor

#266364 is the relevant PR. Maybe we can modify the environment of these platforms specifically. The principle behind the fix in the commit in question makes sense to me, but I am not sure how best to proceed.

@ghost ghost self-assigned this Nov 17, 2023
@ghost
Copy link

ghost commented Nov 17, 2023

riscv64-none-elf-gcc fails to link basic file. This breaks the build of spike. . You will see riscv64-none-elf-ld: cannot find crt0.o: No such file or directory cannot find -lgloss: No such file or directory

I think I know what this is. Getting my builds caught up.

@ghost
Copy link

ghost commented Nov 17, 2023

@ghost
Copy link

ghost commented Nov 17, 2023

Yep, it fixes spike.

0x4d6165 pushed a commit to 0x4d6165/nixpkgs that referenced this issue Nov 20, 2023
This commit adds pkgs.spike, which internally uses
pkgsCross.riscv64-embedded.stdenv.cc, as a test case for the issue
reported in NixOS#267859
0x4d6165 pushed a commit to 0x4d6165/nixpkgs that referenced this issue Nov 20, 2023
In https://github.com/NixOS/nixpkgs/pull/266364/files I neglected to
evade one of newlib's other (annoying) self-disablement checks: when
host==target newlib decides it's not in the mood to build itself for
some reason.

Since we have an entire package for newlib (it's no longer part of
gcc) these checks are silly.  So I have evadede the second check as well.

Closes NixOS#267859
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants