我正嘗試使用Amazon Linux AMI編譯Amazon EC2實例上的QuantLib Python SWIG綁定。我設法成功編譯QuantLib,但是,在嘗試編譯anaconda python swig綁定時,我遇到了-fno-plt選項的錯誤。我已經升級了gcc編譯器版本5.4.0,本來是4.8gcc編譯器無法識別-fno-plt選項
首先我配置如下:
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選項,如果是的話,怎麼樣?
似乎'-fno-plt'支持啓動GCC 6(如果我沒有弄錯) – valiano
謝謝。有什麼方法可以證實這一點?升級gcc需要一段時間,我只是想確保我升級到正確的版本。 – user5294101
使用編譯器資源管理器 - https://godbolt.org:用'-fno-plt'選項編譯任何程序 - 如果編譯成功,該標誌被支持。我已經證實,它確實不支持GCC 5.3.1,並且支持GCC 6.2.1。 – valiano