From 25b5ecfb3bdba1adf19895a6a00adad8bdcd6d03 Mon Sep 17 00:00:00 2001 From: Christoph Urlacher Date: Sun, 8 Mar 2026 15:25:45 +0100 Subject: [PATCH] Build libiwasm using gcc-i386-elf --- wasm-base.dockerfile | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/wasm-base.dockerfile b/wasm-base.dockerfile index eb7c4df..9ccac04 100644 --- a/wasm-base.dockerfile +++ b/wasm-base.dockerfile @@ -21,7 +21,7 @@ RUN apt-get update \ ARG GCCVERSION=5.4.0 ARG BINUTILSVERSION=2.26.1 ARG CROSSPREFIX=/opt/crosscompiler -ARG CROSSTARGET=i686-elf +ARG CROSSTARGET=i386-elf # Build Binutils for cross-compilation WORKDIR / @@ -162,12 +162,22 @@ RUN git clone https://gitea.vps.chriphost.de/christoph/wamr wamrlib \ # && make -j$(nproc) # Build WAMR libiwasm (vmcore interpreter runtime - to run wasm modules embedded in a native application) +# TODO: Should probably put the cross-compilation definitions in a toolchain file +COPY --from=compiler-builder /opt/crosscompiler /opt/crosscompiler WORKDIR /wamrlib RUN mkdir build_libiwasm && cd build_libiwasm \ && cmake \ + -DCMAKE_SYSTEM_NAME=Generic \ + -DCMAKE_SYSTEM_PROCESSOR=i386 \ + -DCMAKE_C_COMPILER=/opt/crosscompiler/bin/i386-elf-gcc \ + -DCMAKE_CXX_COMPILER=/opt/crosscompiler/bin/i386-elf-g++ \ + -DCMAKE_ASM_COMPILER=/opt/crosscompiler/bin/i386-elf-gcc \ + -DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_VERBOSE_MAKEFILE=ON \ -DWAMR_BUILD_PLATFORM=baremetal \ -DWAMR_BUILD_TARGET=X86_32 \ - -DWAMR_BUILD_AOT=0 \ + -DWAMR_BUILD_AOT=1 \ -DWAMR_BUILD_WAMR_COMPILER=0 \ -DWAMR_BUILD_INTERP=1 \ -DWAMR_BUILD_FAST_INTERP=0 \ @@ -234,7 +244,12 @@ RUN ln -sf /opt/wamr/product-mini/platforms/linux/build_iwasm /opt/wamr-iwasm \ && ln -sf /opt/wamr/build_libiwasm /opt/wamr-libiwasm \ && ln -sf /opt/wamr/build_libiwasm_linux /opt/wamr-libiwasm-linux -COPY ./examples /home/ubuntu/examples -WORKDIR /home/ubuntu/examples +RUN useradd fail \ + && mkdir /home/fail && chown fail /home/fail \ + && echo 'fail:fail' | chpasswd && chsh fail --shell /usr/bin/fish \ + && adduser fail sudo + +COPY ./examples /home/fail/examples +WORKDIR /home/fail/examples ENV PATH="$PATH:/opt/wasi-sdk/bin:/opt/wamr-iwasm:/opt/wamr-wamrc"