Last active
October 20, 2022 10:25
-
-
Save olologin/b4ba2db91fc5c526d625715b39ac4579 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:stretch | |
# install build tools | |
RUN apt-get update -y; \ | |
apt-get install -y \ | |
wget | |
RUN wget https://github.com/Kitware/CMake/releases/download/v3.24.2/cmake-3.24.2-linux-x86_64.tar.gz \ | |
&& tar -xvf cmake-*.*.*-linux-x86_64.tar.gz -C /usr/local/ \ | |
&& ln -s /usr/local/cmake-*.*.*-linux-x86_64/bin/cmake /usr/local/bin/cmake | |
RUN apt-get install -y \ | |
doxygen \ | |
build-essential \ | |
pkg-config \ | |
subversion \ | |
python2.7 \ | |
python3 \ | |
nano \ | |
gdb \ | |
ninja-build \ | |
libosmesa-dev \ | |
libxrandr-dev \ | |
libxinerama-dev \ | |
libxcursor-dev \ | |
libfontconfig1-dev \ | |
libxi-dev \ | |
libglew-dev \ | |
freeglut3-dev \ | |
libfreetype6-dev | |
RUN apt-get install -y unzip \ | |
libcurl4-openssl-dev \ | |
autoconf \ | |
python3-pip \ | |
htop \ | |
libcurl4-openssl-dev \ | |
python3-pip \ | |
gettext \ | |
autoconf && \ | |
pip3 install keyring && \ | |
mkdir /git && cd /git && \ | |
wget https://github.com/git/git/archive/refs/tags/v2.37.1.zip && \ | |
unzip v2.37.1.zip && \ | |
cd git-2.37.1 && \ | |
make configure && \ | |
./configure && \ | |
make install && \ | |
wget https://github.com/git-lfs/git-lfs/releases/download/v3.2.0/git-lfs-linux-amd64-v3.2.0.tar.gz && \ | |
tar -xzf git-lfs-linux-amd64-v3.2.0.tar.gz && \ | |
cd git-lfs-3.2.0 && ./install.sh && \ | |
cd / && \ | |
rm -rf git | |
RUN apt-get install -y \ | |
gdb \ | |
nano | |
# Download and unpack GCC | |
RUN mkdir -p /gcc_build && \ | |
cd /gcc_build && \ | |
wget https://mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-12.2.0/gcc-12.2.0.tar.xz && \ | |
tar xf gcc-12.2.0.tar.xz && \ | |
cd gcc-12.2.0 && \ | |
contrib/download_prerequisites | |
# Configure and build gcc | |
RUN cd /gcc_build && mkdir build && cd build && \ | |
../gcc-12.2.0/configure -v --with-pkgversion='Debian 12.2.0' --enable-languages=c,c++ --prefix=/usr/local/gcc12 --with-gcc-major-version-only --program-suffix=-12 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/local/gcc12/lib --without-included-gettext --enable-threads=posix --libdir=/usr/local/gcc12/lib --enable-nls --enable-bootstrap --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --disable-browser-plugin --with-target-system-zlib --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --disable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --enable-link-mutex --disable-linux-futex && \ | |
make -j16 && make install-strip && cd / && rm -rf gcc_build | |
# Remove new runtime libraries to make sure GCC doesn't link with them | |
RUN rm -rf /usr/local/gcc12/share/gcc-12/python && \ | |
find /usr/local/gcc12/ -name "*.a" -type f -delete && \ | |
find /usr/local/gcc12/ -name "*.o" -type f -delete && \ | |
find /usr/local/gcc12/lib64 -name "*.la" -type f -delete && \ | |
find /usr/local/gcc12/lib64 -name "*.so*" -type f -delete && \ | |
cp /usr/lib/gcc/x86_64-linux-gnu/6/crtbeginS.o /usr/local/gcc12/lib/gcc/x86_64-linux-gnu/12/crtbeginS.o && \ | |
cp /usr/lib/gcc/x86_64-linux-gnu/6/crtendS.o /usr/local/gcc12/lib/gcc/x86_64-linux-gnu/12/crtendS.o && \ | |
cp /usr/include/c++/6/istream /usr/local/gcc12/include/c++/12/istream && \ | |
cp /usr/include/c++/6/bits/exception_ptr.h /usr/local/gcc12/include/c++/12/bits/exception_ptr.h && \ | |
sed -i '38i #define ATOMIC_INT_LOCK_FREE 2' /usr/local/gcc12/include/c++/12/bits/exception_ptr.h | |
# Then when we build our code we have to configure with: | |
# cmake ../sources -GNinja \ | |
# -DCMAKE_BUILD_TYPE=Release \ | |
# -DCMAKE_C_COMPILER=/usr/local/gcc12/bin/x86_64-linux-gnu-gcc-12 \ | |
# -DCMAKE_CXX_COMPILER=/usr/local/gcc12/bin/x86_64-linux-gnu-g++-12 \ | |
# -DCMAKE_CXX_FLAGS="-fabi-version=10 -fnew-inheriting-ctors" \ | |
# -DCMAKE_SHARED_LINKER_FLAGS="-Wl,-L/usr/lib/gcc/x86_64-linux-gnu/6/" \ | |
# -DCMAKE_EXE_LINKER_FLAGS="-Wl,-L/usr/lib/gcc/x86_64-linux-gnu/6/" \ | |
# -DCMAKE_C_FLAGS_DEBUG="--gdwarf-4" \ | |
# -DCMAKE_CXX_FLAGS_DEBUG="--gdwarf-4" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment