OCI image does not build on RISC-V architecture #2126

Open
opened 2026-08-11 13:25:53 +00:00 by Kagamiin · 5 comments

Description

When trying to build the OCI/Docker image on a computer with a 64-bit RISC-V CPU, the build script fails because it tries to install the x86-64 version of LLVM.

Hardware used for testing

StarFive VisionFive 2 v1.2A, SiFive JH-7110 (RV64IMAFDC, quad-core, 1.5 GHz)

Steps for reproduction

  • Attempt to build the OCI image on a riscv64 host
    • I used this build command: podman build -f docker/Dockerfile --build-arg TARGET_CPU=riscv64 -t continuwuity
    • On git commit hash: e335cde0dd
  • The build will fail when trying to install LLVM, with the following error:
E: Unable to correct problems, you have held broken packages.
E: The following information from --solver 3.0 may provide additional context:
   Unable to satisfy dependencies. Reached two conflicting decisions:
   1. lld-22:amd64=1:22.1.8~++20260613092233+e80beda6e255-1~exp1~20260613092250.77 is selected for install
   2. lld-22:amd64 Depends libc6:amd64 (>= 2.34)
      but none of the choices are installable:
      [no choices]
Error: building at STEP "RUN --mount=type=cache,target=/var/cache/apt,sharing=locked --mount=type=cache,target=/var/lib/apt,sharing=locked curl https://apt.llvm.org/llvm.sh > llvm.sh &&     chmod +x llvm.sh &&     ./llvm.sh ${LLVM_VERSION} &&     rm llvm.sh": while running runtime: exit status 100

Details

Investigating the issue, the root cause seems to be that the official APT PPA for LLVM does not provide RISC-V packages, and apt is somehow defaulting to trying to install a amd64 package.

An alternate repository might need to be used to install the packages in question.

## Description When trying to build the OCI/Docker image on a computer with a 64-bit RISC-V CPU, the build script fails because it tries to install the x86-64 version of LLVM. ## Hardware used for testing StarFive VisionFive 2 v1.2A, SiFive JH-7110 (RV64IMAFDC, quad-core, 1.5 GHz) ## Steps for reproduction - Attempt to build the OCI image on a riscv64 host - I used this build command: `podman build -f docker/Dockerfile --build-arg TARGET_CPU=riscv64 -t continuwuity` - On git commit hash: **e335cde0dd329e4d036c6f8ae05e40fa1abfe4dd** - The build will fail when trying to install LLVM, with the following error: ``` E: Unable to correct problems, you have held broken packages. E: The following information from --solver 3.0 may provide additional context: Unable to satisfy dependencies. Reached two conflicting decisions: 1. lld-22:amd64=1:22.1.8~++20260613092233+e80beda6e255-1~exp1~20260613092250.77 is selected for install 2. lld-22:amd64 Depends libc6:amd64 (>= 2.34) but none of the choices are installable: [no choices] Error: building at STEP "RUN --mount=type=cache,target=/var/cache/apt,sharing=locked --mount=type=cache,target=/var/lib/apt,sharing=locked curl https://apt.llvm.org/llvm.sh > llvm.sh && chmod +x llvm.sh && ./llvm.sh ${LLVM_VERSION} && rm llvm.sh": while running runtime: exit status 100 ``` ## Details Investigating the issue, the root cause seems to be that the official APT PPA for LLVM does not provide RISC-V packages, and apt is somehow defaulting to trying to install a amd64 package. An alternate repository might need to be used to install the packages in question.
Owner

Perhaps try cross compiling, using the correct command? The target_cpu flag is for selecting specific microarchitectures, not the target platform. docker buildx build . -f docker/Dockerfile -t continuwuity --platform linux/riscv64

Perhaps try cross compiling, using the correct command? The `target_cpu` flag is for selecting specific microarchitectures, not the target platform. `docker buildx build . -f docker/Dockerfile -t continuwuity --platform linux/riscv64`
Author

@Jade Will attempt that and report back soon, thanks.

@Jade Will attempt that and report back soon, thanks.
Author

