简体   繁体   English

从源代码编译gcc时如何解决“cstring:没有这样的文件或目录”?

[英]How to solve “cstring: No such file or directory” when compiling gcc from source?

I am trying to compile a gcc from source since I cannot use yum, apt-get and so forth. 我试图从源代码编译gcc因为我不能使用yum,apt-get等等。 My steps are simple: 我的步骤很简单:

-I download the source GCC (I tried gcc-4.8.4 and gcc-5.3.0) in my pc and I used: - 我在我的电脑上下载源GCC(我试过gcc-4.8.4和gcc-5.3.0)我用过:

  ./contrib/download_prerequisites

-After this, I send this my gcc source file to my system using powerPC y Linux. - 之后,我使用powerPC和Linux将我的gcc源文件发送到我的系统。

  mkdir objdir
  cd objdir 
  ../gcc-4.6.2/configure --prefix=/usr --enable-languages=c,c++,fortran,go
  make

I have got the next error: 我有下一个错误:

   In file included from ../../gcc-4.9.2/gcc/genmddeps.c:19:0:
   ../../gcc-4.9.2/gcc/system.h:205:20: fatal error: cstring: No such file or directory
   # include <cstring>
                ^
   compilation terminated.
   make[3]: *** [build/genmddeps.o] Error 1
   make[3]: Leaving directory `/home/root/build/gcc'
   make[2]: *** [all-stage1-gcc] Error 2
   make[2]: Leaving directory `/home/root/build'
   make[1]: *** [stage1-bubble] Error 2
   make[1]: Leaving directory `/home/root/build'
   make: *** [all] Error 2

Any idea about what it is going wrong? 关于它出了什么问题的任何想法?

Best regards 最好的祝福

Some advice: first, compile (notably for learning purposes) something simpler than GCC, eg GNU make if you never compiled GNU stuff from source code. 一些建议:首先,编译(特别是出于学习目的)比GCC 简单的东西,例如GNU make,如果你从未从源代码编译GNU的东西。

Then compile a recent GCC (so 5.3 in january 2016) - building issues would be the same with 4.8, and GCC 5 is better! 然后编译一个最近的 GCC(2016年1月5.3) - 建筑问题与4.8相同,而GCC 5更好! You need the gcc & libc-dev & g++ & libstdc++-dev for your host machine (the one running your future cross-compiler). 您需要gcclibc-devg++libstdc++-dev用于您的主机 (运行您未来的交叉编译器)。 I am not sure your --prefix=/usr is a good idea. 我不确定你的--prefix=/usr是个好主意。 Consider perhaps a --program-suffix=-mine option (otherwise, your system's /usr/bin/gcc could be overwritten, which you don't want to happen) 考虑一下--program-suffix=-mine选项(否则,您的系统的/usr/bin/gcc可能会被覆盖,您不希望发生这种情况)

You could leave the default --prefix=/usr/local and later add appropriately /usr/local/bin/ into your PATH 你可以保留默认的--prefix=/usr/local ,然后在你的PATH适当添加/usr/local/bin/

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

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