(name . bug-guix@gnu.org)(address . bug-guix@gnu.org)
Hi,
I made this package:
```
(define-module (cross)
#:use-module (guix packages)
#:use-module (guix gexp)
#:use-module (gnu packages cross-base))
(define-public gcc-cross-riscv64-linux-gnu-toolchain
(cross-gcc-toolchain "riscv64-linux-gnu"))
```
And used in in the session you can read in the bottom of this email.
During the session, the `crt1.o` file is not found, and the
`riscv64-linux-gnu-gcc -v whatever.c` call shows `crt1.o` is passed to
the compiler using only the name, while in `gcc-toolchain` it's passed
using the full path to the libc.
This looks like the `cross-gcc-toolchain` is missing some configuration
for proper usage in a guix shell.
Best,
Ekaitz
The session I that explains the behavior:
```
# Using gcc-toolchain here `crt1.o` is found:
Ekaitz@tuxedo ~/projects/nlnet/gzip-1.2.4$ guix shell gcc-toolchain
Ekaitz@tuxedo ~/projects/nlnet/gzip-1.2.4 [env]$ gcc -v deflate.c
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/gnu/store/vjjk375kysja1jz0837lypd09rdgs47c-gcc-13.2.0/libexec/gcc/x86_64-unknown-linux-gnu/13.2.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with:
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.2.0 (GCC)
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=x86-64' '-dumpdir' 'a-'
/gnu/store/vjjk375kysja1jz0837lypd09rdgs47c-gcc-13.2.0/libexec/gcc/x86_64-unknown-linux-gnu/13.2.0/cc1
-quiet -v deflate.c -quiet -dumpdir a- -dumpbase deflate.c -dumpbase-ext
.c -mtune=generic -march=x86-64 -version -o /tmp/ccffA64a.s
GNU C17 (GCC) version 13.2.0 (x86_64-unknown-linux-gnu)
compiled by GNU C version 13.2.0, GMP version 6.2.1, MPFR version
4.2.0, MPC version 1.3.1, isl version isl-0.24-GMP
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/no-gcc-local-prefix/include"
ignoring nonexistent directory
"/gnu/store/m57d52krll9vlzmc0cqfg6dwn7n0p52j-gcc-13.2.0-lib/lib/gcc/x86_64-unknown-linux-gnu/13.2.0/../../../../../../../x86_64-unknown-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/gnu/store/0pr5ryw11f7pg5nhn42616k17ahdnily-profile/include
/gnu/store/m57d52krll9vlzmc0cqfg6dwn7n0p52j-gcc-13.2.0-lib/lib/gcc/x86_64-unknown-linux-gnu/13.2.0/include
/gnu/store/m57d52krll9vlzmc0cqfg6dwn7n0p52j-gcc-13.2.0-lib/lib/gcc/x86_64-unknown-linux-gnu/13.2.0/include-fixed
/gnu/store/ln6hxqjvz6m9gdd9s97pivlqck7hzs99-glibc-2.35/include
End of search list.
Compiler executable checksum: cd54e13587d35c4cb99945e5484c0675
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=x86-64' '-dumpdir' 'a-'
as -v --64 -o /tmp/cciGP5tQ.o /tmp/ccffA64a.s
GNU assembler version 2.38 (x86_64-unknown-linux-gnu) using BFD version
(GNU Binutils) 2.38
COMPILER_PATH=/gnu/store/vjjk375kysja1jz0837lypd09rdgs47c-gcc-13.2.0/libexec/gcc/x86_64-unknown-linux-gnu/13.2.0/:/gnu/store/vjjk375kysja1jz0837lypd09rdgs47c-gcc-13.2.0/libexec/gcc/x86_64-unknown-linux-gnu/13.2.0/:/gnu/store/vjjk375kysja1jz0837lypd09rdgs47c-gcc-13.2.0/libexec/gcc/x86_64-unknown-linux-gnu/:/gnu/store/m57d52krll9vlzmc0cqfg6dwn7n0p52j-gcc-13.2.0-lib/lib/gcc/x86_64-unknown-linux-gnu/13.2.0/:/gnu/store/m57d52krll9vlzmc0cqfg6dwn7n0p52j-gcc-13.2.0-lib/lib/gcc/x86_64-unknown-linux-gnu/
LIBRARY_PATH=/gnu/store/0pr5ryw11f7pg5nhn42616k17ahdnily-profile/lib/:/gnu/store/m57d52krll9vlzmc0cqfg6dwn7n0p52j-gcc-13.2.0-lib/lib/gcc/x86_64-unknown-linux-gnu/13.2.0/:/gnu/store/m57d52krll9vlzmc0cqfg6dwn7n0p52j-gcc-13.2.0-lib/lib/gcc/x86_64-unknown-linux-gnu/13.2.0/../../../:/gnu/store/ln6hxqjvz6m9gdd9s97pivlqck7hzs99-glibc-2.35/lib
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=x86-64' '-dumpdir' 'a.'
/gnu/store/vjjk375kysja1jz0837lypd09rdgs47c-gcc-13.2.0/libexec/gcc/x86_64-unknown-linux-gnu/13.2.0/collect2
-plugin
/gnu/store/vjjk375kysja1jz0837lypd09rdgs47c-gcc-13.2.0/libexec/gcc/x86_64-unknown-linux-gnu/13.2.0/liblto_plugin.so
-plugin-opt=/gnu/store/vjjk375kysja1jz0837lypd09rdgs47c-gcc-13.2.0/libexec/gcc/x86_64-unknown-linux-gnu/13.2.0/lto-wrapper
-plugin-opt=-fresolution=/tmp/ccdr9flx.res
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s
-plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s
--eh-frame-hdr -m elf_x86_64 -dynamic-linker
/gnu/store/ln6hxqjvz6m9gdd9s97pivlqck7hzs99-glibc-2.35/lib/ld-linux-x86-64.so.2
/gnu/store/0pr5ryw11f7pg5nhn42616k17ahdnily-profile/lib/crt1.o
/gnu/store/0pr5ryw11f7pg5nhn42616k17ahdnily-profile/lib/crti.o
/gnu/store/m57d52krll9vlzmc0cqfg6dwn7n0p52j-gcc-13.2.0-lib/lib/gcc/x86_64-unknown-linux-gnu/13.2.0/crtbegin.o
-L/gnu/store/0pr5ryw11f7pg5nhn42616k17ahdnily-profile/lib
-L/gnu/store/m57d52krll9vlzmc0cqfg6dwn7n0p52j-gcc-13.2.0-lib/lib/gcc/x86_64-unknown-linux-gnu/13.2.0
-L/gnu/store/m57d52krll9vlzmc0cqfg6dwn7n0p52j-gcc-13.2.0-lib/lib/gcc/x86_64-unknown-linux-gnu/13.2.0/../../..
-L/gnu/store/ln6hxqjvz6m9gdd9s97pivlqck7hzs99-glibc-2.35/lib
/tmp/cciGP5tQ.o -lgcc --push-state --as-needed -lgcc_s --pop-state
-L/gnu/store/ln6hxqjvz6m9gdd9s97pivlqck7hzs99-glibc-2.35/lib
-rpath=/gnu/store/ln6hxqjvz6m9gdd9s97pivlqck7hzs99-glibc-2.35/lib
-rpath=/gnu/store/m57d52krll9vlzmc0cqfg6dwn7n0p52j-gcc-13.2.0-lib/lib
-lgcc_s -lc -lgcc --push-state --as-needed -lgcc_s --pop-state
/gnu/store/m57d52krll9vlzmc0cqfg6dwn7n0p52j-gcc-13.2.0-lib/lib/gcc/x86_64-unknown-linux-gnu/13.2.0/crtend.o
/gnu/store/0pr5ryw11f7pg5nhn42616k17ahdnily-profile/lib/crtn.o
ld: /gnu/store/0pr5ryw11f7pg5nhn42616k17ahdnily-profile/lib/crt1.o: in
function `_start':
(.text+0x17): undefined reference to `main'
...
Ekaitz@tuxedo ~/projects/nlnet/gzip-1.2.4 [env]$ exit
# Now with riscv64, crt1.o is passed using a relative path and it fails:
Ekaitz@tuxedo ~/projects/nlnet/gzip-1.2.4$ guix shell
gcc-cross-riscv64-linux-gnu-toolchain
Ekaitz@tuxedo ~/projects/nlnet/gzip-1.2.4 [env]$ riscv64-linux-gnu-gcc
-v deflate.c
Using built-in specs.
COLLECT_GCC=riscv64-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/gnu/store/dl52ppai6dvdlw0jybx8qj5yvclhwqgl-gcc-cross-riscv64-linux-gnu-11.3.0/libexec/gcc/riscv64-linux-gnu/11.3.0/lto-wrapper
Target: riscv64-linux-gnu
Configured with:
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.3.0 (GCC)
COLLECT_GCC_OPTIONS='-v' '-march=rv64gc' '-mabi=lp64d' '-misa-spec=2.2'
'-march=rv64imafdc' '-dumpdir' 'a-'
/gnu/store/dl52ppai6dvdlw0jybx8qj5yvclhwqgl-gcc-cross-riscv64-linux-gnu-11.3.0/libexec/gcc/riscv64-linux-gnu/11.3.0/cc1
-quiet -v deflate.c -quiet -dumpdir a- -dumpbase deflate.c -dumpbase-ext
.c -march=rv64gc -mabi=lp64d -misa-spec=2.2 -march=rv64imafdc -version
-o /tmp/ccjXCE2o.s
GNU C17 (GCC) version 11.3.0 (riscv64-linux-gnu)
compiled by GNU C version 11.3.0, GMP version 6.2.1, MPFR version
4.2.0, MPC version 1.3.1, isl version isl-0.24-GMP
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/no-gcc-local-prefix/include"
ignoring nonexistent directory
"/gnu/store/rn39sf79yb5wcfclkfxzwz8r71jmwi6c-gcc-cross-riscv64-linux-gnu-11.3.0-lib/lib/gcc/riscv64-linux-gnu/11.3.0/../../../../../../../riscv64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/gnu/store/rn39sf79yb5wcfclkfxzwz8r71jmwi6c-gcc-cross-riscv64-linux-gnu-11.3.0-lib/lib/gcc/riscv64-linux-gnu/11.3.0/include
/gnu/store/rn39sf79yb5wcfclkfxzwz8r71jmwi6c-gcc-cross-riscv64-linux-gnu-11.3.0-lib/lib/gcc/riscv64-linux-gnu/11.3.0/include-fixed
/gnu/store/f0rksvsrhzbn4ss4gd4p1s677awfzz08-glibc-cross-riscv64-linux-gnu-2.35/include
End of search list.
GNU C17 (GCC) version 11.3.0 (riscv64-linux-gnu)
compiled by GNU C version 11.3.0, GMP version 6.2.1, MPFR version
4.2.0, MPC version 1.3.1, isl version isl-0.24-GMP
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: c32f88db5f6319705b0dc5f3836ff976
COLLECT_GCC_OPTIONS='-v' '-march=rv64gc' '-mabi=lp64d' '-misa-spec=2.2'
'-march=rv64imafdc' '-dumpdir' 'a-'
/gnu/store/dl52ppai6dvdlw0jybx8qj5yvclhwqgl-gcc-cross-riscv64-linux-gnu-11.3.0/libexec/gcc/riscv64-linux-gnu/as
-v --traditional-format -march=rv64gc -march=rv64imafdc -mabi=lp64d
-misa-spec=2.2 -o /tmp/ccLQFrsU.o /tmp/ccjXCE2o.s
GNU assembler version 2.38 (riscv64-linux-gnu) using BFD version (GNU
Binutils) 2.38
COMPILER_PATH=/gnu/store/dl52ppai6dvdlw0jybx8qj5yvclhwqgl-gcc-cross-riscv64-linux-gnu-11.3.0/libexec/gcc/riscv64-linux-gnu/11.3.0/:/gnu/store/dl52ppai6dvdlw0jybx8qj5yvclhwqgl-gcc-cross-riscv64-linux-gnu-11.3.0/libexec/gcc/riscv64-linux-gnu/11.3.0/:/gnu/store/dl52ppai6dvdlw0jybx8qj5yvclhwqgl-gcc-cross-riscv64-linux-gnu-11.3.0/libexec/gcc/riscv64-linux-gnu/:/gnu/store/rn39sf79yb5wcfclkfxzwz8r71jmwi6c-gcc-cross-riscv64-linux-gnu-11.3.0-lib/lib/gcc/riscv64-linux-gnu/11.3.0/:/gnu/store/rn39sf79yb5wcfclkfxzwz8r71jmwi6c-gcc-cross-riscv64-linux-gnu-11.3.0-lib/lib/gcc/riscv64-linux-gnu/
CROSS_LIBRARY_PATH=/gnu/store/rn39sf79yb5wcfclkfxzwz8r71jmwi6c-gcc-cross-riscv64-linux-gnu-11.3.0-lib/lib/gcc/riscv64-linux-gnu/11.3.0/:/gnu/store/rn39sf79yb5wcfclkfxzwz8r71jmwi6c-gcc-cross-riscv64-linux-gnu-11.3.0-lib/lib/gcc/riscv64-linux-gnu/11.3.0/../../../../riscv64-linux-gnu/lib/:/gnu/store/f0rksvsrhzbn4ss4gd4p1s677awfzz08-glibc-cross-riscv64-linux-gnu-2.35/lib
COLLECT_GCC_OPTIONS='-v' '-march=rv64gc' '-mabi=lp64d' '-misa-spec=2.2'
'-march=rv64imafdc' '-dumpdir' 'a.'
/gnu/store/dl52ppai6dvdlw0jybx8qj5yvclhwqgl-gcc-cross-riscv64-linux-gnu-11.3.0/libexec/gcc/riscv64-linux-gnu/11.3.0/collect2
-plugin
/gnu/store/dl52ppai6dvdlw0jybx8qj5yvclhwqgl-gcc-cross-riscv64-linux-gnu-11.3.0/libexec/gcc/riscv64-linux-gnu/11.3.0/liblto_plugin.so
-plugin-opt=/gnu/store/dl52ppai6dvdlw0jybx8qj5yvclhwqgl-gcc-cross-riscv64-linux-gnu-11.3.0/libexec/gcc/riscv64-linux-gnu/11.3.0/lto-wrapper
-plugin-opt=-fresolution=/tmp/cc0p0r5t.res
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s
-plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s
--sysroot=/ --eh-frame-hdr -melf64lriscv -dynamic-linker
/gnu/store/f0rksvsrhzbn4ss4gd4p1s677awfzz08-glibc-cross-riscv64-linux-gnu-2.35/lib/ld-linux-riscv64-lp64d.so.1
crt1.o
/gnu/store/rn39sf79yb5wcfclkfxzwz8r71jmwi6c-gcc-cross-riscv64-linux-gnu-11.3.0-lib/lib/gcc/riscv64-linux-gnu/11.3.0/crti.o
/gnu/store/rn39sf79yb5wcfclkfxzwz8r71jmwi6c-gcc-cross-riscv64-linux-gnu-11.3.0-lib/lib/gcc/riscv64-linux-gnu/11.3.0/crtbegin.o
-L/gnu/store/rn39sf79yb5wcfclkfxzwz8r71jmwi6c-gcc-cross-riscv64-linux-gnu-11.3.0-lib/lib/gcc/riscv64-linux-gnu/11.3.0
-L/gnu/store/rn39sf79yb5wcfclkfxzwz8r71jmwi6c-gcc-cross-riscv64-linux-gnu-11.3.0-lib/lib/gcc/riscv64-linux-gnu/11.3.0/../../../../riscv64-linux-gnu/lib
-L/gnu/store/f0rksvsrhzbn4ss4gd4p1s677awfzz08-glibc-cross-riscv64-linux-gnu-2.35/lib
/tmp/ccLQFrsU.o -lgcc --push-state --as-needed -lgcc_s --pop-state
-L/gnu/store/f0rksvsrhzbn4ss4gd4p1s677awfzz08-glibc-cross-riscv64-linux-gnu-2.35/lib
-rpath=/gnu/store/f0rksvsrhzbn4ss4gd4p1s677awfzz08-glibc-cross-riscv64-linux-gnu-2.35/lib
-rpath=/gnu/store/rn39sf79yb5wcfclkfxzwz8r71jmwi6c-gcc-cross-riscv64-linux-gnu-11.3.0-lib/riscv64-linux-gnu/lib
-lgcc_s -lc -lgcc --push-state --as-needed -lgcc_s --pop-state
/gnu/store/rn39sf79yb5wcfclkfxzwz8r71jmwi6c-gcc-cross-riscv64-linux-gnu-11.3.0-lib/lib/gcc/riscv64-linux-gnu/11.3.0/crtend.o
/gnu/store/rn39sf79yb5wcfclkfxzwz8r71jmwi6c-gcc-cross-riscv64-linux-gnu-11.3.0-lib/lib/gcc/riscv64-linux-gnu/11.3.0/crtn.o
riscv64-linux-gnu-ld: cannot find crt1.o: No such file or directory
collect2: error: ld returned 1 exit status
```