我尝试在 Ubuntu 11.10 上使用 make
命令,但出现错误。
g++ -g -O2 -fPIC -fPIC -Wall -Wpointer-arith -Wendif-labels -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -fpic -Wno-deprecated -Wno-unused-function -I/usr/local/include -I/home/jochen/RDKit/Code -DRDKITVER='"004000"' -I/usr/local/include -I/home/jochen/RDKit/Code -DRDKITVER='"004000"' -I. -I. -I/usr/include/postgresql/9.1/server -I/usr/include/postgresql/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include/tcl8.5 -c -o adapter.o adapter.cpp
cc1plus: nicht implementiert: -fexcess-precision=standard for C++ make: * [adapter.o] Fehler 1
我已经安装了 GCC、G++ 和构建必需品。
gcc -v 的输出:
Es werden eingebaute Spezifikationen verwendet. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.6.1/lto-wrapper Ziel: i686-linux-gnu Konfiguriert mit: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.1-9ubuntu3' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++,go --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu Thread-Modell: posix gcc-Version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3)
如何解决这个问题?
最佳答案
gcc 实现了 -fexcess- precision
选项,但仅适用于 C。
可以找到该选项的文档 here (搜索 -fexcess- precision
)(这是 gcc 4.6.3 手册):
-fexcess-precision=
styleThis option allows further control over excess precision on machines where floating-point registers have more precision than the IEEE
float
anddouble
types and the processor does not support operations rounding to those types.[SNIP]
-fexcess-precision=standard
is not implemented for languages other than C, and has no effect if-funsafe-math-optimizations
or-ffast-math
is specified. On the x86, it also has no effect if-mfpmath=sse
or-mfpmath=sse+387
is specified; in the former case, IEEE semantics apply without excess precision, and in the latter, rounding is unpredictable.
您告诉我们 (a) 您正在编译 C++,(b) 您的脚本或 Makefile
使用 -fexcess- precision
,以及 (c) 您无法改变它。其中之一必须给予。您的脚本或 Makefile
中有错误,您需要修复它。
请注意,gcc 可能应该为 C++ 实现-fexcess- precision=standard
;据我所知,C++ 在这方面的规则与 C 的规则相同,并且 C 需要这种行为以符合标准。您的代码可能依赖于 -fexcess- precision=standard
指定的行为,而 gcc 不支持它。如果是这样的话,你就有问题了;解决这个问题的唯一方法可能是对 C++ 源代码进行重大修改。或者它可能为 C++ 实现了正确的行为;手册在这一点上并不是 100% 清楚。
还有另一种可能的解决方法。您可以为 g++
命令编写自己的包装器,该包装器在从命令行中删除所有出现的 -fexcess- precision
后调用真正的 g++
命令论据。我已经完成了something similar过去,情况略有不同;你必须破解它才能修改命令行参数而不是过滤stderr
。但我不推荐这样做。正确的解决方案是修复构建脚本或 Makefile - 再次假设程序不依赖于 -fexcess- precision=standard 指定的行为。
关于Ubuntu 与 cc1plus - 错误未实现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9673219/