lballabio / QuantLib

The QuantLib C++ library
http://quantlib.org
Other
5.39k stars 1.79k forks source link

3 changes to installation instructions for OSX #255

Closed mdnahas closed 7 years ago

mdnahas commented 7 years ago

I ran into a few issues installing QuantLib 1.9.2 and SWIG-Python 1.9 on OSX 10.10.5, Python 2.7.10

I spent about 6 hours trying to use Homebrew's version of QuantLib and then compile SWIG-Python. QuantLib's BermudaSwaption test worked, but "make -C Python check" failed. At first it was unable to load _QuantLib, then, when I did load it, the linker couldn't find a name. I'm sorry that I didn't record all the output for y'all.

I decided to compile QuantLib from source and then compile SWIG-Python. I got that to work, but it required a few fixes:

  1. When compiling the BermudaSwaption test, it didn't work until I include the options "-stdlib=libstdc++ -mmacosx-version-min=10.6"
  2. When running the BermudaSwaption program, I had to set DYLD_LIBRARY_PATH to /opt/local/lib
  3. When running "./configure" for SWIG Python, I had to include this as part of CXXFLAGS: -I/opt/local/include -L/opt/local/lib"

Mike Nahas

lballabio commented 7 years ago

I updated the installation instructions this morning. May you check if they still miss the info? The pages are http://quantlib.org/install/macosx.shtml and http://quantlib.org/install/macosx-python.shtml for QuantLib and QuantLib-Python, respectively.

mdnahas commented 7 years ago

The install instructions still need all 3 of the changes I listed.

(BTW, I do like the clearer layout of the Python-SWIG install instructions!)

lballabio commented 7 years ago

Ok, thanks. Just curious: did Homebrew install QuantLib in /opt/local by default, or did you specify the installation path? I haven't checked the quantlib package, but brew usually installs packages in /usr/local on my machine.

mdnahas commented 7 years ago

Homebrew installs boost and QuantLib in /usr/local.

When I compiled QuantLib from source, I put the output in /opt/local.  Mostly because I couldn't cleanup the Homebrew directory and I wanted to keep it separate. On Friday, May 12, 2017 10:07 AM, Luigi Ballabio notifications@github.com wrote:

I updated the installation instructions this morning. May you check if they still miss the info? The pages are http://quantlib.org/install/macosx.shtml and http://quantlib.org/install/macosx-python.shtml for QuantLib and QuantLib-Python, respectively.— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

lballabio commented 7 years ago

I've updated the instruction with your first two suggestions. About the third: may you check if that's covered by the bit about having quantlib-config in your path? In your case, adding /opt/local/bin to the path if it's not already there might fix the QuantLib-Python configuration.

mdnahas commented 7 years ago

No, the 3rd part was not fixed by having quantlib-config in my path.

It might have worked for others because of the instructions in the Boost appendix to set export CPLUS_INCLUDE_PATH=/usr/local/include export C_INCLUDE_PATH=/usr/local/include export DYLD_LIBRARY_PATH=/usr/local/lib But my location for QuantLib was separate from Boost.

lballabio commented 7 years ago

I see. Just to check, what do you get if you run the following?

quantlib-config --cflags --libs

In theory, it should also include the location of your QuantLib installation.

mdnahas commented 7 years ago

Sorry, you're right. I had Homebrew's quantlib-config in my path. It was giving the wrong values for cflags and libs. The version of quantlib-config that I compiled myself gave the correct values.

lballabio commented 7 years ago

Ok then, thanks.

Oh, did I close this already? I must have pushed the wrong button. Good thing it turned out ok...