Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined symbol when importing module compiled with weave #4947

Closed
Tracked by #7
lcharlin opened this issue Jun 9, 2015 · 2 comments
Closed
Tracked by #7

undefined symbol when importing module compiled with weave #4947

lcharlin opened this issue Jun 9, 2015 · 2 comments

Comments

@lcharlin
Copy link

lcharlin commented Jun 9, 2015

I've been using scipy's weave to speed up some numerically-intensive routines. I have a problem importing an extension created through weave.

Specifically, while weave successfully imports (and runs) the module it has compiled I cannot import the module outside of weave. Importing from a python prompt results in "undefined symbol" error. The exact error message is pasted below.

I can fix the error by passing an extra library to the linker at compile time (in this case gslcblas as the libraries arguments to weave.inline() ). However I wonder how weave is able to import the module without problems? I think this is related to a bigger performance issue I care about.

The python version I use in both cases is the same (the environment, as far as I can tell, is also exactly the same).

Thanks!

Importing the module from a Python prompt fails:
$ python2.7

import sc_e6d71e9b4074eed34d1cb1112482ee6212
Traceback (most recent call last):
File "", line 1, in
ImportError: /usr/lib64/libgsl.so.0: undefined symbol: cblas_ctrmv

Compilation log:
<weave: compiling>
running build_ext
running build_src
build_src
building extension "sc_e6d71e9b4074eed34d1cb1112482ee6213" sources
build_src: building npy-pkg config files
customize UnixCCompiler
customize UnixCCompiler using build_ext
customize UnixCCompiler
customize UnixCCompiler using build_ext
building 'sc_e6d71e9b4074eed34d1cb1112482ee6213' extension
compiling C++ sources
C compiler: g++ -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC

compile options: '-I/usr/local/python/2.7/scipy-mkl/0.14.0/lib64/python2.7/site-packages/scipy/weave -I/usr/local/python/2.7/scipy-mkl/0.14.0/lib64/python2.7/site-packages/scipy/weave/scxx -I/usr/local/python/2.7/numpy-mkl/1.8.1/lib64/python2.7/site-packages/numpy/core/include -I/usr/include/python2.7 -c'
extra options: '-march=native -fopenmp -O3 -lpthread'
g++: .cache/scipy/python27_compiled/sc_e6d71e9b4074eed34d1cb1112482ee6213.cpp
In file included from /usr/local/python/2.7/numpy-mkl/1.8.1/lib64/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1761:0,
from /usr/local/python/2.7/numpy-mkl/1.8.1/lib64/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17,
from /usr/local/python/2.7/numpy-mkl/1.8.1/lib64/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
from .cache/scipy/python27_compiled/sc_e6d71e9b4074eed34d1cb1112482ee6213.cpp:22:
/usr/local/python/2.7/numpy-mkl/1.8.1/lib64/python2.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
g++: /usr/local/python/2.7/scipy-mkl/0.14.0/lib64/python2.7/site-packages/scipy/weave/scxx/weave_imp.cpp
g++ -pthread -shared /tmp/scipy-lcharlin-TBGEf5/python27_intermediate/compiler_fd2a2fbe93416fc0ff84072f09de2daf/.cache/scipy/python27_compiled/sc_e6d71e9b4074eed34d1cb1112482ee6213.o /tmp/scipy-lcharlin-TBGEf5/python27_intermediate/compiler_fd2a2fbe93416fc0ff84072f09de2daf/usr/local/python/2.7/scipy-mkl/0.14.0/lib64/python2.7/site-packages/scipy/weave/scxx/weave_imp.o -L/usr/lib64 -lgomp -lgsl -lpython2.7 -o .cache/scipy/python27_compiled/sc_e6d71e9b4074eed34d1cb1112482ee6213.so

@rgommers
Copy link
Member

Not sure. The compile part of inline is quite complex, but the import at the end is simple:

    sys.path.insert(0,storage_dir)
    exec('import ' + module_name)
    func = eval(module_name+'.compiled_func')

@person142
Copy link
Member

Closing since weave is no longer a part of SciPy. This issue is now tracked at scipy/weave#7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants