You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
j:/msys2/src/mingw32-native/bin/../lib/gcc/i686-w64-mingw32/11.1.0/../../../../i686-w64-mingw32/bin/ld.exe: error: j:/msys2/src/mingw32-native/bin/../lib/gcc/i686-w64-mingw32/11.1.0/../../../../i686-w64-mingw32/lib/../lib/crt2.o: lseek: Bad file descriptor
tried every bootstrap method known to man and then a few not so known, same error :/.
funny thing though i can actually build an ucrt based ada compiler using one of those methods but it is unable to bootstrap itself.
heres the build script ->
#!/usr/bin/env bash
# bootstrap using the old msvcrt compiler
export CPPFLAGS="-D__USE_MINGW_ANSI_STDIO=1"
export CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe"
export CXXFLAGS="-march=x86-64 -mtune=generic -O2 -pipe"
export LDFLAGS="-pipe"
export PATH="/mingw64/bin:$PATH"
# create a bootstrap directory
mkdir -p /src/gcc-bootstrap64
cd /src/gcc-bootstrap64
# Building the new gcc and its sysroot using the existing msys2/mingw64
export TOOLCHAIN_PREFIX=/src/mingw64-native
export TARGET_TRIPLET=x86_64-w64-mingw32
export DEPENDS_PREFIX=/src/gcc-depends64
# Build libraries that GCC needs. These can also potentially be found
# from the msys2/mingw64 installation, and that should probably also
# work just as well. If omitted, leave out the --with-gmp=$DEPENDS_PREFIX
# from the gcc configure command.
wget http://ftp.funet.fi/pub/gnu/gnu/gmp/gmp-6.1.2.tar.bz2
tar -jxvf gmp-6.1.2.tar.bz2
cd gmp-6.1.2
./configure --prefix=$DEPENDS_PREFIX --disable-shared
make -j$(nproc)
make install
cd ..
wget http://ftp.funet.fi/pub/gnu/gnu/mpfr/mpfr-4.0.2.tar.bz2
tar -jxvf mpfr-4.0.2.tar.bz2
cd mpfr-4.0.2
./configure --prefix=$DEPENDS_PREFIX --with-gmp=$DEPENDS_PREFIX --disable-shared
make -j$(nproc)
make install
cd ..
wget http://www.multiprecision.org/downloads/mpc-1.1.0.tar.gz
tar -zxvf mpc-1.1.0.tar.gz
cd mpc-1.1.0
./configure --prefix=$DEPENDS_PREFIX --with-gmp=$DEPENDS_PREFIX --disable-shared
make -j$(nproc)
make install
cd ..
wget http://ftp.funet.fi/pub/gnu/gnu/binutils/binutils-2.32.tar.bz2
tar -jxvf binutils-2.32.tar.bz2
cd binutils-2.32
mkdir build64
cd build64
../configure --prefix=$TOOLCHAIN_PREFIX --disable-werror --disable-multilib
make -j$(nproc)
make install-strip
cd ../..
# Clone mingw-w64; using a recent known-good version from the master branch.
# The v6.x branch should also probably be good for ucrt, but the master branch
# is certainly good at least.
git clone git://git.code.sf.net/p/mingw-w64/mingw-w64
cd mingw-w64
git checkout 1db0f476fbfdbb54dc089284fc278957c73cdd05
cd mingw-w64-headers
mkdir build64
cd build64
../configure --prefix=$TOOLCHAIN_PREFIX/$TARGET_TRIPLET --with-default-msvcrt=ucrt
make install
cd ../../..
# Build GCC; build the compiler itself and all tools, using the existing
# msys2/mingw64 compiler, having that compiler itself link against the
# CRT that it defaults to. This compiler will be set up that the code
# it produces uses UCRT though.
# Build the same version of gcc as in the surrounding host environment.
# This seems to be necessary for building the Ada tools this particular
# way (a single-stage, non-bootstrap build), as the Ada tools are built
# with the existing host Ada compiler, and the GCC Ada sources are picky
# about being built with the exact right version of the compiler.
wget http://ftp.funet.fi/pub/gnu/gnu/gcc/gcc-11.1.0/gcc-11.1.0.tar.xz
tar -Jxvf gcc-11.1.0.tar.xz
cd gcc-11.1.0
mkdir build64
cd build64
../configure --prefix=$TOOLCHAIN_PREFIX --enable-languages=c,c++,ada --disable-multilib --with-gmp=$DEPENDS_PREFIX --with-native-system-header-dir=$TOOLCHAIN_PREFIX/$TARGET_TRIPLET/include --disable-bootstrap CXXFLAGS="-O2"
make -j$(nproc) all-gcc
make install-strip-gcc
cd ../..
# Copy a few runtime dlls that the compiler ended up requiring.
cp /mingw64/bin/libiconv-2.dll $TOOLCHAIN_PREFIX/bin
cp /mingw64/bin/libwinpthread-1.dll $TOOLCHAIN_PREFIX/bin
cp /mingw64/bin/libgmp-10.dll $TOOLCHAIN_PREFIX/bin
# Now build the CRT runtimes using the newly built C/C++ compiler.
# Add the new toolchain/compiler to the PATH.
export PATH="$TOOLCHAIN_PREFIX/bin:$PATH"
cd mingw-w64/mingw-w64-crt
mkdir build64
cd build64
../configure --prefix=$TOOLCHAIN_PREFIX/$TARGET_TRIPLET --disable-lib32 --enable-lib64 --with-default-msvcrt=ucrt
make -j$(nproc)
make install
cd ../../..
# Build the libgcc/libstdc++ runtimes, with the new toolchain and its
# new sysroot (defaulting to UCRT).
cd gcc-11.1.0/build64
make -j$(nproc) all-target
make install-target
# Build the rest of the gnat frontend tools using the old host ada compiler:
export PATH="/mingw64/bin:$PATH"
make configure-gnattools
cd gnattools
make -j$(nproc) gnattools-cross
cd ..
make install-strip-gcc
cd ../..
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
j:/msys2/src/mingw32-native/bin/../lib/gcc/i686-w64-mingw32/11.1.0/../../../../i686-w64-mingw32/bin/ld.exe: error: j:/msys2/src/mingw32-native/bin/../lib/gcc/i686-w64-mingw32/11.1.0/../../../../i686-w64-mingw32/lib/../lib/crt2.o: lseek: Bad file descriptor
tried every bootstrap method known to man and then a few not so known, same error :/.
funny thing though i can actually build an ucrt based ada compiler using one of those methods but it is unable to bootstrap itself.
heres the build script ->
Beta Was this translation helpful? Give feedback.
All reactions