linking error after swig

whatazor dannox at gmail.com
Mon Dec 21 14:12:11 EST 2009


Hi All,
I have a mac os x, and I try to replicate the sample in swig tutorial
but when I try to link, I have these linking errors:

ld  example.o example_wrap.o -o _example.so
Undefined symbols:
  "_PyType_Type", referenced from:
      _PyType_Type$non_lazy_ptr in example_wrap.o
  "_PyExc_SystemError", referenced from:
      _PyExc_SystemError$non_lazy_ptr in example_wrap.o
  "_PyDict_New", referenced from:
      _SWIG_Python_NewShadowInstance in example_wrap.o
      _SWIG_Python_NewShadowInstance in example_wrap.o
      _SWIG_Python_SetSwigThis in example_wrap.o
      _SWIG_Python_TypeCache in example_wrap.o
  "_fputs$UNIX2003", referenced from:
      _PySwigObject_print in example_wrap.o
      _PySwigPacked_print in example_wrap.o
      _PySwigPacked_print in example_wrap.o
  "_PyExc_IOError", referenced from:
      _PyExc_IOError$non_lazy_ptr in example_wrap.o
  "_PyCObject_Import", referenced from:
      _SWIG_Python_GetModule in example_wrap.o
  "_PyList_Append", referenced from:
      _SWIG_Python_AppendOutput in example_wrap.o
  "_PyTuple_Type", referenced from:
      _PyTuple_Type$non_lazy_ptr in example_wrap.o
  "_PyExc_MemoryError", referenced from:
      _PyExc_MemoryError$non_lazy_ptr in example_wrap.o
  "_PyArg_ParseTuple", referenced from:
      __wrap_fact in example_wrap.o
      __wrap_my_mod in example_wrap.o
      __wrap_get_time in example_wrap.o
  "_strstr", referenced from:
      _SWIG_Python_ConvertFunctionPtr in example_wrap.o
      _SWIG_Python_FixMethods in example_wrap.o
  "_fwrite$UNIX2003", referenced from:
      _PySwigPacked_print in example_wrap.o
      _PySwigPacked_print in example_wrap.o
      _swig_varlink_print in example_wrap.o
  "_PyInstance_NewRaw", referenced from:
      _SWIG_Python_NewShadowInstance in example_wrap.o
  "_PyDict_SetItemString", referenced from:
      _SWIG_Python_SetConstant in example_wrap.o
      _SWIG_Python_InstallConstants in example_wrap.o
      _init_example in example_wrap.o
  "_PyFloat_AsDouble", referenced from:
      _SWIG_AsVal_double in example_wrap.o
  "_PyArg_UnpackTuple", referenced from:
      _PySwigObject_own in example_wrap.o
  "_PyObject_Str", referenced from:
      _SWIG_Python_AddErrorMsg in example_wrap.o
      _SWIG_Python_AddErrMesg in example_wrap.o
      _SWIG_Python_TypeError in example_wrap.o
  "_PyDict_GetItem", referenced from:
      _SWIG_Python_GetSwigThis in example_wrap.o
      _SWIG_Python_TypeQuery in example_wrap.o
  "_PyExc_TypeError", referenced from:
      _PyExc_TypeError$non_lazy_ptr in example_wrap.o
  "_PyString_FromString", referenced from:
      _PySwigObject_format in example_wrap.o
      _PySwigObject_str in example_wrap.o
      _PySwigPacked_str in example_wrap.o
      __SWIG_This in example_wrap.o
      _SWIG_Python_TypeQuery in example_wrap.o
      _swig_varlink_repr in example_wrap.o
      _swig_varlink_str in example_wrap.o
      _swig_varlink_str in example_wrap.o
      _swig_varlink_str in example_wrap.o
      _swig_varlink_str in example_wrap.o
  "_PyBool_FromLong", referenced from:
      _PySwigObject_own in example_wrap.o
  "_PyString_AsString", referenced from:
      _SWIG_Python_AddErrorMsg in example_wrap.o
      _PySwigObject_repr in example_wrap.o
      _PySwigObject_print in example_wrap.o
      _SWIG_Python_AddErrMesg in example_wrap.o
      _SWIG_Python_AddErrMesg in example_wrap.o
      _SWIG_Python_TypeError in example_wrap.o
      _swig_varlink_print in example_wrap.o
  "_PyObject_IsTrue", referenced from:
      _PySwigObject_own in example_wrap.o
  "_PyList_Type", referenced from:
      _PyList_Type$non_lazy_ptr in example_wrap.o
  "_PyInt_AsLong", referenced from:
      _SWIG_AsVal_double in example_wrap.o
      _SWIG_AsVal_long in example_wrap.o
  "_PyErr_SetString", referenced from:
      _SWIG_Python_SetErrorMsg in example_wrap.o
      _SWIG_Python_UnpackTuple in example_wrap.o
      _swig_varlink_getattr in example_wrap.o
      _swig_varlink_setattr in example_wrap.o
  "_malloc", referenced from:
      _PySwigClientData_New in example_wrap.o
      _PySwigPacked_New in example_wrap.o
      _SWIG_Python_addvarlink in example_wrap.o
      _SWIG_Python_addvarlink in example_wrap.o
      _SWIG_Python_FixMethods in example_wrap.o
  "_PyList_New", referenced from:
      _SWIG_Python_AppendOutput in example_wrap.o
  "_PyErr_SetObject", referenced from:
      _SWIG_Python_SetErrorObj in example_wrap.o
  "_strncmp", referenced from:
      _PySwigPacked_compare in example_wrap.o
      _SWIG_Python_FixMethods in example_wrap.o
  "_PyObject_Malloc", referenced from:
      _PySwigObject_New in example_wrap.o
      _PySwigPacked_New in example_wrap.o
      _SWIG_Python_newvarlink in example_wrap.o
  "_PyExc_RuntimeError", referenced from:
      _PyExc_RuntimeError$non_lazy_ptr in example_wrap.o
  "_PyCFunction_Type", referenced from:
      _PyCFunction_Type$non_lazy_ptr in example_wrap.o
  "__Py_NoneStruct", referenced from:
      __Py_NoneStruct$non_lazy_ptr in example_wrap.o
  "__PyWeakref_CallableProxyType", referenced from:
      __PyWeakref_CallableProxyType$non_lazy_ptr in example_wrap.o
  "_PyObject_Init", referenced from:
      _PySwigObject_New in example_wrap.o
      _PySwigPacked_New in example_wrap.o
      _SWIG_Python_newvarlink in example_wrap.o
  "_PyExc_SyntaxError", referenced from:
      _PyExc_SyntaxError$non_lazy_ptr in example_wrap.o
  "_PyLong_AsDouble", referenced from:
      _SWIG_AsVal_double in example_wrap.o
  "_PyErr_Format", referenced from:
      _SWIG_Python_AddErrorMsg in example_wrap.o
      _SWIG_Python_AddErrorMsg in example_wrap.o
      _SWIG_Python_UnpackTuple in example_wrap.o
      _SWIG_Python_UnpackTuple in example_wrap.o
      _SWIG_Python_UnpackTuple in example_wrap.o
      _SWIG_Python_AddErrMesg in example_wrap.o
      _SWIG_Python_AddErrMesg in example_wrap.o
      _SWIG_Python_TypeError in example_wrap.o
      _SWIG_Python_TypeError in example_wrap.o
      _SWIG_Python_TypeError in example_wrap.o
      _SWIG_Python_TypeError in example_wrap.o
  "_PyFloat_Type", referenced from:
      _PyFloat_Type$non_lazy_ptr in example_wrap.o
  "_PyString_FromStringAndSize", referenced from:
      _SWIG_FromCharPtrAndSize in example_wrap.o
  "__PyInstance_Lookup", referenced from:
      _SWIG_Python_GetSwigThis in example_wrap.o
  "_printf", referenced from:
      _PySwigObject_dealloc in example_wrap.o
  "_fprintf", referenced from:
      _swig_varlink_print in example_wrap.o
  "_PyExc_IndexError", referenced from:
      _PyExc_IndexError$non_lazy_ptr in example_wrap.o
  "_PyLong_AsLong", referenced from:
      _SWIG_AsVal_long in example_wrap.o
  "_PyList_SetItem", referenced from:
      _SWIG_Python_AppendOutput in example_wrap.o
  "_strncpy", referenced from:
      _SWIG_PackDataName in example_wrap.o
      _SWIG_Python_addvarlink in example_wrap.o
      _SWIG_Python_FixMethods in example_wrap.o
  "_PyCObject_AsVoidPtr", referenced from:
      _SWIG_Python_TypeQuery in example_wrap.o
  "_PyExc_NameError", referenced from:
      _PyExc_NameError$non_lazy_ptr in example_wrap.o
  "_PyInstance_Type", referenced from:
      _PyInstance_Type$non_lazy_ptr in example_wrap.o
  "_PyType_IsSubtype", referenced from:
      _SWIG_Python_AppendOutput in example_wrap.o
      _SWIG_Python_UnpackTuple in example_wrap.o
      _SWIG_AsVal_double in example_wrap.o
      _SWIG_AsVal_double in example_wrap.o
      _SWIG_AsVal_double in example_wrap.o
      _SWIG_AsVal_long in example_wrap.o
      _SWIG_AsVal_long in example_wrap.o
  "_PyObject_GenericGetAttr", referenced from:
      _tmp.8636 in example_wrap.o
      _tmp.8783 in example_wrap.o
  "_PyFloat_FromDouble", referenced from:
      _My_variable_get in example_wrap.o
  "_free", referenced from:
      _PySwigPacked_dealloc in example_wrap.o
      _swig_varlink_dealloc in example_wrap.o
      _swig_varlink_dealloc in example_wrap.o
  "__PyWeakref_ProxyType", referenced from:
      __PyWeakref_ProxyType$non_lazy_ptr in example_wrap.o
  "_PyObject_GetAttr", referenced from:
      _SWIG_Python_GetSwigThis in example_wrap.o
  "_PyString_Format", referenced from:
      _PySwigObject_format in example_wrap.o
  "_PyExc_ZeroDivisionError", referenced from:
      _PyExc_ZeroDivisionError$non_lazy_ptr in example_wrap.o
  "_PyInt_Type", referenced from:
      _PyInt_Type$non_lazy_ptr in example_wrap.o
  "_PyExc_ValueError", referenced from:
      _PyExc_ValueError$non_lazy_ptr in example_wrap.o
  "_PyObject_CallFunctionObjArgs", referenced from:
      _PySwigObject_dealloc in example_wrap.o
      _SWIG_Python_ConvertPtrAndOwn in example_wrap.o
  "_PyObject_GetAttrString", referenced from:
      _PySwigClientData_New in example_wrap.o
      _PySwigClientData_New in example_wrap.o
      _SWIG_Python_SetSwigThis in example_wrap.o
  "_PyDict_SetItem", referenced from:
      _SWIG_Python_NewShadowInstance in example_wrap.o
      _SWIG_Python_NewShadowInstance in example_wrap.o
      _SWIG_Python_SetSwigThis in example_wrap.o
      _SWIG_Python_SetSwigThis in example_wrap.o
      _SWIG_Python_TypeQuery in example_wrap.o
  "_PyErr_Clear", referenced from:
      _SWIG_Python_AddErrorMsg in example_wrap.o
      _PySwigClientData_New in example_wrap.o
      _SWIG_Python_GetSwigThis in example_wrap.o
      _SWIG_Python_ConvertPtrAndOwn in example_wrap.o
      _SWIG_Python_GetModule in example_wrap.o
      _SWIG_Python_AddErrMesg in example_wrap.o
      _SWIG_Python_MustGetPtr in example_wrap.o
      _SWIG_AsVal_double in example_wrap.o
      _SWIG_AsVal_long in example_wrap.o
  "_time", referenced from:
      _get_time in example.o
  "_PyExc_AttributeError", referenced from:
      _PyExc_AttributeError$non_lazy_ptr in example_wrap.o
  "_fputc", referenced from:
      _PySwigPacked_print in example_wrap.o
  "_PyTuple_SetItem", referenced from:
      _PySwigClientData_New in example_wrap.o
      _PySwigObject_format in example_wrap.o
  "_PyModule_GetDict", referenced from:
      _init_example in example_wrap.o
  "_PyString_ConcatAndDel", referenced from:
      _PySwigObject_repr in example_wrap.o
      _swig_varlink_str in example_wrap.o
      _swig_varlink_str in example_wrap.o
      _swig_varlink_str in example_wrap.o
  "_PyModule_AddObject", referenced from:
      _SWIG_Python_SetModule in example_wrap.o
  "__PyObject_GetDictPtr", referenced from:
      _SWIG_Python_GetSwigThis in example_wrap.o
      _SWIG_Python_NewShadowInstance in example_wrap.o
      _SWIG_Python_SetSwigThis in example_wrap.o
  "_PyExc_OverflowError", referenced from:
      _PyExc_OverflowError$non_lazy_ptr in example_wrap.o
  "_PyErr_Occurred", referenced from:
      _SWIG_Python_AddErrorMsg in example_wrap.o
      _PySwigClientData_New in example_wrap.o
      _SWIG_Python_GetSwigThis in example_wrap.o
      _SWIG_Python_ConvertPtrAndOwn in example_wrap.o
      _SWIG_Python_GetModule in example_wrap.o
      _SWIG_Python_AddErrMesg in example_wrap.o
      _SWIG_Python_ArgFail in example_wrap.o
      _SWIG_AsVal_double in example_wrap.o
      _SWIG_AsVal_long in example_wrap.o
      _swig_varlink_getattr in example_wrap.o
      _swig_varlink_setattr in example_wrap.o
  "_strcmp", referenced from:
      _SWIG_TypeCheck in example_wrap.o
      _SWIG_MangledTypeQueryModule in example_wrap.o
      _SWIG_UnpackVoidPtr in example_wrap.o
      _SWIG_UnpackDataName in example_wrap.o
      _PySwigObject_Check in example_wrap.o
      _PySwigPacked_Check in example_wrap.o
      _swig_varlink_getattr in example_wrap.o
      _swig_varlink_setattr in example_wrap.o
  "_PyLong_Type", referenced from:
      _PyLong_Type$non_lazy_ptr in example_wrap.o
  "_PyInt_FromLong", referenced from:
      _SWIG_From_int in example_wrap.o
  "_PyObject_Free", referenced from:
      _PySwigObject_dealloc in example_wrap.o
      _PySwigPacked_dealloc in example_wrap.o
      _PySwigPacked_New in example_wrap.o
  "_PyString_FromFormat", referenced from:
      _PySwigObject_repr in example_wrap.o
      _PySwigPacked_repr in example_wrap.o
      _PySwigPacked_repr in example_wrap.o
      _PySwigPacked_str in example_wrap.o
  "_PyErr_Fetch", referenced from:
      _SWIG_Python_AddErrorMsg in example_wrap.o
      _SWIG_Python_AddErrMesg in example_wrap.o
  "_PyCObject_FromVoidPtr", referenced from:
      _SWIG_Python_SetModule in example_wrap.o
      _SWIG_Python_TypeQuery in example_wrap.o
  "_Py_InitModule4", referenced from:
      _SWIG_Python_SetModule in example_wrap.o
      _init_example in example_wrap.o
  "_ctime", referenced from:
      _get_time in example.o
  "_PyLong_FromVoidPtr", referenced from:
      _PySwigObject_long in example_wrap.o
  "_PyOS_snprintf", referenced from:
      _SWIG_Python_ArgFail in example_wrap.o
  "_PyObject_Call", referenced from:
      _SWIG_Python_NewShadowInstance in example_wrap.o
  "_strcpy", referenced from:
      _SWIG_PackVoidPtr in example_wrap.o
  "_PyTuple_New", referenced from:
      _PySwigClientData_New in example_wrap.o
      _PySwigObject_format in example_wrap.o
  "_memcpy", referenced from:
      __PySwigObject_type in example_wrap.o
      __PySwigPacked_type in example_wrap.o
      _swig_varlink_type in example_wrap.o
  "_PyClass_Type", referenced from:
      _PyClass_Type$non_lazy_ptr in example_wrap.o
ld: symbol(s) not found for inferred architecture i386

I try to add to the DYLD_LIBRARY_PATH the python dylib, but nothing.
Any advice?

thank you very much
w



More information about the Python-list mailing list