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

undefined reference to '__atomic_compare_exchange_1' when running ./build_milkv.sh #3

Closed
VitalyAnkh opened this issue Aug 16, 2023 · 4 comments

Comments

@VitalyAnkh
Copy link

After running ./build_milkv.sh, I got error like this:

[riscv64-unknown-linux-musl-gcc] sample_venc.o
/home/vitalyr/projects/dev/embed/duo-buildroot-sdk/host-tools/gcc/riscv64-linux-musl-x86_64/bin/../lib/gcc/riscv64-unknown-linux-musl/10.2.0/../../../../riscv64-unknown-linux-musl/bin/ld: /home/vitalyr/projects/dev/embed/duo-buildroot-sdk/middleware/v2/lib/libsys.a(cvi_vb.o): in function `CVI_VB_Init':
/root/.jenkins/workspace/v4.1.0_release_build/middleware/v2/modules/sys/src/cvi_vb.c:201: undefined reference to `__atomic_compare_exchange_1'
/home/vitalyr/projects/dev/embed/duo-buildroot-sdk/host-tools/gcc/riscv64-linux-musl-x86_64/bin/../lib/gcc/riscv64-unknown-linux-musl/10.2.0/../../../../riscv64-unknown-linux-musl/bin/ld: /home/vitalyr/projects/dev/embed/duo-buildroot-sdk/middleware/v2/lib/libsys.a(cvi_vb.o): in function `CVI_VB_Exit':
/root/.jenkins/workspace/v4.1.0_release_build/middleware/v2/modules/sys/src/cvi_vb.c:225: undefined reference to `__atomic_compare_exchange_1'
collect2: error: ld returned 1 exit status

It seems to be already fixed by gcc toolchains([1], [2], [3]), but duo-build root-SDK will download an older gcc toolchain (gcc 10) to build the image. How about updating the toolchain?

  1. Consider open-coding subword atomics or move to libgcc riscvarchive/riscv-gcc#12
  2. https://www.overleaf.com/project/624c33c4e2d49b02be626e13
  3. Build failure on RISC-V due missing __atomic_exchange_1 advancedtelematic/aktualizr#1427 (comment)
@VitalyAnkh VitalyAnkh changed the title undefined reference to __atomic_compare_exchange_1' when running ./build_milkv.sh` undefined reference to '__atomic_compare_exchange_1' when running ./build_milkv.sh Aug 16, 2023
@xyq1113723547
Copy link

I also encountered this error.
I also notice multiple these warnings, which suggests that the toolchain is mis-configured about the ISA version.

warning: /home/yanqi/duo-buildroot-sdk/host-tools/gcc/riscv64-linux-musl-x86_64/bin/../lib/gcc/riscv64-unknown-linux-musl/10.2.0/lib64v0p7_xthead/lp64d/crtn.o: mis-matched ISA version 0.7 for 'zvlsseg' extension, the output version is 1.0

@pavelanni
Copy link

pavelanni commented Sep 1, 2023

Same here. Exactly the same message as @VitalyAnkh posted.

UPDATE: I was running the build on Fedora 38 when I got the error. After that I started an Ubuntu 22.04 container with Podman, followed the instructions in the README and the build was successful.

I placed my Containerfile and the instructions here: https://github.com/pavelanni/milkv-duo-experiments/tree/main/build-container

@carbonfix
Copy link
Contributor

Try using the latest code. If the compilation still fails, it is recommended that you use Docker to compile:
https://github.com/milkv-duo/duo-buildroot-sdk#2-compiled-using-docker

@xnvi
Copy link

xnvi commented Jun 24, 2024

我自己的解决方法,在sophpi/middleware/v2/sample/venc/Makefile的EXTRA_LDFLAGS 后面添加 -latomic,对vdec中的makefile同样有效

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

No branches or pull requests

5 participants