【问题标题】:cross compiler to linux (build and host) to freebsd交叉编译器到 linux(构建和托管)到 freebsd
【发布时间】:2015-03-14 02:57:49
【问题描述】:

我试图为 linux x86_64(构建和主机)编译一个 gcc 交叉编译器到 freebsd x86_64。 我尝试关注这个http://marcelog.github.io/articles/articles.html,然后是网络上的其他一些指南,但我继续得到这个: 代码:

...
make[3]: Leaving directory '/home/nick/Scaricati/build-gcc/x86_64-freebsd10.1/libgcc'
DEFINES='' HEADERS='' \
   ../../../gcc-4.9.2/libgcc/mkheader.sh > tmp-libgcc_tm.h
/bin/bash ../../../gcc-4.9.2/libgcc/../move-if-change tmp-libgcc_tm.h libgcc_tm.h
echo timestamp > libgcc_tm.stamp
/home/nick/Scaricati/build-gcc/./gcc/xgcc -B/home/nick/Scaricati/build-gcc/./gcc/ -B/usr/local/cross/x86_64-freebsd10.1/bin/ -B/usr/local/cross/x86_64-freebsd10.1/lib/ -isystem /usr/local/cross/x86_64-freebsd10.1/include -isystem /usr/local/cross/x86_64-freebsd10.1/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 -pthread -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -Dinhibit_libc  -fpic -pthread -I. -I. -I../.././gcc -I../../../gcc-4.9.2/libgcc -I../../../gcc-4.9.2/libgcc/. -I../../../gcc-4.9.2/libgcc/../gcc -I../../../gcc-4.9.2/libgcc/../include  -DHAVE_CC_TLS  -o _muldi3.o -MT _muldi3.o -MD -MP -MF _muldi3.dep -DL_muldi3 -c ../../../gcc-4.9.2/libgcc/libgcc2.c -fvisibility=hidden -DHIDE_EXPORTS
In file included from ../../../gcc-4.9.2/libgcc/../gcc/tsystem.h:44:0,
  from ../../../gcc-4.9.2/libgcc/libgcc2.c:27:
/home/nick/Scaricati/build-gcc/gcc/include/stddef.h:56:24: fatal error: sys/_types.h: No such file or directory
 #include <sys/_types.h>
  ^
compilation terminated.
Makefile:463: recipe for target '_muldi3.o' failed
make[2]: *** [_muldi3.o] Error 1
make[2]: Leaving directory '/home/nick/Scaricati/build-gcc/x86_64-freebsd10.1/libgcc'
Makefile:12757: recipe for target 'all-target-libgcc' failed
make[1]: *** [all-target-libgcc] Error 2
make[1]: Leaving directory '/home/nick/Scaricati/build-gcc'
Makefile:869: recipe for target 'all' failed
make: *** [all] Error 2

这是 TARGET=x86_64-freebsd10.1 的 gcc-4.9.2 源的 make 过程的最后日志

我做错了什么?有什么想法吗?

******编辑******

这是使用的配置:

configure --without-headers --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --disable-nls --enable-libssp --enable-gold --enable-ld --target=$TARGET --prefix="$PREFIX" --disable-libgomp

【问题讨论】:

  • 您使用的配置参数可能很有趣。
  • 你说得对,我刚刚编辑了帖子。
  • 邮件列表gcc-help@gcc.gnu.org 可能是一个更好的提问地点。
  • 谢谢,他们帮我解决了问题!

标签: c linux gcc cross-compiling freebsd


【解决方案1】:

解决了! 我没有正确设置 sysroot。

我必须在我的机器上下载(或从构建和工作系统中获取)目标系统(在我的情况下是 freebsd,所以我得到了 base.txz、lib32.txz 并且可以肯定(但我认为他们不需要)还有src.txz和kernel.txz,然后我可以在binutils和gcc源的配置过程中设置--with-sysroot,然后运行

$ make

# make install

对于 binutils 和 gcc,最后我得到了我的工具链!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-01-09
    • 1970-01-01
    • 2012-08-06
    • 1970-01-01
    • 1970-01-01
    • 2023-01-27
    • 1970-01-01
    • 2014-09-30
    相关资源
    最近更新 更多