Add i368-elf-gcc v5.4 crosscompiler
This commit is contained in:
@ -1,7 +1,73 @@
|
||||
# We need an old ubuntu version with an old enough gcc to build an old gcc...
|
||||
# This gcc can't bootstrap itself because it's target is another platform.
|
||||
FROM ubuntu:bionic AS compiler-builder
|
||||
|
||||
RUN apt-get update \
|
||||
&& DEBIAN_FRONTEND=noninteractive TZ=Europe/Berlin apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
git \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
bison \
|
||||
flex \
|
||||
libgmp3-dev \
|
||||
libmpc-dev \
|
||||
libmpfr-dev \
|
||||
texinfo \
|
||||
libisl-dev \
|
||||
wget \
|
||||
&& apt-get clean
|
||||
|
||||
ARG GCCVERSION=5.4.0
|
||||
ARG BINUTILSVERSION=2.26.1
|
||||
ARG CROSSPREFIX=/opt/crosscompiler
|
||||
ARG CROSSTARGET=i686-elf
|
||||
|
||||
# Build Binutils for cross-compilation
|
||||
WORKDIR /
|
||||
RUN wget https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILSVERSION.tar.gz \
|
||||
&& tar xf binutils-$BINUTILSVERSION.tar.gz
|
||||
RUN mkdir binutils-build && cd binutils-build \
|
||||
&& /binutils-$BINUTILSVERSION/configure --target=$CROSSTARGET --prefix="$CROSSPREFIX" --with-sysroot --disable-nls --disable-werror \
|
||||
&& make -j$(nproc) \
|
||||
&& make install
|
||||
|
||||
# Build GCC for cross-compilation
|
||||
WORKDIR /
|
||||
RUN wget https://ftp.gnu.org/gnu/gcc/gcc-$GCCVERSION/gcc-$GCCVERSION.tar.gz \
|
||||
&& tar xf gcc-$GCCVERSION.tar.gz \
|
||||
&& cd gcc-$GCCVERSION \
|
||||
&& contrib/download_prerequisites
|
||||
RUN mkdir gcc-build && cd gcc-build \
|
||||
&& PATH="$CROSSPREFIX/bin:$PATH" /gcc-$GCCVERSION/configure --target=$CROSSTARGET --prefix="$CROSSPREFIX" --disable-nls --enable-languages=c,c++ --without-headers --disable-hosted-libstdcxx --disable-libsanitizer --disable-threads \
|
||||
&& PATH="$CROSSPREFIX/bin:$PATH" make all-gcc -j$(nproc) \
|
||||
&& PATH="$CROSSPREFIX/bin:$PATH" make all-target-libgcc -j$(nproc) \
|
||||
&& PATH="$CROSSPREFIX/bin:$PATH" make install-gcc \
|
||||
&& PATH="$CROSSPREFIX/bin:$PATH" make install-target-libgcc
|
||||
# && PATH="$CROSSPREFIX/bin:$PATH" make all-target-libstdc++-v3 -j$(nproc) \
|
||||
# && PATH="$CROSSPREFIX/bin:$PATH" make install-target-libstdc++-v3
|
||||
|
||||
# Build newlib - it seems like because I use the same gcc prefix
|
||||
# I don't even need to specify it as an include when building?
|
||||
ARG NEWLIBVERSION=4.1.0
|
||||
WORKDIR /
|
||||
RUN wget ftp://sourceware.org/pub/newlib/newlib-$NEWLIBVERSION.tar.gz \
|
||||
&& tar xf newlib-$NEWLIBVERSION.tar.gz
|
||||
RUN mkdir newlib-build && cd newlib-build \
|
||||
&& PATH="$CROSSPREFIX/bin:$PATH" /newlib-$NEWLIBVERSION/configure \
|
||||
--target=$CROSSTARGET \
|
||||
--prefix="$CROSSPREFIX" \
|
||||
--disable-nls \
|
||||
--disable-newlib-supplied-syscalls \
|
||||
&& PATH="$CROSSPREFIX/bin:$PATH" make -j$(nproc) \
|
||||
&& PATH="$CROSSPREFIX/bin:$PATH" make install
|
||||
|
||||
# =============================================================================
|
||||
|
||||
FROM ubuntu:noble AS wamr-builder
|
||||
|
||||
RUN apt-get update \
|
||||
&& DEBIAN_FRONTEND=noninteractive TZ=Europe/Berline apt-get install -y --no-install-recommends \
|
||||
&& DEBIAN_FRONTEND=noninteractive TZ=Europe/Berlin apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
gcc-multilib \
|
||||
g++-multilib \
|
||||
@ -16,6 +82,7 @@ RUN apt-get update \
|
||||
python3-minimal \
|
||||
python3-pip \
|
||||
ninja-build \
|
||||
wget \
|
||||
&& apt-get clean
|
||||
|
||||
# TODO: Can't find pthread on X86_32
|
||||
@ -28,9 +95,9 @@ RUN python3 -m pip config set global.break-system-packages true
|
||||
RUN git clone https://gitea.vps.chriphost.de/christoph/wamr \
|
||||
&& cd wamr \
|
||||
&& git checkout WAMR-2.4.4
|
||||
WORKDIR /wamr
|
||||
|
||||
# Build WAMR iwasm (vmcore standalone interpreter)
|
||||
WORKDIR /wamr
|
||||
RUN cd product-mini/platforms/linux \
|
||||
&& mkdir build_iwasm && cd build_iwasm \
|
||||
&& cmake \
|
||||
@ -48,6 +115,7 @@ RUN cd product-mini/platforms/linux \
|
||||
&& make -j$(nproc)
|
||||
|
||||
# Build WAMR wamrc (standalone compiler)
|
||||
WORKDIR /wamr
|
||||
RUN cd wamr-compiler \
|
||||
&& ./build_llvm.sh \
|
||||
&& mkdir build_wamrc && cd build_wamrc \
|
||||
@ -74,9 +142,11 @@ WORKDIR /
|
||||
RUN git clone https://gitea.vps.chriphost.de/christoph/wamr wamrlib \
|
||||
&& cd wamrlib \
|
||||
&& git checkout WAMR-2.4.4
|
||||
WORKDIR /wamrlib
|
||||
|
||||
# TODO: Should this stuff not be compiled with the crosscompiler?
|
||||
|
||||
# Build WAMR libvmlib (compiler runtime - to compile wasm modules embedded in a native application)
|
||||
# WORKDIR /wamrlib
|
||||
# RUN cd wamr-compiler \
|
||||
# && ./build_llvm.sh \
|
||||
# # && ./build_llvm.sh --extra-cmake-flags "-DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32 -DCMAKE_EXE_LINKER_FLAGS=-m32 -lstdc++" \
|
||||
@ -97,6 +167,7 @@ WORKDIR /wamrlib
|
||||
# && make -j$(nproc)
|
||||
|
||||
# Build WAMR libiwasm (vmcore interpreter runtime - to run wasm modules embedded in a native application)
|
||||
WORKDIR /wamrlib
|
||||
RUN mkdir build_libiwasm && cd build_libiwasm \
|
||||
&& cmake \
|
||||
-DWAMR_BUILD_PLATFORM=baremetal \
|
||||
@ -114,6 +185,7 @@ RUN mkdir build_libiwasm && cd build_libiwasm \
|
||||
.. \
|
||||
&& make -j$(nproc)
|
||||
|
||||
WORKDIR /wamrlib
|
||||
RUN mkdir build_libiwasm_64 && cd build_libiwasm_64 \
|
||||
&& cmake \
|
||||
-DWAMR_BUILD_PLATFORM=baremetal \
|
||||
@ -155,6 +227,7 @@ RUN apt-get update \
|
||||
bochs \
|
||||
&& apt-get clean
|
||||
|
||||
COPY --from=compiler-builder /opt/crosscompiler /opt/crosscompiler
|
||||
COPY --from=wamr-builder /wamrlib /opt/wamr
|
||||
COPY --from=wamr-builder /wamr/wamr-compiler/build_wamrc /opt/wamr/wamr-compiler/build_wamrc
|
||||
COPY --from=wamr-builder /wamr/product-mini/platforms/linux/build_iwasm /opt/wamr/product-mini/platforms/linux/build_iwasm
|
||||
|
||||
Reference in New Issue
Block a user