RfidResearchGroup / proxmark3

Iceman Fork - Proxmark3
http://www.icedev.se
GNU General Public License v3.0
3.89k stars 1.03k forks source link

Error compiling on macOS related to Python #2305

Closed dotdeas closed 5 months ago

dotdeas commented 7 months ago

Describe the bug Issue with compiling latest commit

To Reproduce Steps to reproduce the behavior:

  1. Git clone
  2. Compile (make clean && make -j8 all)
  3. See error

[=] CXX proxmark3 ld: Undefined symbols: _PyArg_UnpackTuple, referenced from: _SwigPyObject_own in pm3_pywrap.o _PyBool_FromLong, referenced from: _SwigPyObject_richcompare in pm3_pywrap.o _SwigPyObject_own in pm3_pywrap.o _PyBool_Type, referenced from: _SWIG_Python_UnpackTuple in pm3_pywrap.o _PyBytes_AsStringAndSize, referenced from: _SWIG_AsCharPtrAndSize in pm3_pywrap.o _PyCFunction_Type, referenced from: _SWIG_PyInstanceMethod_New in pm3_pywrap.o _SWIG_PyInstanceMethod_New in pm3_pywrap.o _pm3_swigregister in pm3_pywrap.o _pm3_swigregister in pm3_pywrap.o _SwigPyObject_dealloc in pm3_pywrap.o _SwigPyObject_dealloc in pm3_pywrap.o _SwigPyObject_dealloc in pm3_pywrap.o ... _PyCMethod_New, referenced from: _SWIG_PyInstanceMethod_New in pm3_pywrap.o _PyCapsule_GetPointer, referenced from: _SWIG_pchar_descriptor in pm3_pywrap.o _SWIG_Python_DestroyModule in pm3_pywrap.o _PyCapsule_Import, referenced from: _PyInit__pm3 in pm3_pywrap.o _SWIG_pchar_descriptor in pm3_pywrap.o _PyCapsule_New, referenced from: _PyInit__pm3 in pm3_pywrap.o _SWIG_pchar_descriptor in pm3_pywrap.o _PyConfig_Clear, referenced from: _CmdScriptRun in cmdscript.o _PyConfig_InitPythonConfig, referenced from: _CmdScriptRun in cmdscript.o _PyConfig_SetBytesArgv, referenced from: _CmdScriptRun in cmdscript.o _PyConfig_SetBytesString, referenced from: _CmdScriptRun in cmdscript.o _CmdScriptRun in cmdscript.o _PyDict_DelItemString, referenced from: _Pm3PyRun_SimpleFileNoExit in cmdscript.o _PyDict_GetItem, referenced from: _SWIG_pchar_descriptor in pm3_pywrap.o _PyDict_GetItemString, referenced from: _Pm3PyRun_SimpleFileNoExit in cmdscript.o _PyDict_New, referenced from: _PyInit__pm3 in pm3_pywrap.o _SWIG_Python_NewPointerObj in pm3_pywrap.o _SWIG_pchar_descriptor in pm3_pywrap.o _PyDict_SetItem, referenced from: _SWIG_pchar_descriptor in pm3_pywrap.o _PyDict_SetItemString, referenced from: _Pm3PyRun_SimpleFileNoExit in cmdscript.o _Pm3PyRun_SimpleFileNoExit in cmdscript.o _PyErr_Clear, referenced from: _Pm3PyRun_SimpleFileNoExit in cmdscript.o _Pm3PyRun_SimpleFileNoExit in cmdscript.o _PyInit__pm3 in pm3_pywrap.o _pm3_swigregister in pm3_pywrap.o _SWIG_pchar_descriptor in pm3_pywrap.o _SWIG_Python_GetSwigThis in pm3_pywrap.o _PyErr_ExceptionMatches, referenced from: _Pm3PyRun_SimpleFileNoExit in cmdscript.o _PyErr_Fetch, referenced from: _Pm3PyRun_SimpleFileNoExit in cmdscript.o __wrap_new_pm3 in pm3_pywrap.o _SwigPyObject_dealloc in pm3_pywrap.o _PyErr_Format, referenced from: _SWIG_Python_UnpackTuple in pm3_pywrap.o _PyErr_GivenExceptionMatches, referenced from: __wrap_new_pm3 in pm3_pywrap.o _PyErr_Occurred, referenced from: _PyInit__pm3 in pm3_pywrap.o __wrap_new_pm3 in pm3_pywrap.o _pm3_swigregister in pm3_pywrap.o _SWIG_pchar_descriptor in pm3_pywrap.o _SWIG_Python_GetSwigThis in pm3_pywrap.o _PyErr_Print, referenced from: _Pm3PyRun_SimpleFileNoExit in cmdscript.o _PyErr_Restore, referenced from: __wrap_new_pm3 in pm3_pywrap.o _SwigPyObject_dealloc in pm3_pywrap.o _SwigPyObject_dealloc in pm3_pywrap.o _PyErr_SetString, referenced from: __wrap_new_pm3 in pm3_pywrap.o __wrap_new_pm3 in pm3_pywrap.o __wrap_delete_pm3 in pm3_pywrap.o __wrap_pm3_console in pm3_pywrap.o __wrap_pm3_console in pm3_pywrap.o __wrap_pm3_name_get in pm3_pywrap.o _pm3_swiginit in pm3_pywrap.o ... _PyErr_WriteUnraisable, referenced from: _SwigPyObject_dealloc in pm3_pywrap.o _PyExc_AttributeError, referenced from: l_switch.table._wrap_pm3_name_get in pm3_pywrap.o _PyExc_IOError, referenced from: l_switch.table._wrap_pm3_name_get in pm3_pywrap.o _PyExc_IndexError, referenced from: l_switch.table._wrap_pm3_name_get in pm3_pywrap.o _PyExc_MemoryError, referenced from: l_switch.table._wrap_pm3_name_get in pm3_pywrap.o _PyExc_OverflowError, referenced from: l_switch.table._wrap_pm3_name_get in pm3_pywrap.o _PyExc_RuntimeError, referenced from: __wrap_new_pm3 in pm3_pywrap.o __wrap_delete_pm3 in pm3_pywrap.o __wrap_pm3_console in pm3_pywrap.o __wrap_pm3_name_get in pm3_pywrap.o l_switch.table._wrap_pm3_name_get in pm3_pywrap.o _PyExc_SyntaxError, referenced from: l_switch.table._wrap_pm3_name_get in pm3_pywrap.o _PyExc_SystemError, referenced from: _SWIG_Python_UnpackTuple in pm3_pywrap.o l_switch.table._wrap_pm3_name_get in pm3_pywrap.o _PyExc_SystemExit, referenced from: _Pm3PyRun_SimpleFileNoExit in cmdscript.o _PyExc_TypeError, referenced from: __wrap_new_pm3 in pm3_pywrap.o __wrap_pm3_console in pm3_pywrap.o _pm3_swiginit in pm3_pywrap.o _SWIG_Python_UnpackTuple in pm3_pywrap.o _SWIG_Python_UnpackTuple in pm3_pywrap.o _SWIG_Python_UnpackTuple in pm3_pywrap.o _SwigPyObject_append in pm3_pywrap.o ... _PyExc_ValueError, referenced from: l_switch.table._wrap_pm3_name_get in pm3_pywrap.o _PyExc_ZeroDivisionError, referenced from: l_switch.table._wrap_pm3_name_get in pm3_pywrap.o _PyImport_AddModule, referenced from: _Pm3PyRun_SimpleFileNoExit in cmdscript.o _PyInit__pm3 in pm3_pywrap.o _PyImport_AppendInittab, referenced from: _CmdScriptRun in cmdscript.o _PyInstanceMethod_New, referenced from: _SWIG_PyInstanceMethod_New in pm3_pywrap.o _SWIG_PyInstanceMethod_New in pm3_pywrap.o _PyList_Insert, referenced from: _set_python_path in cmdscript.o _PyLong_AsLong, referenced from: _Pm3PyRun_SimpleFileNoExit in cmdscript.o _PyLong_FromLong, referenced from: __wrap_pm3_console in pm3_pywrap.o _PyLong_FromVoidPtr, referenced from: _SwigPyObject_long in pm3_pywrap.o _PyLong_Type, referenced from: _SWIG_Python_UnpackTuple in pm3_pywrap.o _PyModule_AddObject, referenced from: _PyInit__pm3 in pm3_pywrap.o _PyModule_Create2, referenced from: _PyInit__pm3 in pm3_pywrap.o _PyModule_GetDict, referenced from: _Pm3PyRun_SimpleFileNoExit in cmdscript.o _PyInit__pm3 in pm3_pywrap.o _PyObject_Call, referenced from: _SWIG_Python_NewPointerObj in pm3_pywrap.o _PyObject_CallFunctionObjArgs, referenced from: _SwigPyObject_dealloc in pm3_pywrap.o _PyObject_Free, referenced from: _SwigPyPacked_dealloc in pm3_pywrap.o _SwigPyPacked_dealloc in pm3_pywrap.o _SwigPyObject_dealloc in pm3_pywrap.o _PyObject_GenericGetAttr, referenced from: l___const.SwigPyPacked_TypeOnce.tmp in pm3_pywrap.o l___const.SwigPyObject_TypeOnce.tmp in pm3_pywrap.o _PyObject_GetAttr, referenced from: _SWIG_Python_GetSwigThis in pm3_pywrap.o _PyObject_GetAttrString, referenced from: _pm3_swigregister in pm3_pywrap.o _pm3_swigregister in pm3_pywrap.o _PyObject_IsInstance, referenced from: _pm3_swigregister in pm3_pywrap.o _PyObject_IsTrue, referenced from: _SwigPyObject_own in pm3_pywrap.o _PyObject_SetAttr, referenced from: _pm3_swiginit in pm3_pywrap.o _pm3_swiginit in pm3_pywrap.o _SWIG_Python_NewPointerObj in pm3_pywrap.o _SWIG_Python_NewPointerObj in pm3_pywrap.o _PyRun_FileExFlags, referenced from: _Pm3PyRun_SimpleFileNoExit in cmdscript.o _PySys_GetObject, referenced from: _set_python_path in cmdscript.o _PySys_SetObject, referenced from: _set_python_path in cmdscript.o _PyTuple_New, referenced from: _pm3_swigregister in pm3_pywrap.o _SWIG_Python_NewPointerObj in pm3_pywrap.o _PyTuple_SetItem, referenced from: _pm3_swigregister in pm3_pywrap.o _PyType_IsSubtype, referenced from: _SWIG_PyInstanceMethod_New in pm3_pywrap.o _pm3_swigregister in pm3_pywrap.o _SwigPyObject_dealloc in pm3_pywrap.o _SwigPyObject_dealloc in pm3_pywrap.o _PyType_Ready, referenced from: _PyInit__pm3 in pm3_pywrap.o _PyInit__pm3 in pm3_pywrap.o _pm3_swiginit in pm3_pywrap.o _SWIG_Python_NewPointerObj in pm3_pywrap.o _SWIG_Python_GetSwigThis in pm3_pywrap.o _SWIG_Python_GetSwigThis in pm3_pywrap.o _SwigPyObject_append in pm3_pywrap.o ... _PyType_Type, referenced from: _pm3_swigregister in pm3_pywrap.o _PyUnicode_AsUTF8String, referenced from: _SWIG_AsCharPtrAndSize in pm3_pywrap.o _PyUnicode_Concat, referenced from: _SwigPyObject_repr in pm3_pywrap.o _PyUnicode_DecodeFSDefault, referenced from: _Pm3PyRun_SimpleFileNoExit in cmdscript.o _PyUnicode_DecodeUTF8, referenced from: __wrap_pm3_name_get in pm3_pywrap.o _PyUnicode_FromFormat, referenced from: __wrap_new_pm3 in pm3_pywrap.o _SwigPyPacked_repr in pm3_pywrap.o _SwigPyPacked_str in pm3_pywrap.o _SwigPyObject_repr in pm3_pywrap.o _PyUnicode_FromString, referenced from: _set_python_path in cmdscript.o _PyInit__pm3 in pm3_pywrap.o _pm3_swiginit in pm3_pywrap.o _SWIG_Python_NewPointerObj in pm3_pywrap.o _SWIG_Python_NewPointerObj in pm3_pywrap.o _SWIG_pchar_descriptor in pm3_pywrap.o _SWIG_Python_GetSwigThis in pm3_pywrap.o ... _Py_DecRef, referenced from: _SwigPyObject_repr in pm3_pywrap.o _SwigPyObject_repr in pm3_pywrap.o _Py_Finalize, referenced from: _CmdScriptRun in cmdscript.o _Py_InitializeFromConfig, referenced from: _CmdScriptRun in cmdscript.o __PyObject_New, referenced from: _SWIG_Python_NewPointerObj in pm3_pywrap.o _SWIG_Python_NewPointerObj in pm3_pywrap.o _SWIG_Python_NewPointerObj in pm3_pywrap.o _SWIG_Python_NewPointerObj in pm3_pywrap.o _SwigPyObject_dealloc in pm3_pywrap.o __Py_Dealloc, referenced from: _Pm3PyRun_SimpleFileNoExit in cmdscript.o _Pm3PyRun_SimpleFileNoExit in cmdscript.o _Pm3PyRun_SimpleFileNoExit in cmdscript.o _Pm3PyRun_SimpleFileNoExit in cmdscript.o _Pm3PyRun_SimpleFileNoExit in cmdscript.o _Pm3PyRun_SimpleFileNoExit in cmdscript.o _Pm3PyRun_SimpleFileNoExit in cmdscript.o _Pm3PyRun_SimpleFileNoExit in cmdscript.o ... __Py_NoneStruct, referenced from: _Pm3PyRun_SimpleFileNoExit in cmdscript.o __wrap_delete_pm3 in pm3_pywrap.o __wrap_delete_pm3 in pm3_pywrap.o __wrap_pm3_name_get in pm3_pywrap.o __wrap_pm3_name_get in pm3_pywrap.o _pm3_swigregister in pm3_pywrap.o _pm3_swiginit in pm3_pywrap.o ... __Py_NotImplementedStruct, referenced from: _SwigPyObject_richcompare in pm3_pywrap.o _SwigPyObject_richcompare in pm3_pywrap.o clang: error: linker command failed with exit code 1 (use -v to see invocation) make[1]: *** [proxmark3] Error 1 make: *** [client/all] Error 2

