I am trying to get QuantLib version 1.13 running on Amazon Linux.

I found some .rpm files at https://pkgs.org/download/QuantLib, although there is an up to date .rpm for Fedora, there isn't one for CentOS (the CentOS files seem to be compatible with Amazon Linux).

I was able to successfully build the library from source, however when I do so it creates a 1.2GB libQuantLib.a file and a 421MB libQuantLib.so.0.0.0 file.

The .rpm files at https://pkgs.org/download/QuantLib are all ~25MB.

Ultimately I am trying to pack QuantLib well enough that I can run it in an AWS Lambda environment. This would require the compressed binaries to be ~50MB and be compatible with the Amazon Linux AMI for Lambda.

My question:

  • Why is there such a discrepancy between the size of the .rpm file and the libQuantLib.a / libQuantLib.so.0.0.0 files that result when I build from source? Is the .rpm file not a full version of the library? Does the result of my build contain a lot of fluff?

  • Is it possible to build from source and achieve the ~25MB size or is this effort fruitless?


Most likely your hand-built libraries are built with debugging information, that's why they are so big. You can try strip libQuantLib.so.0.0.0 and see how much smaller it will get.

You can try to rebuild the official RPM for Amazon Linux 2 like this:

  1. Download the source RPM (QuantLib-1.4-7.el7.src.rpm)
  2. Install rpm-build package (or rpmbuild? not quite sure what's the name on AL2)
  3. Run rpmbuild --rebuild QuantLib-1.4-7.el7.src.rpm and if everything goes right you should have the QuantLib-...x86_64.rpm built for Amazon Linux 2 after a while.

There may be some dependency issues. If you're not familiar with building RPMs feel free to follow up here or open another question.

However this should get you started. Good luck with it :)

Update - building without QuantLib-doc package.

As per the comment below building the QuantLib-doc requires a lot of extra dependencies. To rebuild it without doc do the following:

  1. Download source RPM, e.g. to /tmp
  2. In an empty directory run rpm2cpio /tmp/QuantLib-...src.rpm
  3. Edit QuantLib.spec and comment out %package doc, %description doc and %files doc sections
  4. Build the RPM with rpmbuild -ba QuantLib.spec

That should remove the need to install the many dependencies.

  • Thank you for the detailed answer, I was able to run the rebuild command after installing the dependencies. Two of the dependencies were large Latex packages. I can't imagine they are required to run the library, is it possible they are just required to build it? – bphi Sep 23 '18 at 16:19
  • Most likely LaTeX is needed for QuantLib-doc package. If you want to build the RPM without the -doc package you'll have to modify the spec file. I'll edit the answer above with the instructions. – MLu Sep 23 '18 at 21:31
  • quick question, does a library that requires boost to compile require boost to run? – bphi Sep 23 '18 at 22:10
  • @bphi re boost - it depends how it is linked, if statically or dynamically. More often than not dynamic linking is used which in turn means it will be required in runtime, yes. – MLu Sep 23 '18 at 22:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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