We're getting an issue in the cargo build while trying to build jemalloc-sys:

    running: cd "/app/target/riscv64gc-unknown-linux-gnu/release/build/tikv-jemalloc-sys-96e05755b31e359d/out/build" && CC="riscv64gc-unknown-linux-gnu-clang" CFLAGS="-O3 -ffunction-sections -fdata-sections -fPIC --target=riscv64-unknown-linux-gnu -flto=thin -flto" CPPFLAGS="-O3 -ffunction-sections -fdata-sections -fPIC --target=riscv64-unknown-linux-gnu -flto=thin -flto" LDFLAGS="-O3 -ffunction-sections -fdata-sections -fPIC --target=riscv64-unknown-linux-gnu -flto=thin -flto" "sh" "/app/target/riscv64gc-unknown-linux-gnu/release/build/tikv-jemalloc-sys-96e05755b31e359d/out/build/configure" "--with-version=5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7" "--disable-cxx" "--enable-doc=no" "--enable-shared=no" "--with-private-namespace=_rjem_" "--disable-stats" "--host=riscv64-linux-gnu" "--build=x86_64-unknown-linux-gnu" "--prefix=/app/target/riscv64gc-unknown-linux-gnu/release/build/tikv-jemalloc-sys-96e05755b31e359d/out"
    checking for xsltproc... false
    checking for riscv64-linux-gnu-gcc... riscv64gc-unknown-linux-gnu-clang
    checking whether the C compiler works... no
    running: "tail" "-n" "100" "/app/target/riscv64gc-unknown-linux-gnu/release/build/tikv-jemalloc-sys-96e05755b31e359d/out/build/config.log"

(...)

    configure: error: in `/app/target/riscv64gc-unknown-linux-gnu/release/build/tikv-jemalloc-sys-96e05755b31e359d/out/build':
    configure: error: C compiler cannot create executables
    See `config.log' for more details
    
    thread 'main' (98) panicked at /usr/local/cargo/git/checkouts/jemallocator-6d972cd4aa247bb1/df86ff8/jemalloc-sys/build.rs:424:9:
    command did not execute successfully: cd "/app/target/riscv64gc-unknown-linux-gnu/release/build/tikv-jemalloc-sys-96e05755b31e359d/out/build" && CC="riscv64gc-unknown-linux-gnu-clang" CFLAGS="-O3 -ffunction-sections -fdata-sections -fPIC --target=riscv64-unknown-linux-gnu -flto=thin -flto" CPPFLAGS="-O3 -ffunction-sections -fdata-sections -fPIC --target=riscv64-unknown-linux-gnu -flto=thin -flto" LDFLAGS="-O3 -ffunction-sections -fdata-sections -fPIC --target=riscv64-unknown-linux-gnu -flto=thin -flto" "sh" "/app/target/riscv64gc-unknown-linux-gnu/release/build/tikv-jemalloc-sys-96e05755b31e359d/out/build/configure" "--with-version=5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7" "--disable-cxx" "--enable-doc=no" "--enable-shared=no" "--with-private-namespace=_rjem_" "--disable-stats" "--host=riscv64-linux-gnu" "--build=x86_64-unknown-linux-gnu" "--prefix=/app/target/riscv64gc-unknown-linux-gnu/release/build/tikv-jemalloc-sys-96e05755b31e359d/out"
    expected success, got: exit status: 77
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    )

A few notes:

  • We are using podman.
  • We are cross-compiling from an amd64 host.
  • We do have qemu-user-static installed for riscv64 emulation, if that's needed.

We're attaching the full build log below, if that helps. We tried to debug what's going on but didn't have much luck.

