我正在使用GCC4.7.0开发Mac OSX Lion,我的目标是编译win32交叉编译器。
GMP和MPFR,使用Macports安装(GCC47)。
使用的文件:
Win32 api和mingw运行时库,安装在此处: / opt / mingw
像这样编译binutils似乎工作正常:
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 here !
这是我第一次编译交叉编译器,这是一项非常复杂的任务,所以我希望有人可以帮助我。
编辑:
似乎缺少一些常见的c头文件,但我不确定如何解决这个问题。