【问题标题】:gcc compiler not recognizing -fno-plt optiongcc 编译器无法识别 -fno-plt 选项
【发布时间】:2017-09-30 16:21:18
【问题描述】:

我正在尝试使用 Amazon Linux AMI 在 Amazon 的 EC2 实例上编译 QuantLib Python SWIG 绑定。我已经成功地编译了 QuantLib 本身,但是,在尝试编译 anaconda python swig 绑定时,我收到了 -fno-plt 选项错误。我已经将gcc编译器版本升级到5.4.0,原来是4.8

首先我配置如下:

sudo ./configure --disable-perl --disable-ruby --disable-mzscheme --disable-guile --disable-csharp --disable-ocaml --disable-r --disable-java  PYTHON=/opt/anaconda/anaconda2/bin/python

然后我做如下:

make -C Python

我得到了错误:

make: Entering directory `/home/ec2-user/downloads/QuantLib-SWIG-1.8/Python'
make  all-am

make[1]: Entering directory `/home/ec2-user/downloads/QuantLib-SWIG-1.8/Python'
CXXFLAGS="-O3 -fno-strict-aliasing -Wno-unused -Wno-uninitialized -Wno-sign-compare -Wno-write-strings" CC="gcc" CXX="g++" /opt/anaconda/anaconda2/bin/python setup.py build

running build

running build_py

running build_ext

building 'QuantLib._QuantLib' extension

gcc -fno-strict-aliasing -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O3 -pipe -DNDEBUG -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/opt/anaconda/anaconda2/include/python2.7 -I/usr/local/include -c QuantLib/quantlib_wrap.cpp -o build/temp.linux-x86_64-2.7/QuantLib/quantlib_wrap.o -Wno-unused -O3 -fno-strict-aliasing -Wno-unused -Wno-uninitialized -Wno-sign-compare -Wno-write-strings

gcc: error: unrecognized command line option ‘-fno-plt’

error: command 'gcc' failed with exit status 1

make[1]: *** [.build-stamp] Error 1

make[1]: Leaving directory `/home/ec2-user/downloads/QuantLib-SWIG-1.8/Python'

make: *** [all] Error 2

make: Leaving directory `/home/ec2-user/downloads/QuantLib-SWIG-1.8/Python'

我对此很陌生,不知道是否可以在编译时删除 -fno-plt 选项,如果可以,如何?

【问题讨论】:

  • 似乎从 GCC 6 开始支持 -fno-plt(如果我没记错的话)
  • 谢谢。有什么方法可以确认这一点吗?升级 gcc 需要一段时间,我只是想确保升级到正确的版本。
  • 使用编译器资源管理器 - godbolt.org:使用 -fno-plt 选项编译任何程序 - 如果编译成功,则支持该标志。我已经验证 GCC 5.3.1 确实不支持它,而 GCC 6.2.1 支持它。

标签: python gcc quantlib


【解决方案1】:

您需要升级您的 GCC 版本。

changelog page for GCC 6 说:

选项 -fno-plt 现在功能齐全。

因此,您可以从GCC 6 使用它。

【讨论】:

  • 升级到 gcc 6.1 解决了我的问题。谢谢。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-06-28
  • 2012-03-23
  • 2012-09-17
  • 1970-01-01
  • 2014-05-11
  • 1970-01-01
相关资源
最近更新 更多