Desktop (please complete the following information):

Additional context Tried reinstalling Python 3.12.2, 3.12.1 and 3.12.0 but issue remains.

iceman1001 commented 7 months ago

There was the same issue raised on the pm3 homebrew GH repo where was found to be related to 3.12. The current solution is to force python3 v3.11 dependency.

For OSx feel free to find a solution since we don't use it.

skorokithakis commented 7 months ago

I managed to compile with the following:

brew install python@3.11
diff --git a/client/Makefile b/client/Makefile
index 10929ffca..542a5cafa 100644
--- a/client/Makefile
+++ b/client/Makefile
@@ -269,8 +269,8 @@ endif

 ## Python3 (optional)
 ifneq ($(SKIPPYTHON),1)
-    PYTHONINCLUDES = $(shell $(PKG_CONFIG_ENV) pkg-config --cflags python3 2>/dev/null)
-    PYTHONLDLIBS = $(shell $(PKG_CONFIG_ENV) pkg-config --libs python3 2>/dev/null)
+    PYTHONINCLUDES = $(shell $(PKG_CONFIG_ENV) pkg-config --cflags python3.11 2>/dev/null)
+    PYTHONLDLIBS = $(shell $(PKG_CONFIG_ENV) pkg-config --libs python3.11 2>/dev/null)
     ifneq ($(PYTHONLDLIBS),)
         PYTHONLIBLD = $(PYTHONLDLIBS)
         PYTHONLIBINC = $(subst -I,-isystem ,$(PYTHONINCLUDES))
@@ -519,7 +519,7 @@ ifeq ($(SKIPPYTHON),1)
         $(info Python3 library:   skipped)
 else
     ifeq ($(PYTHON_FOUND),1)
-        $(info Python3 library:   Python3 v$(shell $(PKG_CONFIG_ENV) pkg-config --modversion python3) found, enabled)
+        $(info Python3 library:   Python3 v$(shell $(PKG_CONFIG_ENV) pkg-config --modversion python3.11) found, enabled)
     else
         $(info Python3 library:   Python3 not found, disabled)
     endif

It works (pm3 starts up, anyway, I didn't try to connect) after that.

AppleTechy commented 7 months ago

I ended up just compiling by running brew unlink python which reverted back to python 3.9.x that ships with MacOS. I was then able to successfully run the compile (brew install proxmark3) and then run brew link python to re- link to python 3.12.x

philicious commented 5 months ago

works with cmake ./client & make -j