简体   繁体   中英

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. 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:

  ./contrib/download_prerequisites

-After this, I send this my gcc source file to my system using powerPC y Linux.

  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.

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! You need the gcc & libc-dev & g++ & libstdc++-dev for your host machine (the one running your future cross-compiler). I am not sure your --prefix=/usr is a good idea. Consider perhaps a --program-suffix=-mine option (otherwise, your system's /usr/bin/gcc could be overwritten, which you don't want to happen)

You could leave the default --prefix=/usr/local and later add appropriately /usr/local/bin/ into your PATH

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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