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: gf16_shuffle128_rvv.c:(.text+0x22e): undefined reference to `__riscv_vlseg2e8_v_u8m1' #449

Open
sanderjo opened this issue Dec 2, 2024 · 9 comments
Assignees
Labels
question Further information is requested

Comments

@sanderjo
Copy link
Contributor

sanderjo commented Dec 2, 2024

NZBGet Version

v24.5-testing

Platform

Linux/Docker

Environment

riscv64 
Bianbu OS

$ uname -a
Linux sander-desktop 6.6.36 #2.0.2.2 SMP PREEMPT Mon Nov 11 13:06:48 UTC 2024 riscv64 riscv64 riscv64 GNU/Linux

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Bianbu
Description:	Bianbu 2.0.2
Release:	2.0.2
Codename:	noble


$ cat /proc/cpuinfo 
processor	: 0
hart		: 0
model name	: Spacemit(R) X60
isa		: rv64imafdcv_zicbom_zicboz_zicntr_zicond_zicsr_zifencei_zihintpause_zihpm_zfh_zfhmin_zca_zcd_zba_zbb_zbc_zbs_zkt_zve32f_zve32x_zve64d_zve64f_zve64x_zvfh_zvfhmin_zvkt_sscofpmf_sstc_svinval_svnapot_svpbmt
mmu		: sv39
mvendorid	: 0x710
marchid		: 0x8000000058000001
mimpid		: 0x1000000049772200

Problem or Question

gcc (Ubuntu 13.2.0-23ubuntu4bb2) 13.2.0
mkdir build
cd build/
cmake ..
cmake --build . -j 2

gives the errors below (in the linking).

Because I see par2-turbo and gf16, I first tried compiling par2cmd-turbo from @animetosho , and that just works.

The procedure via wget https://nzbget.com/download/nzbget-latest-bin-linux.run works and results in a working riscv64 nzbget binary. So

  1. not urgent
  2. probably a (link?) parameter setting, and possibly a PEBKAC
[ 94%] Building CXX object CMakeFiles/nzbget.dir/daemon/util/Benchmark.cpp.o
[ 95%] Building CXX object CMakeFiles/nzbget.dir/daemon/system/SystemInfo.cpp.o
[ 96%] Building CXX object CMakeFiles/nzbget.dir/daemon/system/OS.cpp.o
[ 97%] Building CXX object CMakeFiles/nzbget.dir/daemon/system/CPU.cpp.o
[ 98%] Building CXX object CMakeFiles/nzbget.dir/daemon/system/Network.cpp.o
[100%] Linking CXX executable nzbget
/usr/bin/ld: par2-turbo/src/par2-turbo-build/libgf16.a(gf16_shuffle128_rvv.c.o): in function `gf16_shuffle_mul_128_rvv':
gf16_shuffle128_rvv.c:(.text+0x22e): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x334): undefined reference to `__riscv_vsseg2e8_v_u8m1'
/usr/bin/ld: par2-turbo/src/par2-turbo-build/libgf16.a(gf16_shuffle128_rvv.c.o): in function `gf16_shuffle_muladd_128_rvv':
gf16_shuffle128_rvv.c:(.text+0x5e8): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x60e): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x722): undefined reference to `__riscv_vsseg2e8_v_u8m1'
/usr/bin/ld: par2-turbo/src/par2-turbo-build/libgf16.a(gf16_shuffle128_rvv.c.o): in function `gf16_shuffle_muladd_multi_128_rvv':
gf16_shuffle128_rvv.c:(.text+0xe7c): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0xea0): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0xfa6): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x10bc): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x11cc): undefined reference to `__riscv_vsseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x16ce): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x16e0): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x17e4): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x190c): undefined reference to `__riscv_vsseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x1bae): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x1bc0): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x1cd6): undefined reference to `__riscv_vsseg2e8_v_u8m1'
/usr/bin/ld: par2-turbo/src/par2-turbo-build/libgf16.a(gf16_shuffle128_rvv.c.o): in function `gf16_shuffle_muladd_multi_stridepf_128_rvv':
gf16_shuffle128_rvv.c:(.text+0x232e): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x2340): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x2454): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x256a): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x268a): undefined reference to `__riscv_vsseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x2d20): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x2d32): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x2e46): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x2f5c): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x306c): undefined reference to `__riscv_vsseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x3532): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x3544): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x3648): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x3770): undefined reference to `__riscv_vsseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x3bc6): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x3bd8): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x3cea): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x3e12): undefined reference to `__riscv_vsseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x406a): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x407c): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x41a2): undefined reference to `__riscv_vsseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x43d0): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x43e2): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x4508): undefined reference to `__riscv_vsseg2e8_v_u8m1'
/usr/bin/ld: par2-turbo/src/par2-turbo-build/libgf16.a(gf16_shuffle128_rvv.c.o): in function `gf16_shuffle_muladd_multi_packed_128_rvv':
gf16_shuffle128_rvv.c:(.text+0x4bc8): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x4bda): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x4ce6): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x4dee): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x4f1e): undefined reference to `__riscv_vsseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x5436): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x5460): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x5566): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x567e): undefined reference to `__riscv_vsseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x58d2): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x58fc): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x5a20): undefined reference to `__riscv_vsseg2e8_v_u8m1'
/usr/bin/ld: par2-turbo/src/par2-turbo-build/libgf16.a(gf16_shuffle128_rvv.c.o): in function `gf16_shuffle_muladd_multi_packpf_128_rvv':
gf16_shuffle128_rvv.c:(.text+0x609a): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x60ac): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x61b6): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x62be): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x63ec): undefined reference to `__riscv_vsseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x6a1c): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x6a2e): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x6b38): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x6c40): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x6d70): undefined reference to `__riscv_vsseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x7224): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x724e): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x7354): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x746c): undefined reference to `__riscv_vsseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x78fa): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x7924): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x7a2a): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x7b42): undefined reference to `__riscv_vsseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x8168): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x817a): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x8284): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x838c): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x84bc): undefined reference to `__riscv_vsseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x8770): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x87a8): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x88bc): undefined reference to `__riscv_vsseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x8b0e): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x8b46): undefined reference to `__riscv_vlseg2e8_v_u8m1'
/usr/bin/ld: gf16_shuffle128_rvv.c:(.text+0x8c5a): undefined reference to `__riscv_vsseg2e8_v_u8m1'
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/nzbget.dir/build.make:1658: nzbget] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:93: CMakeFiles/nzbget.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2
sander@sander-desktop:~/git/nzbget/build$ 

Steps To Reproduce

see above

Logs

No response

Extra information

No response

@sanderjo sanderjo added the question Further information is requested label Dec 2, 2024
@sanderjo
Copy link
Contributor Author

sanderjo commented Dec 2, 2024

Without any knowledge:

sander@sander-desktop:~/git/nzbget$ grep -irn vlseg2e8_v_u8m1  *
grep: build/par2-turbo/src/par2-turbo-build/CMakeFiles/gf16.dir/parpar/gf16/gf16_shuffle128_rvv.c.o: binary file matches
grep: build/par2-turbo/src/par2-turbo-build/libgf16.a: binary file matches
build/par2-turbo/src/par2-turbo/parpar/gf16/gf16_shuffle128_rvv.c:15:	vuint8m1x2_t d = RV(vlseg2e8_v_u8m1x2)(src, vl);
build/par2-turbo/src/par2-turbo/parpar/gf16/gf16_shuffle128_rvv.c:27:#  define _vlseg2e8 RV(vlseg2e8_v_u8m1)

The same grep in par2cmdline-turbo: same result for sources, but not in the binary files

sander@sander-desktop:~/git/par2cmdline-turbo$ grep -irn vlseg2e8_v_u8m1  *
parpar/gf16/gf16_shuffle128_rvv.c:15:	vuint8m1x2_t d = RV(vlseg2e8_v_u8m1x2)(src, vl);
parpar/gf16/gf16_shuffle128_rvv.c:27:#  define _vlseg2e8 RV(vlseg2e8_v_u8m1)



@dnzbk dnzbk self-assigned this Dec 3, 2024
@animetosho
Copy link

Do you know what compiler/version are you using?

For the builds that succeed, I assume they're done outside of the Docker container, and using a different compiler/version?

@dnzbk
Copy link
Collaborator

dnzbk commented Dec 4, 2024

We’re cross-compiling for the RISC-V arch using a GCC 9.x toolchain built with Buildroot and the musl libc.
Besides, for gf16 and hasher, I based the CMake configuration files on the configs from the ParPar repository, so there can be some differences too.

@sanderjo
BTW, what RISC-V board are you using? I’m looking to buy a RISC-V board for testing and debugging.

@animetosho
Copy link

Actually, I think I found out what the issue is. sanderjo is probably using GCC 13, which lacks support for segmented loads/stores (hence the errors). I disabled RVV in GCC13 because of this, but I haven't made a release version with this change.

@sanderjo
Copy link
Contributor Author

sanderjo commented Dec 4, 2024

BTW, what RISC-V board are you using? I’m looking to buy a RISC-V board for testing and debugging.

Banana Pi BPI-F3. See https://docs.banana-pi.org/en/BPI-F3/BananaPi_BPI-F3

Quite nice: RVV1.0, nice performance (it even runs a GUI quite nicely), documentation, maintained OS (Bianbu OS, based on ubuntu)

@sanderjo
Copy link
Contributor Author

sanderjo commented Dec 4, 2024

Actually, I think I found out what the issue is. sanderjo is probably using GCC 13

Yes, sorry for not mentioning, gcc 13: gcc (Ubuntu 13.2.0-23ubuntu4bb2) 13.2.0

I do have gcc-14 on this system too, but I'm a bit scared of all the "sudo update-alternatives" command needed to switch to gcc-14.

I can start a docker with ubuntu 24.10 and gcc 14, to see if that compiles.

which lacks support for segmented loads/stores (hence the errors). I disabled RVV in GCC13 because of this, but I haven't made a release version with this change.

So if/when you release that, and nzbget picks it up, nzbget should compile on my RISCV64 with gcc 13?

@sanderjo
Copy link
Contributor Author

sanderjo commented Dec 4, 2024

Confirmed: builds nicely with gcc 14 (on Ubuntu 24.10, in docker). So indeed a gcc13 problem.

root@10052bfdba31:/nzbget/build# gcc --version
gcc (Ubuntu 14.2.0-4ubuntu2) 14.2.0
[ 97%] Building CXX object CMakeFiles/nzbget.dir/daemon/system/CPU.cpp.o
[ 98%] Building CXX object CMakeFiles/nzbget.dir/daemon/system/Network.cpp.o
[100%] Linking CXX executable nzbget
[100%] Built target nzbget
root@10052bfdba31:/nzbget/build# 
root@10052bfdba31:/nzbget/build# ./nzbget --version
nzbget version: 24.5
root@10052bfdba31:/nzbget/build# file nzbget
nzbget: ELF 64-bit LSB pie executable, UCB RISC-V, RVC, double-float ABI, version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-linux-riscv64-lp64d.so.1, BuildID[sha1]=cfc96edcc696f8b1fdacee845d5a7285bb410373, for GNU/Linux 4.15.0, stripped

@animetosho
Copy link

Thanks for testing!

So if/when you release that, and nzbget picks it up, nzbget should compile on my RISCV64 with gcc 13?

Yes, just with RVV disabled.

@animetosho
Copy link

par2cmdline-turbo v1.2.0 has been released with the compile fixes. This issue should be resolved when this fork pulls across the changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants