c++ - cc1plus : error: unrecognized command line option "-fsysroot=<path>" with g++

标签 c++ compilation compiler-errors g++

我正在尝试在 64 位机器上的模拟 32 位环境 (cel5.03-i386-2.3) 中编译大型 C++ 项目。 (之前在32位机器上编译正常)

在此编译过程中,一些文件失败,如下所示。奇怪的是,传递给 g++ 命令的参数是 "--sysroot=",而在错误消息中它变成了 "-fsysroot="

为什么会这样?

/usr/bin/g++ -MMD -MF /proj/src/.debug/lib/osiris/core/utils/WWNConverter.d  -I/proj/src/lib/osiris -DDEBUG_LOG -DDEBUG -D_REENTRANT -DAPE_MODE  -DSWAT_MODE -g -Werror -Wall -Wno-write-strings -fPIC -m32 --sysroot=/auto/andpkg/rep_cache//wr-x86/3.0FCS/sysroot -rdynamic -I/proj/src -I/proj/src/.debug/include/private -I/proj/src/.debug/include/public -I/proj/src/lib/framework -I/proj/src/lib/osiris -I/proj/src/lib/prt -I/proj/src/lib/callhome -I/proj/src/lib/snmp  -I/proj/src/.debug/external/pcre/include -I/proj/src/external/sqlite/include -I/proj/src/external/openssl/openssl-fips-1.2.3/include -I/proj/src/support/storage-driver/include -I/proj/src/external/json/include -DTARGET_OBJECT=libosiris.so -I/proj/src/.debug/external/pcre/include -I/proj/src/.debug/external/libcurl/include -o /proj/src/.debug/lib/osiris/core/utils/WWNConverter.o -c /proj/src/lib/osiris/core/utils/WWNConverter.cc

make[1]: *** [/proj/src/.debug/lib/osiris/core/utils/WWNConverter.o] Error 1
cc1plus: error: unrecognized command line option "-fsysroot=/auto/andpkg/rep_cache//wr-x86/3.0FCS/sysroot"

最佳答案

32 位编译器 (GCC 3.4.6) 太旧,无法支持 --sysroot 选项,该选项已通过 commit 102367 添加到主干中, 直到 GCC 4.1.0 才将其纳入发布分支。

2005-07-25  Mark Mitchell  <mark@codesourcery.com>
  * gcc.c (option_map): Add --sysroot.
  (process_command): Handle --sysroot.
  (display_help): Document it.
  * doc/cppopts.tex (-isysroot): Document.
  * doc/invoke.texi (--sysroot): Document.
  * doc/install.texi (--with-build-sysroot): Document.

  * Makefile.in (inhibit_libc): New variable.
  (INHIBIT_LIBC_CFLAGS): Likewise.
  (LIBGCC2_CFLAGS): Include
  $(INHIBIT_LIBC_CFLAGS).
  (CRTSTUFF_CFLAGS): Include $(INHIBIT_LIBC_CFLAGS).
  ($(T)crtbegin.o): Do not use @inhibit_libc@.
  ($(T)crtend.o): Likewise.
  ($(T)crtbeginS.o): Do not use @inhibit_libc@.
  ($(T)crtendS.o): Likewise.
  ($(T)crtbeginT.o): Do not use @inhibit_libc@.
  ($(T)crtendT.o): Likewise.
  (stmp-fixinc): Do not complain about missing headers if
  inhibit_libc.
  * configure.ac (inhibit_libc): Set it to true/false.
  (--with-build-sysroot): New option.  Use it to set
  SYSTEM_HEADER_DIR. 
  * configure: Regenerated.

关于c++ - cc1plus : error: unrecognized command line option "-fsysroot=<path>" with g++,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26228947/

相关文章:

java - 这在Java中将如何工作?

java - 如何让 "circular"泛型在 Java 中工作?

c++ - std::out_of_range:Mergesort 算法中的 vector 异常

c++ - OpenCV:在处理后的图像中选择轮廓

c - 奇怪的链接行为 - gcc 库

node.js - node_modules/@types/node/index.d.ts(20,1): error TS1084: Invalid 'reference' directive syntax

c++ - 在 C++ 应用程序中构建/编译 libcurl 时遇到问题

c++ - VS13 C++ 贪心匹配不够贪心

c++ - 多线程:thread 或 process.h - C++

java - Javac @SuppressWarnings 注释不会删除未检查的警告