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

RISC-V linux cross compilation failing since staging-next merge #169278

Closed
Madouura opened this issue Apr 19, 2022 · 4 comments
Closed

RISC-V linux cross compilation failing since staging-next merge #169278

Madouura opened this issue Apr 19, 2022 · 4 comments
Labels
0.kind: bug 6.topic: cross-compilation Building packages on a different sort platform than than they will be run on 6.topic: kernel 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related

Comments

@Madouura
Copy link
Contributor

Describe the bug

At least since #168737 was merged into master, #168826 has failed to compile.
I suspect a GCC change causing this issue.

riscv64-linux-gcc -DHAVE_CONFIG_H -I. -I../..  -DLOCALEDIR=\"/nix/store/84q2jjw95gh7qy3iqvqb45jn2zbhvj88-xz-riscv64-linux-5.2.5/share/locale\" -I../../src/common -I../../src/liblzma/api -I../../lib  -pthread -fvisibility=hidden -Wall -Wextra -Wvla -Wformat=2 -Winit-self -Wmissing-include-dirs -Wstrict-aliasing -Wfloat-equal -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wlogical-op -Waggregate-return -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wmissing-noreturn -Wredundant-decls -g -O2 -c -o xz-tuklib_mbstr_width.o `test -f '../common/tuklib_mbstr_width.c' || echo './'`../common/tuklib_mbstr_width.c
   riscv64-linux-g++     ...  servls.cpp
  CC       setlocale_null.o
checking for pthread_join in -lpthread... yes
checking for isblank... yes
riscv64-linux-gcc -I.  -DHAVE_CONFIG_H -g -O2 -ggdb3 -Wall -W -Wno-sign-compare   -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes   -Wpointer-arith -Wbad-function-cast -Wnested-externs -fpic  -c rsa-sec-compute-root.c \
&& true
../arch/riscv/include/asm/vdso/gettimeofday.h: Assembler messages:
../arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unrecognized opcode `csrr a4,0xc01'
../arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unrecognized opcode `csrr a5,0xc01'
../arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unrecognized opcode `csrr a4,0xc01'
../arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unrecognized opcode `csrr a5,0xc01'
make[2]: *** [../scripts/Makefile.build:288: arch/riscv/kernel/vdso/vgettimeofday.o] Error 1
/nix/store/fcd0m68c331j7nkdxvnnpb8ggwsaiqac-bash-5.1-p16/bin/bash ./libtool  --tag=CC   --mode=compile riscv64-linux-gcc -DHAVE_CONFIG_H -I.     -g -O2 -c -o mips/mips_init.lo mips/mips_init.c
Enabled Schematron support
make[1]: *** [../arch/riscv/Makefile:120: vdso_prepare] Error 2
make[1]: Leaving directory '/build/source/build'
make: *** [Makefile:219: __sub-make] Error 2
/nix/store/fcd0m68c331j7nkdxvnnpb8ggwsaiqac-bash-5.1-p16/bin/bash ../libtool  --tag=CC   --mode=compile riscv64-linux-gcc -DHAVE_CONFIG_H -I. -I..    -I/nix/store/agic7qa5l02cfy2vyq2nabpg2dq6px1v-libgpg-error-riscv64-linux-1.42-dev/include  -g -O2 -fvisibility=hidden -fno-delete-null-pointer-checks -Wall -c -o libgcrypt_la-global.lo `test -f 'global.c' || echo './'`global.c
riscv64-linux-gcc -DHAVE_CONFIG_H -I. -I../..  -DLOCALEDIR=\"/nix/store/84q2jjw95gh7qy3iqvqb45jn2zbhvj88-xz-riscv64-linux-5.2.5/share/locale\" -I../../src/common -I../../src/liblzma/api -I../../lib  -pthread -fvisibility=hidden -Wall -Wextra -Wvla -Wformat=2 -Winit-self -Wmissing-include-dirs -Wstrict-aliasing -Wfloat-equal -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wlogical-op -Waggregate-return -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wmissing-noreturn -Wredundant-decls -g -O2 -c -o xz-tuklib_mbstr_fw.o `test -f '../common/tuklib_mbstr_fw.c' || echo './'`../common/tuklib_mbstr_fw.c
builder for '/nix/store/qbplv2xrhm7vykirys4p4fdpvs5l6vdz-linux-riscv64-linux-5.17.1-visionfive.drv' failed with exit code 2
cannot build derivation '/nix/store/5ncfqz7m4nqhawfwdcib850dccd59p3b-nixos-system-nixos-22.05pre-git.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/ykl76jhdjahkhx22zk00pk26a7jrhg88-ext4-fs.img.zst-riscv64-linux.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/9b2w7mdbh54n82g3xy2xnfgzlij0m3mr-nixos-sd-image-22.05pre-git-riscv64-linux-visionfive.img-riscv64-linux.drv': 1 dependencies couldn't be built
error: build of '/nix/store/9b2w7mdbh54n82g3xy2xnfgzlij0m3mr-nixos-sd-image-22.05pre-git-riscv64-linux-visionfive.img-riscv64-linux.drv' failed

