Skip to content

Instantly share code, notes, and snippets.

@pwhelan
Created Apr 23, 2020
Embed
What would you like to do?
Dockerfile for compiling z/OS GCC cross compiler
# https://blog.the-leviathan.ch/?p=1344
FROM ubuntu:18.04
RUN apt-get -y update && \
apt-get install -y git build-essential flex bison texinfo rsync
RUN git clone -b v5.3.12 https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
RUN cd linux && \
make ARCH=s390 config && \
make ARCH=s390 \
INSTALL_HDR_PATH=/opt/IBM/s390x-ibm-zos-gnu \
headers_install
RUN git clone -b lev/master https://github.com/leviathanch/binutils.git
RUN cd binutils && \
git checkout lev/master && \
mkdir -p build && cd build && \
CFLAGS="-Wno-error" ../configure --prefix=/opt/IBM \
--program-prefix=s390x-ibm-zos-gnu- \
--target=s390x-ibm-zos-gnu && \
make -j12 && make install
RUN git clone -b lev/master https://github.com/leviathanch/gcc.git
RUN apt-get install -y libgmp-dev libmpfr-dev libmpc-dev
RUN cd gcc && \
mkdir -p build && cd build && \
CFLAGS="-Wno-error" ../configure \
--prefix=/opt/IBM \
--program-prefix=s390x-ibm-zos-gnu- \
--target=s390x-ibm-zos-gnu \
--disable-multilib \
--enable-languages=c,c++ \
--disable-shared \
--disable-checking \
--enable-lock-elision=yes && \
make -j12 all-gcc && make install-gcc
RUN git clone -b lev/master https://github.com/leviathanch/glibc.git
RUN apt-get install -y gawk python
RUN cd glibc && \
mkdir -p build && cd build && \
TARGET_CC=s390x-ibm-zos-gnu-gcc CFLAGS="-Wno-error -I/opt/IBM/include -L/opt/IBM/lib64/gcc/s390x-ibm-zos-gnu/8.3.1 -I/opt/IBM/lib64/gcc/s390x-ibm-zos-gnu/8.3.1/include -static -fsplit-stack -O3 -fexec-charset=IBM-1047" \
../configure \
--prefix=/opt/IBM/s390x-ibm-zos-gnu \
--host=s390x-ibm-zos-gnu \
--target=s390x-ibm-zos-gnu \
--build=s390x-ibm-zos-gnu \
--disable-multilib \
--with-headers=/opt/IBM/s390x-ibm-zos-gnu/include \
--disable-shared \
--disable-nscd && \
make install-bootstrap-headers=yes install-headers && \
make -j12 csu/subdir_lib && \
install csu/*.o /opt/IBM/s390x-ibm-zos-gnu/lib/ && \
touch /opt/IBM/s390x-ibm-zos-gnu/include/gnu/stubs.h && \
s390x-ibm-zos-gnu-gcc && \
-nostdlib && \
-nostartfiles && \
-shared && \
-x c /dev/null && \
-o /opt/IBM/s390x-ibm-zos-gnu/lib/libc.so
RUN cd gcc/build && \
make -j12 all-target-libgcc && \
make install-target-libgcc
RUN cd glibc/build && \
make -j12 && \
make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment