Cannot find symbol in dynamically loaded library

Member
Posts: 22
Joined: 2007.07
Post: #1
I'm trying to get a game to run that was written with Python using Audiere for audio (here). I found a patch adding an SDL backend here and got it to compile fine, but now the python binding won't work. It compiles without problems, but running it gives
Code:
ImportError: dlopen(/Users/thej/.python-eggs/pyaudiere-0.2-py2.6-macosx-10.5-i386.egg-tmp/audiere.so, 2): Symbol not found: __ZN7audiere14SDLAudioDevice6createERKNS_13ParameterListE
  Referenced from: /usr/local/lib/libaudiere-1.9.5.dylib
  Expected in: flat namespace

So from what I can figure out either Audiere or the Python bindings need to be built with either flat namespace or two level namespace or some combination thereof, but I can't get it to work so if anyone can explain to me what's actually going on that would probably be a lot better than trying alternate settings at random.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
Code:
$ c++filt
__ZN7audiere14SDLAudioDevice6createERKNS_13ParameterListE
audiere::SDLAudioDevice::create(audiere::ParameterList const&)

It looks like /usr/local/lib/libaudiere-1.9.5.dylib is dlopening /Users/thej/.python-eggs/pyaudiere-0.2-py2.6-macosx-10.5-i386.egg-tmp/audiere.so and expecting to find audiere::SDLAudioDevice::create(audiere::ParameterList const&) but not finding it. What does

Code:
nm /Users/thej/.python-eggs/pyaudiere-0.2-py2.6-macosx-10.5-i386.egg-tmp/audiere.so
say?
Quote this message in a reply
Member
Posts: 22
Joined: 2007.07
Post: #3
Well that would be a very confusing state of affairs, since the library itself shouldn't have any reference to the Python bindings and before I applied the patch that enabled SDL I didn't get any symbol errors.

Here's the output of nm.

Code:
U _AdrCreatePinkNoise
         U _AdrCreateSampleBuffer
         U _AdrCreateSquareWave
         U _AdrCreateTone
         U _AdrCreateWhiteNoise
         U _AdrGetSupportedAudioDevices
         U _AdrGetVersion
         U _AdrOpenDevice
         U _AdrOpenSampleSource
         U _AdrOpenSound
00004020 D _AudiereMethods
00004084 d _Audiere_GetDevices_doc
00004050 d _Audiere_OpenDevice_doc
00004fa0 D _AudioDeviceMethods
00005180 d _AudioDevice_CreatePinkNoise_doc
00005248 d _AudioDevice_CreateSquare_doc
000052bc d _AudioDevice_CreateTone_doc
000051e8 d _AudioDevice_CreateWhiteNoise_doc
00005010 d _AudioDevice_OpenArray_doc
000050dc d _AudioDevice_OpenSound_doc
00004904 d _AudioDevice_doc
00005404 d _OutPutStream_doc
000059e0 d _OutputStreamMethods
00005a9b d _OutputStream_Pause_doc
00005ab4 d _OutputStream_Play_doc
00005a30 d _OutputStream_Reset_doc
00005a64 d _OutputStream_Stop_doc
         U _PyArg_ParseTuple
         U _PyCObject_AsVoidPtr
         U _PyCObject_Type
         U _PyDict_New
         U _PyDict_SetItem
         U _PyDict_SetItemString
         U _PyErr_Format
         U _PyErr_Print
         U _PyErr_SetString
         U _PyExc_ImportError
         U _PyExc_RuntimeError
         U _PyFloat_AsDouble
         U _PyFloat_FromDouble
         U _PyImport_ImportModule
         U _PyInt_AsLong
         U _PyInt_FromLong
         U _PyModule_GetDict
         U _PyObject_Free
         U _PyObject_GetAttrString
         U _PyString_FromString
         U _PyType_Type
         U _Py_FindMethod
         U _Py_InitModule4
00006378 S __PY_AUDIERE_HANDLE
         U __PyObject_New
         U __Py_NoneStruct
         U __Unwind_Resume
