Windows 编译Mingw交叉编译器时出现的问题:“/lib/cpp“;未通过健全性检查

Windows 编译Mingw交叉编译器时出现的问题:“/lib/cpp“;未通过健全性检查,windows,macos,makefile,mingw,cross-compiling,Windows,Macos,Makefile,Mingw,Cross Compiling,我正在使用GCC4.7.0开发Mac OSX Lion,我的目标是编译win32交叉编译器 GMP和MPFR,如果使用Macports(以及GCC47)安装 使用的文件: w32api-3.17-2-mingw32-dev.tar.lzma mingwrt-3.20-mingw32-dev.tar.gz binutils-2.22-1-mingw32-src.tar.lzma src-gcc-4.7.0-release.tar.7z Win32 api和mingw运行库,此处安装:/opt/

我正在使用GCC4.7.0开发Mac OSX Lion,我的目标是编译win32交叉编译器

GMP和MPFR,如果使用Macports(以及GCC47)安装

使用的文件:

  • w32api-3.17-2-mingw32-dev.tar.lzma
  • mingwrt-3.20-mingw32-dev.tar.gz
  • binutils-2.22-1-mingw32-src.tar.lzma
  • src-gcc-4.7.0-release.tar.7z
Win32 api和mingw运行库,此处安装:/opt/mingw

像这样编译binutil似乎效果不错:

 mkdir build
 cd build
 ../configure --prefix=/opt/mingw/ --target=i686-mingw32 --host=x86_64-apple-darwin \
   --build=x86_64-apple-darwin --with-libs=/opt/mingw/lib --with-headers=/opt/mingw/include \
   --with-gxx-include-dir=/opt/mingw/include/c++
 make
 sudo make install
下一步是编译gcc,但这会导致一个错误,我使用的命令是:

 mkdir build
 cd build
 ../configure --prefix=/opt/mingw/                                              \
          --with-gmp=/opt/local/ --with-mpfr=/opt/local/                        \
          --target=i686-mingw32 --host=x86_64-apple-darwin                      \
          --build=x86_64-apple-darwin --with-libs=/opt/mingw/lib                \
          --with-headers=/opt/mingw/include                                     \
          --with-gxx-include-dir=/opt/mingw/include/c++                         \
          --with-gcc --with-tune=generic --disable-werror                       \
          --disable-win32-registry --enable-sjlj-exceptions                     \
          --enable-libstdcxx-debug                                              \
          --enable-cxx-flags='-fno-function-sections -fno-data-sections'        \
          --enable-version-specific-runtime-libs                                \
          --disable-bootstrap --enable-threads --disable-nls                    \
          --enable-languages=c,c++
 make
 sudo make install
命令行错误:

//...
option to accept ISO C89... unsupported
checking how to run the C preprocessor... /lib/cpp
configure: error: in `/Users/Nik/Development/mingw-src/gcc-4.7.0/build/i686-mingw32/libgcc':
configure: error: C preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details.
make[1]: *** [configure-target-libgcc] Error 1
make: *** [all] Error 2
可以找到config.log

这是我第一次编译交叉编译器,这是一项相当复杂的任务,所以我希望有人能帮助我

编辑:


似乎有一些常见的c头文件丢失了,但我不确定如何解决这个问题。

我也有同样的问题,谷歌没有给出任何答案。看见