riscv-software-src / riscv-pk

RISC-V Proxy Kernel
Other
570 stars 304 forks source link

"Cannot open output file dummy_payload" when building with docker #319

Open kper opened 4 months ago

kper commented 4 months ago

Hey,

I am trying to build the riscv proxy kernel together with the gnu toolchain with docker and I receive the following error:

0.966 riscv32-unknown-linux-gnu-gcc -Wl,--build-id=none -nostartfiles -nostdlib -static    -fno-stack-protector -o dummy_payload dummy_payload.o -L.  -ldummy_payload -lgcc -Wl,--defsym=MEM_START=0x80000000,-T,./dummy_payload/dummy_payload.lds
0.970 /opt/riscv-cross/lib/gcc/riscv32-unknown-linux-gnu/13.2.0/../../../../riscv32-unknown-linux-gnu/bin/ld: cannot open output file dummy_payload: Is a directory
0.970 collect2: error: ld returned 1 exit status
0.971 make: *** [Makefile:336: dummy_payload] Error 1
0.971 make: *** Waiting for unfinished jobs....

with the following docker file:

FROM debian:12 as builder-riscv-toolchain
ARG num_jobs=24

ENV RISCV=/opt/riscv-cross
ENV PATH=$RISCV/bin:$PATH

RUN apt update && apt upgrade -y
RUN apt install -y build-essential autoconf automake autotools-dev python3 python3-pip libmpc-dev libmpfr-dev libgmp-dev gawk bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev ninja-build git cmake libglib2.0-dev curl device-tree-compiler curl libmpc-dev

WORKDIR /root
RUN git clone https://github.com/riscv-collab/riscv-gnu-toolchain
WORKDIR riscv-gnu-toolchain
RUN git submodule update --init --depth=1 -- gcc
RUN git submodule update --init --depth=1 -- glibc
RUN git submodule update --init --depth=1 -- binutils
RUN ./configure --with-arch=rv32gc --with-abi=ilp32 --enable-multilib --prefix=/opt/riscv-cross && make linux -j $num_jobs && make clean

# Spike

RUN apt install -y build-essential autoconf automake autotools-dev python3 python3-pip libmpc-dev libmpfr-dev libgmp-dev gawk bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev ninja-build git cmake libglib2.0-dev curl device-tree-compiler
WORKDIR /root
RUN git clone https://github.com/riscv-software-src/riscv-isa-sim
WORKDIR riscv-isa-sim
RUN ./configure --prefix=/opt/spike && make -j $num_jobs && make install && make clean

# Spike Proxy Kernel

WORKDIR /root
RUN git clone https://github.com/riscv-software-src/riscv-pk
WORKDIR riscv-pk
RUN ./configure --prefix=$RISCV --host=riscv32-unknown-linux-gnu
RUN make -j $num_jobs && make install && make clean

Run docker build -f Dockerfile -t riscv-spike .

kper commented 4 months ago

Also RUN ./configure --prefix=$RISCV --host=riscv32-unknown-linux-gnu --with-arch=rv32gc does not work