使用cygwin的i686的GCC交叉编译器(Windows)-构建GCC失败

时间:2019-02-27 08:43:51

标签: linux gcc cross-compiling i386

我正在尝试从Windows PC(cygwin)交叉编译用于Linux的gcc-i686-elf平台。按照工具链步骤,我已经成功编译:

  1. binutils使用

    http://prntscr.com/mqpx9h http://prntscr.com/mqpz85 http://prntscr.com/mqpzqm

  2. 使用

    的基本gcc第一步

    /binutils-x.y.z/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror

  3. 使用

    的Linux标头

    gcc-x.y.z/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers

  4. glibc使用

    make headers_install ARCH=i386 CROSS_COMPILE=i386-linux- INDTALL_HDR_PATH=my/path/ 然后CC=${TARGET}-gcc ../glibc-2.29/configure --target=$TARGET --host=i686-pc-linux-gnu --prefix=$PREFIX --with-headers=my/path/

  5. 现在,使用make install-headers

  6. 构建Gcc的第二部分

我收到以下错误:

../gcc-7.4.0/configure --target=$TARGET --prefix=$PREFIX --with-sysroot=$HOME/opt/cross --disable-libssp --disable-libgomp --disable-libmudflap --enable-languages=c,c++ --disable-multilib

我曾尝试make[2]: Entering directory '/home/MyPcUserName/src/build-gcc/i686-elf/libgcc - If this is the top-level multilib, build all the other multilibs. ln -s ../../../gcc-7.4.0/libgcc/enable-execute-stack-empty.c enable-execute-stack.c ln -s ../../../gcc-7.4.0/libgcc/unwind-generic.h unwind.h ln -s ../../../gcc-7.4.0/libgcc/config/no-unwind.h md-unwind-support.h ln -s ../../../gcc-7.4.0/libgcc/config/i386/sfp-machine.h sfp-machine.h ln -s ../../../gcc-7.4.0/libgcc/gthr-single.h gthr-default.h DEFINES='' HEADERS='' \ ../../../gcc-7.4.0/libgcc/mkheader.sh > tmp-libgcc_tm.h /bin/sh ../../../gcc-7.4.0/libgcc/../move-if-change tmp-libgcc_tm.h libgcc_tm.h echo timestamp > libgcc_tm.stamp /home/MyPcUserName/src/build-gcc/./gcc/xgcc -B/home/MyPcUserName/src/build-gcc/./gcc/ -B/home/MyPcUserName/opt/cross/i686-elf/bin/ -B/home/MyPcUserName/opt/cross/i686-elf/lib/ -isystem /home/MyPcUserName/opt/cross/i686-elf/include -isystem /home/MyPcUserName/opt/cross/i686-elf/sys-include -g -O2 -O2 -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fpic -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -fpic -I. -I. -I../.././gcc -I../../../gcc-7.4.0/libgcc -I../../../gcc-7.4.0/libgcc/. -I../../../gcc-7.4.0/libgcc/../gcc -I../../../gcc-7.4.0/libgcc/../include -DHAVE_CC_TLS -o _muldi3.o -MT _muldi3.o -MD -MP -MF _muldi3.dep -DL_muldi3 -c ../../../gcc-7.4.0/libgcc/libgcc2.c -fvisibility=hidden -DHIDE_EXPORTS In file included from /home/MyPcUserName/opt/cross/usr/include/bits/libc-header-start.h:33:0, from /home/MyPcUserName/opt/cross/usr/include/stdio.h:27, from ../../../gcc-7.4.0/libgcc/../gcc/tsystem.h:87, from ../../../gcc-7.4.0/libgcc/libgcc2.c:27: /home/MyPcUserName/opt/cross/usr/include/features.h:474:10: fatal error: gnu/stubs.h: No such file or directory #include <gnu/stubs.h> ^~~~~~~~~~~~~ compilation terminated. make[2]: *** [Makefile:491: _muldi3.o] Error 1 make[2]: Leaving directory '/home/MyPcUserName/src/build-gcc/i686-elf/libgcc' make[1]: *** [Makefile:11875: all-target-libgcc] Error 2 make[1]: Leaving directory '/home/MyPcUserName/src/build-gcc' make: *** [Makefile:893: all] Error 2 禁用多路复用,以便在64位PC上忽略此gnu问题。 我试图再次重建所有这些,但仍然面临着这个问题。 请让我知道是否有人可以提供帮助。非常感谢您的宝贵时间

1 个答案:

答案 0 :(得分:0)

构建glibc之后,我们不应该直接开始构建GCC的第二部分。相反,glibc应当采取的其他步骤如下:

$ CC=${TARGET}-gcc ../glibc-2.29/configure --target=$TARGET --host=i686-pc-linux-gnu --prefix=$PREFIX --with-headers=my/path/
$ make install-bootstrap-headers=yes install-headers
$ make -j4 csu/subdir_lib
$ install csu/crt1.o csu/crti.o csu/crtn.o /opt/cross/$TARGET/lib
$ $TARGET-gcc -nostdlib -nostartfiles -shared -x c /dev/null -o /opt/cross/$TARGET/lib/libc.so
$ touch /opt/cross/$TARGET/include/gnu/stubs.h

然后,我们可以开始构建GCC的第二部分。