Ask Your Question
1

[Solved] run-time link issue in IPython Notebook

asked 11 years ago

phn gravatar image

updated 11 years ago

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?

Preview: (hide)

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 ( 11 years ago )

1 Answer

Sort by » oldest newest most voted
2

answered 11 years ago

phn gravatar image

updated 11 years ago

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.

Preview: (hide)
link

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: 11 years ago

Seen: 376 times

Last updated: Feb 03 '14