00002670 T __Z17NewPyOutputStreamPN7audiere12OutputStreamE
00003090 t __Z17OutputStream_PlayP7_objectS0_
000030f0 t __Z17OutputStream_StopP7_objectS0_
00000c90 T __Z18Audiere_GetDevicesP7_objectS0_
00000b70 T __Z18Audiere_OpenDeviceP7_objectS0_
000030c0 t __Z18OutputStream_PauseP7_objectS0_
00003130 t __Z18OutputStream_ResetP7_objectS0_
00002640 T __Z19AudioDevice_deallocP7_object
000026e0 T __Z19AudioDevice_getattrP7_objectPc
00003060 T __Z20OutputStream_deallocP7_object
00003160 t __Z20OutputStream_getattrP7_objectPc
000033d0 t __Z20OutputStream_setattrP7_objectPcS0_
00002d50 T __Z21AudioDevice_OpenArrayP7_objectS0_
00002ba0 T __Z21AudioDevice_OpenSoundP7_objectS0_
00002780 T __Z22AudioDevice_CreateToneP7_objectS0_
000028a0 T __Z24AudioDevice_CreateSquareP7_objectS0_
00002ab0 T __Z27AudioDevice_CreatePinkNoiseP7_objectS0_
000029c0 T __Z28AudioDevice_CreateWhiteNoiseP7_objectS0_
00001f70 T __ZN7audiere11SplitStringERSt6vectorISsSaISsEEPKcc
000021c0 T __ZN7audiere24GetSupportedAudioDevicesERSt6vectorINS_15AudioDeviceDescESaIS1_EE
         U __ZN9__gnu_cxx18__exchange_and_addEPVii
00000f10 T __ZNSs12_S_constructIPKcEEPcT_S3_RKSaIcESt20forward_iterator_tag
         U __ZNSs4_Rep10_M_destroyERKSaIcE
         U __ZNSs4_Rep11_S_terminalE
         U __ZNSs4_Rep20_S_empty_rep_storageE
         U __ZNSs4_Rep9_S_createEmmRKSaIcE
         U __ZNSs6assignERKSs
         U __ZNSsC1EPKcRKSaIcE
         U __ZNSsC1ERKSs
         U __ZNSsD1Ev
000012d0 T __ZNSt6vectorIN7audiere15AudioDeviceDescESaIS1_EE14_M_fill_insertEN9__gnu_cxx17_​_normal_iteratorIPS1_S3_EEmRKS1_
00000fe0 T __ZNSt6vectorIN7audiere15AudioDeviceDescESaIS1_EE5eraseEN9__gnu_cxx17__normal_it​eratorIPS1_S3_EES7_
00001a50 T __ZNSt6vectorISsSaISsEE13_M_insert_auxEN9__gnu_cxx17__normal_iteratorIPSsS1_EERK​Ss
00001e80 T __ZNSt6vectorISsSaISsEE5eraseEN9__gnu_cxx17__normal_iteratorIPSsS1_EES5_
         U __ZSt17__throw_bad_allocv
         U __ZSt19__throw_logic_errorPKc
         U __ZSt20__throw_length_errorPKc
00001150 T __ZSt26__uninitialized_fill_n_auxIN9__gnu_cxx17__normal_iteratorIPN7audiere15Aud​ioDeviceDescESt6vectorIS3_SaIS3_EEEEmS3_EvT_T0_RKT1_12__false_type
         U __ZdlPv
         U __Znwm
         U ___cxa_begin_catch
         U ___cxa_end_catch
         U ___cxa_rethrow
         U ___gxx_personality_v0
000008a4 t __dyld_func_lookup
00000000 t __mh_bundle_header
00004840 D _audiere_AudioDeviceType
00005340 D _audiere_OutputStreamType
000040c8 d _docstring
         U _free
000008c0 T _initaudiere
         U _malloc
         U _memcpy
         U _strchr
000040c1 d _ver
00004000 d dyld__mach_header
00000890 t dyld_stub_binding_helper
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #4
Sorry, that's not really telling me anything more useful :/
Quote this message in a reply
Member
Posts: 22
Joined: 2007.07
Post: #5
I tried linking in Audiere statically and now the symbol shows up in the symbol table, but I get

Code:
dlopen(/Users/thej/.python-eggs/pyaudiere-0.2-py2.6-macosx-10.5-i386.egg-tmp/audiere.so, 2): Symbol not found: __ZN7audiere14SDLAudioDevice6createERKNS_13ParameterListE
  Referenced from: /Users/thej/.python-eggs/pyaudiere-0.2-py2.6-macosx-10.5-i386.egg-tmp/audiere.so
  Expected in: dynamic lookup

What I really don't get is the "Expected in" line. What kind of dynamic lookup could it be doing when everything is contained in the library itself?
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Xcode 4, what's the "M" symbol? AnotherJake 6 9,171 Apr 12, 2011 09:28 PM
Last Post: AnotherJake
  Dynamically sized NSArray Muskrat 2 3,296 Jun 23, 2009 07:28 AM
Last Post: ThemsAllTook
  XCode 2.1 and ZeroLink: unknown symbol NYGhost 1 3,334 Aug 24, 2005 09:10 AM
Last Post: NYGhost