Login  Register

Re: Getting Python bindings in QuantLib-SWIG-1.4 to work in OS X?

Posted by Luigi Ballabio on Apr 03, 2014; 7:25am
URL: http://quantlib.414.s1.nabble.com/Getting-Python-bindings-in-QuantLib-SWIG-1-4-to-work-in-OS-X-tp15105p15109.html

Not sure if it applies, but there's a note in <http://quantlib.org/install/macosx.shtml> about a few compilation flags needed in Mavericks. Do they help?

Luigi



On Tue, Apr 1, 2014 at 7:58 PM, Richard Stanton <[hidden email]> wrote:
I've compiled both QuantLib-1.4 and QuantLib-SWIG-1.4 (Python bindings) on
my Mac, but get errors when I try to run the Python test code. Has anyone
got this to work? Here are the details:

- Machine is running OS X 10.9.2, Xcode 5.1, and "gcc --version" reports

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr
--with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix

   - Install Mac Ports boost 1.55.0 using "sudo port install boost"
   - Download and extract Quantlib-1.4
   - Following instructions at http://quantlib.org/install/macosx.shtml,
run

   ./configure --enable-static --with-boost-include=/opt/local/include/
--with-boost-lib=/opt/local/lib/ --prefix=/opt/local/

   make

   - Compilation completes fine. Running test suite, it tells me it's
running 567 test cases, and completes with no errors.

So far so good. Quantlib seems to be running fine. Now to install
quantlib-SWIG-1.4:

   - Download and extract
   - cd to Python subdirectory.
- After making sure the compiler/linker can find the ql header files and
libQuantLib.a, run "python setup.py build".
- Compiles and links (apparently) fine.
   - Now run "python setup.py test"

running test
running build
running build_py
running build_ext
Traceback (most recent call last):
  File "setup.py", line 239, in <module>
    'build_ext': my_build_ext
  File "/Users/stanton/anaconda/lib/python2.7/distutils/core.py", line
152, in setup
    dist.run_commands()
  File "/Users/stanton/anaconda/lib/python2.7/distutils/dist.py", line
953, in run_commands
    self.run_command(cmd)
  File "/Users/stanton/anaconda/lib/python2.7/distutils/dist.py", line
972, in run_command
    cmd_obj.run()
  File "setup.py", line 58, in run
    module = __import__('QuantLibTestSuite', globals(), locals(), [''])
  File "test/QuantLibTestSuite.py", line 22, in <module>
    from date import DateTest
  File "test/date.py", line 18, in <module>
    import QuantLib
  File "build/lib.macosx-10.5-x86_64-2.7/QuantLib/__init__.py", line 24,
in <module>
    from QuantLib import *
  File "build/lib.macosx-10.5-x86_64-2.7/QuantLib/QuantLib.py", line 28,
in <module>
    _QuantLib = swig_import_helper()
  File "build/lib.macosx-10.5-x86_64-2.7/QuantLib/QuantLib.py", line 24,
in swig_import_helper
    _mod = imp.load_module('_QuantLib', fp, pathname, description)
ImportError:
dlopen(build/lib.macosx-10.5-x86_64-2.7/QuantLib/_QuantLib.so, 2): Symbol
not found: __ZThn112_N8QuantLib19CappedFlooredCoupon6updateEv
  Referenced from: build/lib.macosx-10.5-x86_64-2.7/QuantLib/_QuantLib.so
  Expected in: dynamic lookup

Has anyone got this working on the same setup?

Thanks.

Richard Stanton


------------------------------------------------------------------------------
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users



--
<https://implementingquantlib.blogspot.com>
<https://twitter.com/lballabio>

------------------------------------------------------------------------------

_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users