Same issue with linux-5.15.34 with no changes.

  LINK     resolve_btfids
  LDS     arch/riscv/kernel/vdso/vdso.lds
  AS      arch/riscv/kernel/vdso/rt_sigreturn.o
  CC      arch/riscv/kernel/vdso/vgettimeofday.o
../arch/riscv/include/asm/vdso/gettimeofday.h: Assembler messages:
../arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unrecognized opcode `csrr a4,0xc01'
../arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unrecognized opcode `csrr a4,0xc01'
make[2]: *** [../scripts/Makefile.build:277: arch/riscv/kernel/vdso/vgettimeofday.o] Error 1
make[1]: *** [../arch/riscv/Makefile:121: vdso_prepare] Error 2
make[1]: Leaving directory '/build/linux-5.15.34/build'
make: *** [Makefile:219: __sub-make] Error 2
builder for '/nix/store/nbmmmcbrnrhr6c8hcznw0ybjzn55sj5b-linux-riscv64-unknown-linux-gnu-5.15.34.drv' failed with exit code 2
error: build of '/nix/store/nbmmmcbrnrhr6c8hcznw0ybjzn55sj5b-linux-riscv64-unknown-linux-gnu-5.15.34.drv' failed

Expected behavior

Successful (starfive variant) linux kernel cross compilation from x86_64 to risc64.

Additional context

Attempting to build #168826

Notify maintainers

@fabianhjr @mweinelt (#168737 (comment))

Metadata

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.16.20, NixOS, 21.11 (Porcupine)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.16`
 - channels(root): `"nixos-21.11, home-manager-21.11"`
 - channels(mado): `"home-manager-21.11, nixos-21.11.337100.7b38b03d76a, nixos-unstable-22.05pre369988.1ffba9f2f68"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
@Artturin Artturin added the 6.topic: cross-compilation Building packages on a different sort platform than than they will be run on label Apr 20, 2022
@Madouura
Copy link
Contributor Author

Interestingly, adding stdenv = pkgs.overrideCC pkgs.stdenv pkgs.buildPackages.gcc11; to the proper entry in linux-kernels.nix fixes this.

@Madouura Madouura mentioned this issue Apr 21, 2022
14 tasks
@NickCao
Copy link
Member

NickCao commented Apr 22, 2022

Maybe it's a chance to bump the default stdenv for riscv64-linux to gcc11? I'd like to test if it works out.

@NickCao
Copy link
Member

NickCao commented Apr 22, 2022

Maybe it's a chance to bump the default stdenv for riscv64-linux to gcc11? I'd like to test if it works out.

It worked out way better than I anticipated, https://hydra.nichi.co/eval/707, the only major regression is gccForLibs failing, drowning the llvmPackages.

@Madouura
Copy link
Contributor Author

Madouura commented May 1, 2022

Will be fixed by #170991.

@Madouura Madouura closed this as completed May 1, 2022
@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 6.topic: cross-compilation Building packages on a different sort platform than than they will be run on 6.topic: kernel 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related
Projects
None yet
Development

No branches or pull requests

5 participants