Build libiwasm using gcc-i386-elf

This commit is contained in:
2026-03-08 15:25:45 +01:00
parent 60fa13573d
commit 25b5ecfb3b

View File

@ -21,7 +21,7 @@ RUN apt-get update \
ARG GCCVERSION=5.4.0 ARG GCCVERSION=5.4.0
ARG BINUTILSVERSION=2.26.1 ARG BINUTILSVERSION=2.26.1
ARG CROSSPREFIX=/opt/crosscompiler ARG CROSSPREFIX=/opt/crosscompiler
ARG CROSSTARGET=i686-elf ARG CROSSTARGET=i386-elf
# Build Binutils for cross-compilation # Build Binutils for cross-compilation
WORKDIR / WORKDIR /
@ -162,12 +162,22 @@ RUN git clone https://gitea.vps.chriphost.de/christoph/wamr wamrlib \
# && make -j$(nproc) # && make -j$(nproc)
# Build WAMR libiwasm (vmcore interpreter runtime - to run wasm modules embedded in a native application) # 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 WORKDIR /wamrlib
RUN mkdir build_libiwasm && cd build_libiwasm \ RUN mkdir build_libiwasm && cd build_libiwasm \
&& cmake \ && 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_PLATFORM=baremetal \
-DWAMR_BUILD_TARGET=X86_32 \ -DWAMR_BUILD_TARGET=X86_32 \
-DWAMR_BUILD_AOT=0 \ -DWAMR_BUILD_AOT=1 \
-DWAMR_BUILD_WAMR_COMPILER=0 \ -DWAMR_BUILD_WAMR_COMPILER=0 \
-DWAMR_BUILD_INTERP=1 \ -DWAMR_BUILD_INTERP=1 \
-DWAMR_BUILD_FAST_INTERP=0 \ -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 /opt/wamr-libiwasm \
&& ln -sf /opt/wamr/build_libiwasm_linux /opt/wamr-libiwasm-linux && ln -sf /opt/wamr/build_libiwasm_linux /opt/wamr-libiwasm-linux
COPY ./examples /home/ubuntu/examples RUN useradd fail \
WORKDIR /home/ubuntu/examples && 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" ENV PATH="$PATH:/opt/wasi-sdk/bin:/opt/wamr-iwasm:/opt/wamr-wamrc"