Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

xnn

macrumors newbie
Original poster
Jan 24, 2009
2
0
Hello,
I'm a total Mac newbie trying to migrate my programs from Windows and Linux - I have a python module which wraps a couple of gsl routines (gsl_sf_coupling_3j and gsl_sf_coupling_6j) and installs with distutils on Windows and Ubuntu Linux, but when I try to import it on my Mac, it complains:
Symbol not found: _cblas_caxpy
Referenced from: /usr/local/lib/libgsl.0.dylib
Expected in: dynamic lookup

I don't really understand what's going on. I can call the gsl routines from a C++ program importing the gsl libraries directly, so they're clearly working.
Any idea what might be wrong? I haven't found a lot of help on t'Internet.
Thanks,
xnn
 
OK - scratch that. It works now: I wasn't linking in the BLAS libraries. All is good.
 
Same problem loading libgsl.dylib

Hi xnn, I am trying to load the gsl shared library from Python 2.6 using ctypes on Mac OS X 10.6 but I have the problem as you :

Code:
from ctypes import cdll
cdll.LoadLibrary("libgsl.dylib")

The symbol _cblas_caxpy is not found

Code:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ctypes/__init__.py", line 431, in LoadLibrary
    return self._dlltype(name)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ctypes/__init__.py", line 353, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(libgsl.dylib, 6): Symbol not found: _cblas_caxpy
  Referenced from: /usr/local/lib/libgsl.dylib
  Expected in: flat namespace
 in /usr/local/lib/libgsl.dylib

I have also tried

Code:
from ctypes import cdll
cdll.LoadLibrary("libcblas.dylib")
cdll.LoadLibrary("libgslcblas.dylib")
cdll.LoadLibrary("libgsl.dylib")

Without success.
Could elaborate on how you solved your problem ?
 
Talk about Murphy's Law. After about one hour looking for an answer, I decided to post here. 5 minutes later I found an answer.

The following code resolves the issue by making the cblas symbols global :

Code:
from ctypes import CDLL
gslcblas = CDLL('libgslcblas.dylib',mode=RTLD_GLOBAL)
gsl = CDLL('libgsl.dylib')
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.