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

Error compiling on macOS related to Python #2305

Closed
dotdeas opened this issue Feb 26, 2024 · 4 comments · Fixed by #2352
Closed

Error compiling on macOS related to Python #2305

dotdeas opened this issue Feb 26, 2024 · 4 comments · Fixed by #2352

Comments

@dotdeas
Copy link

dotdeas commented Feb 26, 2024

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):

  • OS: macOS 14.3.1 (M1)

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

@iceman1001
Copy link
Collaborator

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
Copy link

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
Copy link

AppleTechy commented Mar 7, 2024

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
Copy link
Contributor

works with cmake ./client & make -j

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

Successfully merging a pull request may close this issue.

5 participants