简体   繁体   English

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

[英]GCC cross compiler for i686 using cygwin (windows) - fail in building GCC

I am trying to cross compile the gcc for linux - i686-elf platform from windows PC (cygwin). 我正在尝试从Windows PC(cygwin)交叉编译适用于linux的gcc-i686-elf平台。 As per the toolchain steps, I have successfully compiled: 按照工具链步骤,我已成功编译:

  1. binutils using binutils使用

    /binutils-xyz/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror

  2. basic gcc 1st step using 基本的gcc第一步使用

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

  3. linux headers using linux标头使用

    make headers_install ARCH=i386 CROSS_COMPILE=i386-linux- INDTALL_HDR_PATH=my/path/

  4. glibc using glibc使用

    CC=${TARGET}-gcc ../glibc-2.29/configure --target=$TARGET --host=i686-pc-linux-gnu --prefix=$PREFIX --with-headers=my/path/ and then, make install-headers CC=${TARGET}-gcc ../glibc-2.29/configure --target=$TARGET --host=i686-pc-linux-gnu --prefix=$PREFIX --with-headers=my/path/和然后, make install-headers

  5. Now, while building 2nd part og GCC using: ../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 现在,使用以下../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构建第二部分og 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 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

I am getting the follwing errors: 我收到以下错误:

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

I have tried --disable-multilib to disable the mulilib so as to ignore this gnu issue on 64-bit PC. 我试过--disable-multilib禁用mulilib,以便在64位PC上忽略此gnu问题。 I tried to rebuilt all of it again, but still I am facing this issue. 我试图再次重建所有这些,但仍然面临着这个问题。 Please let me know if anyone can help. 请让我知道是否有人可以提供帮助。 Thanks a lot for your time 非常感谢您的时间

After building the glibc , we shouldn't directly start building 2nd part of GCC. 构建glibc ,我们不应该直接开始构建GCC的第二部分。 Rather, few more steps should be followed for glibc as indicated below: 相反,对于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

Then, we can start building the 2nd part of GCC. 然后,我们可以开始构建GCC的第二部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM