首页 > 解决方案 > 为 mingw-w64 构建跨 GCC

问题描述

在我之前遇到的麻烦中,构建 GCC,我遇到了一个让我尴尬的问题。

首先,仅供参考,我正在从 freebsd 12.2 工作站为 mingw32 构建 GCC。

../gcc/configure --target=x86_64-w64-mingw32 --prefix=/usr/local/mingw-gcc/ --with-sysroot=/usr/local/mingw/ --enable-languages=c,c++ --enable-fully-dynamic-string --enable-checking=release --enable-version-specific-runtime-libs --enable-plugins --disable-shared --disable-multilib --disable-nls --disable-werror --disable-win32-registry --disable-sjlj-exceptions --disable-libstdcxx-verbose CFLAGS=-I/usr/local/include -L/usr/local/lib CPPFLAGS=-I/usr/local/include AR_FOR_TARGET=/usr/local/mingw/bin/x86_64-w64-mingw32-ar AS_FOR_TARGET=/usr/local/mingw/bin/x86_64-w64-mingw32-as DLLTOOL_FOR_TARGET=/usr/local/mingw/bin/x86_64-w64-mingw32-dlltool LD_FOR_TARGET=/usr/local/mingw/bin/x86_64-w64-mingw32-ld NM_FOR_TARGET=/usr/local/mingw/bin/x86_64-w64-mingw32-nm OBJCOPY_FOR_TARGET=/usr/local/mingw/bin/x86_64-w64-mingw32-objcopy OBJDUMP_FOR_TARGET=/usr/local/mingw/bin/x86_64-w64-mingw32-objdump RANLIB_FOR_TARGET=/usr/local/mingw/bin/x86_64-w64-mingw32-ranlib STRIP_FOR_TARGET=/usr/local/mingw/bin/x86_64-w64-mingw32-strip WINDRES_FOR_TARGET=/usr/local/mingw/bin/x86_64-w64-mingw32-windres CPP=/usr/local/bin/cpp10

然后xgcc成功构建并用于构建libgcc。在配置过程中,调用 AC_PROG_CPP 但在此步骤:

configure:4049: checking how to run the C preprocessor
configure:4080: /home/didier/build-gcc-64/./gcc/xgcc -B/home/didier/build-gcc-64/./gcc/ -L/usr/local/mingw-gcc/x86_64-w64-mingw32/lib -L/usr/local/mingw-gcc/mingw/lib -isystem /usr/local/mingw-gcc/x86_64-w64-mingw32/include -isystem /usr/local/mingw-gcc/mingw/include -B/usr/local/mingw-gcc/x86_64-w64-mingw32/bin/ -B/usr/local/mingw-gcc/x86_64-w64-mingw32/lib/ -isystem /usr/local/mingw-gcc/x86_64-w64-mingw32/include -isystem /usr/local/mingw-gcc/x86_64-w64-mingw32/sys-include    -E  conftest.c
In file included from /home/didier/build-gcc-64/./gcc/include-fixed/syslimits.h:7,
                 from /home/didier/build-gcc-64/./gcc/include-fixed/limits.h:34,
                 from conftest.c:10:
/home/didier/build-gcc-64/./gcc/include-fixed/limits.h:203:15: fatal error: limits.h: No such file or directory
  203 | #include_next <limits.h>                /* recurse down to the real one */
      |               ^~~~~~~~~~
compilation terminated.
configure:4080: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU C Runtime Library"
| #define PACKAGE_TARNAME "libgcc"
| #define PACKAGE_VERSION "1.0"
| #define PACKAGE_STRING "GNU C Runtime Library 1.0"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL "http://www.gnu.org/software/libgcc/"
| /* end confdefs.h.  */
| #ifdef __STDC__
| # include <limits.h>
| #else
| # include <assert.h>
| #endif

这意味着我需要两个 limits.h 在包含路径中的不同位置。但是在源代码中只有一个可用。

非常感谢您的贡献。

干杯迪迪埃

标签: gccmingw-w64building

解决方案


推荐阅读