Ask Your Question
1

[Solved] run-time link issue in IPython Notebook

asked 2014-02-02 19:45:11 +0100

phn gravatar image

updated 2014-02-03 09:25:09 +0100

I'm trying to run QuantLib + cython wrappers (pyql) in a IPython notebook. From the console, I can:

  • build QuantLib and run the test suite
  • build pyql and run the test suite (path to QuantLib.so set with -rpath arguments in g++)
  • use ldd to verify that the run-time links are resolved
  • invoke ipython (from the console) and run tests, works fine. The key point being run-time link to the QuantLib.so library.

Now I open an IPython notebook, cd to the proper directory, try to import a module, get an import error (libQuantLib.so.0 not found). Same problem if I use a notebook without sage enhancements.

Is the ipython interpreter used in a notebook somehow different from the one invoked in a console? More generally, what is the canonical way to register a dynamic library for use in a notebook, given that "ldconfig -n <path>" is not an option?

edit retag flag offensive close merge delete

Comments

You should be able to answer your own question - can you put that there so other people looking for this answer can find it more easily? Thanks!

kcrisman gravatar imagekcrisman ( 2014-02-03 10:47:40 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2014-02-03 12:23:47 +0100

phn gravatar image

updated 2014-02-03 12:25:26 +0100

Solution: I use the rpath link option to store the entire path to the .so library. The relevant part of the setup.py file is as follows:

import os
from os.path import expanduser

HOME = expanduser('~')
QL_LIBS = os.join(HOME, "directory of my .so library")

then create link arguments:

extra_link_args = ['-Wl,-rpath,'+QL_LIBS]

check the result with ldd: you will find that the entire path to the .so library has been stored.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2014-02-02 19:45:11 +0100

Seen: 361 times

Last updated: Feb 03 '14