Crosscompile Dockerfile fixed, test obj files added

This commit is contained in:
nicolas 2025-02-24 23:24:48 +01:00
parent f68167c386
commit bb53c11dc1
11 changed files with 14 additions and 18 deletions

View File

@ -1,5 +1,5 @@
# Start with a base image containing build tools and libraries
FROM ubuntu:latest as builder
FROM debian:stable
# Set the working directory
WORKDIR /src
@ -7,7 +7,7 @@ WORKDIR /src
# Install necessary build tools
RUN apt-get update && apt-get install -y \
build-essential \
gcc \
gcc
# g++ \
# make \
# wget \
@ -21,27 +21,23 @@ RUN apt-get update && apt-get install -y \
# Install cross-compilers for x86, ARM, MIPS, and RISC-V
RUN apt-get install -y \
gcc-multilib \
gcc-arm-linux-gnueabihf \
gcc-mips-linux-gnu \
gcc-riscv64-linux-gnu \
gcc-aarch64-linux-gnu
gcc-12-arm-linux-gnueabihf \
gcc-12-mips-linux-gnu \
gcc-12-riscv64-linux-gnu \
gcc-12-aarch64-linux-gnu
# Copy the C file into the container
COPY test.c /src/
# Compile the C file for x86
RUN gcc -c -O0 -o obj/test-x86-o0.o test.c \
gcc -c -03 -o obj/test-x86-o3.o test.c \
CMD gcc -c -O0 test.c -o ../obj/test-x86-o0.o && \
gcc -c -O3 test.c -o ../obj/test-x86-o3.o && \
# Compile the C file for ARM
arm-linux-gnueabihf-gcc -c -O0 -o obj/test-arm-o0.o test.c \
arm-linux-gnueabihf-gcc -c -O3 -o obj/test-arm-o3.o test.c \
arm-linux-gnueabihf-gcc-12 -c -O0 test.c -o ../obj/test-arm-o0.o && \
arm-linux-gnueabihf-gcc-12 -c -O3 test.c -o ../obj/test-arm-o3.o && \
# Compile the C file for MIPS
mips-linux-gnu-gcc -c -O0 -o obj/test-mips-o0.o test.c \
mips-linux-gnu-gcc -c -O3 -o obj/test-mips-o3.o test.c \
mips-linux-gnu-gcc-12 -c -O0 test.c -o ../obj/test-mips-o0.o && \
mips-linux-gnu-gcc-12 -c -O3 test.c -o ../obj/test-mips-o3.o && \
# Compile the C file for RISC-V
riscv64-linux-gnu-gcc -c -O0 -o obj/test-riscv-o0.o test.c \
riscv64-linux-gnu-gcc -c -03 -o obj/test-riscv-o3.o test.c
# Set the default command (just listing the files as an example)
CMD ["ls", "-l"]
riscv64-linux-gnu-gcc-12 -c -O0 test.c -o ../obj/test-riscv-o0.o && \
riscv64-linux-gnu-gcc-12 -c -O3 test.c -o ../obj/test-riscv-o3.o

BIN
tests/obj/test-arm-o0.o Normal file

Binary file not shown.

BIN
tests/obj/test-arm-o3.o Normal file

Binary file not shown.

BIN
tests/obj/test-mips-o0.o Normal file

Binary file not shown.

BIN
tests/obj/test-mips-o3.o Normal file

Binary file not shown.

BIN
tests/obj/test-riscv-o0.o Normal file

Binary file not shown.

BIN
tests/obj/test-riscv-o3.o Normal file

Binary file not shown.

BIN
tests/obj/test-x86-o0.o Normal file

Binary file not shown.

BIN
tests/obj/test-x86-o3.o Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.