We're getting an issue in the cargo build while trying to build jemalloc-sys: ``` running: cd "/app/target/riscv64gc-unknown-linux-gnu/release/build/tikv-jemalloc-sys-96e05755b31e359d/out/build" && CC="riscv64gc-unknown-linux-gnu-clang" CFLAGS="-O3 -ffunction-sections -fdata-sections -fPIC --target=riscv64-unknown-linux-gnu -flto=thin -flto" CPPFLAGS="-O3 -ffunction-sections -fdata-sections -fPIC --target=riscv64-unknown-linux-gnu -flto=thin -flto" LDFLAGS="-O3 -ffunction-sections -fdata-sections -fPIC --target=riscv64-unknown-linux-gnu -flto=thin -flto" "sh" "/app/target/riscv64gc-unknown-linux-gnu/release/build/tikv-jemalloc-sys-96e05755b31e359d/out/build/configure" "--with-version=5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7" "--disable-cxx" "--enable-doc=no" "--enable-shared=no" "--with-private-namespace=_rjem_" "--disable-stats" "--host=riscv64-linux-gnu" "--build=x86_64-unknown-linux-gnu" "--prefix=/app/target/riscv64gc-unknown-linux-gnu/release/build/tikv-jemalloc-sys-96e05755b31e359d/out" checking for xsltproc... false checking for riscv64-linux-gnu-gcc... riscv64gc-unknown-linux-gnu-clang checking whether the C compiler works... no running: "tail" "-n" "100" "/app/target/riscv64gc-unknown-linux-gnu/release/build/tikv-jemalloc-sys-96e05755b31e359d/out/build/config.log" ``` (...) ``` configure: error: in `/app/target/riscv64gc-unknown-linux-gnu/release/build/tikv-jemalloc-sys-96e05755b31e359d/out/build': configure: error: C compiler cannot create executables See `config.log' for more details thread 'main' (98) panicked at /usr/local/cargo/git/checkouts/jemallocator-6d972cd4aa247bb1/df86ff8/jemalloc-sys/build.rs:424:9: command did not execute successfully: cd "/app/target/riscv64gc-unknown-linux-gnu/release/build/tikv-jemalloc-sys-96e05755b31e359d/out/build" && CC="riscv64gc-unknown-linux-gnu-clang" CFLAGS="-O3 -ffunction-sections -fdata-sections -fPIC --target=riscv64-unknown-linux-gnu -flto=thin -flto" CPPFLAGS="-O3 -ffunction-sections -fdata-sections -fPIC --target=riscv64-unknown-linux-gnu -flto=thin -flto" LDFLAGS="-O3 -ffunction-sections -fdata-sections -fPIC --target=riscv64-unknown-linux-gnu -flto=thin -flto" "sh" "/app/target/riscv64gc-unknown-linux-gnu/release/build/tikv-jemalloc-sys-96e05755b31e359d/out/build/configure" "--with-version=5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7" "--disable-cxx" "--enable-doc=no" "--enable-shared=no" "--with-private-namespace=_rjem_" "--disable-stats" "--host=riscv64-linux-gnu" "--build=x86_64-unknown-linux-gnu" "--prefix=/app/target/riscv64gc-unknown-linux-gnu/release/build/tikv-jemalloc-sys-96e05755b31e359d/out" expected success, got: exit status: 77 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ) ``` A few notes: - We are using podman. - We are cross-compiling from an amd64 host. - We do have qemu-user-static installed for riscv64 emulation, if that's needed. We're attaching the full build log below, if that helps. We tried to debug what's going on but didn't have much luck.
Owner

Hmm, can you get any more error details in that log? Maybe the contents of config.log? Looks like some kind of issue with the check that the compiler is working failing to execute the... executable. Also, does building for arm64 work?

Hmm, can you get any more error details in that log? Maybe the contents of config.log? Looks like some kind of issue with the check that the compiler is working failing to execute the... executable. Also, does building for arm64 work?
Author

An arm64 build works normally, no issues there. Seems like the issue only happens when I build for riscv64.

I'll try to extract the config.log file later - I'll need to modify the build to do that since the file is inside a cache mount that isn't accessible after the build process ends.

An arm64 build works normally, no issues there. Seems like the issue only happens when I build for riscv64. I'll try to extract the config.log file later - I'll need to modify the build to do that since the file is inside a cache mount that isn't accessible after the build process ends.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
continuwuation/continuwuity#2126
No description provided.