2

I am trying to compile QuantLib Python SWIG bindings on Amazon's EC2 instance with Amazon Linux AMI. I have managed to compile QuantLib itself successfully, however, when trying to compile anaconda python swig bindings, I am getting an error with -fno-plt option. I have upgraded the gcc compiler version to 5.4.0, originally it was 4.8

First I configure as below:

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

Then I make as below:

make -C Python

I get the error :

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'

I am very new to this and do not know if I can remove -fno-plt option when compiling and if yes, how?

3
  • 1
    It seems -fno-plt is supported starting GCC 6 (if I'm not mistaken)
    – valiano
    Sep 30, 2017 at 16:32
  • Thanks. Is there any way to confirm this? Upgrading gcc takes a while and I just want to make sure I am upgrading to the right version.
    – suhasghorp
    Sep 30, 2017 at 16:44
  • Using Compiler Explorer - godbolt.org: compile any program with the -fno-plt option - if compilation succeeds, the flag is supported. I've verified that it is indeed not supported with GCC 5.3.1, and is supported with GCC 6.2.1.
    – valiano
    Sep 30, 2017 at 19:53

1 Answer 1

7

You need to upgrade your GCC version.

The changelog page for GCC 6 says:

The option -fno-plt is now fully functional.

Thus, from GCC 6 you can use it.

1
  • Upgrading to gcc 6.1 fixed my issue. Thanks.
    – suhasghorp
    Oct 1, 2017 at 20:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.