Build Python "symbol(s) not found for architecture arm64" on m1
when I build python on macOS m1, found error under: ERROR: clang -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/readline/lib -L/Users/jokky/.pyenv/versions/3.10.6/lib -L/opt/homebrew/lib -Wl,-rpath,/opt/homebrew/lib -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/readline/lib -L/Users/jokky/.pyenv/versions/3.10.6/lib -L/opt/homebrew/lib -Wl,-rpath,/opt/homebrew/lib -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -Wl,-stack_size,1000000 -framework CoreFoundation -o Programs/_testembed Programs/_testembed.o libpython3.10.a -ldl -L/opt/homebrew/lib -Wl,-rpath,/opt/homebrew/lib -framework CoreFoundation Undefined symbols for architecture arm64: "_libintl_bindtextdomain", referenced from: Undefined symbols for architecture arm64: "_libintl_bindtextdomain", referenced from: __locale_bindtextdomain in libpython3.10.a(_localemodule.o) __locale_bindtextdomain in libpython3.10.a(_localemodule.o) "_libintl_dcgettext", referenced from: "_libintl_dcgettext", referenced from: __locale_dcgettext in libpython3.10.a(_localemodule.o) __locale_dcgettext in libpython3.10.a(_localemodule.o) "_libintl_dgettext", referenced from: "_libintl_dgettext", referenced from: __locale_dgettext in libpython3.10.a(_localemodule.o) __locale_dgettext in libpython3.10.a(_localemodule.o) "_libintl_gettext", referenced from: "_libintl_gettext", referenced from: __locale_gettext in libpython3.10.a(_localemodule.o) __locale_gettext in libpython3.10.a(_localemodule.o) "_libintl_setlocale", referenced from: "_libintl_setlocale", referenced from: __locale_setlocale in libpython3.10.a(_localemodule.o) __locale_localeconv in libpython3.10.a(_localemodule.o) __locale_setlocale in libpython3.10.a(_localemodule.o) __locale_localeconv in libpython3.10.a(_localemodule.o) "_libintl_textdomain", referenced from: "_libintl_textdomain", referenced from: __locale_textdomain in libpython3.10.a(_localemodule.o) __locale_textdomain in libpython3.10.a(_localemodule.o) ld: symbol(s) not found for architecture arm64 ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [Programs/_testembed] Error 1 make: *** Waiting for unfinished jobs.... make: *** [python.exe] Error 1 +++(/usr/local/Cellar/pyenv/2.3.3/plugins/python-build/bin/python-build:749): build_package_standarbuild_failed
- [x] Platform information :(macOS X 12.4)
- [x] OS architecture :(Darwin arm64)
- [x] pyenv version: 2.3.3
- [x] Python version: 3.10.6
- [x] C Compiler information (Apple clang version 13.1.6 (clang-1316.0.21.2.5) [arm64-apple-darwin21.5.0):]
- [x] Please attach the debug trace of the failing command as a gist:
- Run
env PYENV_DEBUG=1 <faulty command> 2>&1 | tee trace.logand attachtrace.log. E.g. if you have a problem with installing Python, runenv PYENV_DEBUG=1 pyenv install -v <version> 2>&1 | tee trace.log(note the-voption topyenv install).
- Run
You're trying to build for Arm64 but are using Pyenv from an x64 Homebrew installation.
As a rule, you should have the same installation of Homebrew in PATH as your current architecture, use Pyenv from that installation, and set PYENV_ROOT differently depending on architecture to avoid mixing up stuff for the two architectures. (See https://github.com/pyenv/pyenv/issues/1853#issuecomment-847827280 and https://github.com/pyenv/pyenv/issues/1853#issuecomment-847886256 for an example.)
Regardless, in the log, I do see that Pyenv adds the correct compiler switches to use libs from the Arm64 Homebrew. So it seems strange that ld picks a wrong instance of libintl.
Do you have gettext in the Arm64 Homebrew installed and linked? There should be a libintl*.so in /opt/homebrew/lib, built for the Arm64 architecture.
If you have it, check if it has the exported symbols that the linker complains about.
@native-api a similar error😭, any hint? it has been disturbing me for months. i've checked all binaries in the builds folder, dont know which object is in an unknown format as it said
ar rcs libpython3.10.a Modules/getbuildinfo.o Parser/token.o Parser/pegen.o Parser/parser.o Parser/string_parser.o Parser/peg_api.o Parser/myreadline.o Parser/tokenizer.o Objects/abstract.o Objects/accu.o Objects/boolobject.o Objects/bytes_methods.o Objects/bytearrayobject.o Objects/bytesobject.o Objects/call.o Objects/capsule.o Objects/cellobject.o Objects/classobject.o Objects/codeobject.o Objects/complexobject.o Objects/descrobject.o Objects/enumobject.o Objects/exceptions.o Objects/genericaliasobject.o Objects/genobject.o Objects/fileobject.o Objects/floatobject.o Objects/frameobject.o Objects/funcobject.o Objects/interpreteridobject.o Objects/iterobject.o Objects/listobject.o Objects/longobject.o Objects/dictobject.o Objects/odictobject.o Objects/memoryobject.o Objects/methodobject.o Objects/moduleobject.o Objects/namespaceobject.o Objects/object.o Objects/obmalloc.o Objects/picklebufobject.o Objects/rangeobject.o Objects/setobject.o Objects/sliceobject.o Objects/structseq.o Objects/tupleobject.o Objects/typeobject.o Objects/unicodeobject.o Objects/unicodectype.o Objects/unionobject.o Objects/weakrefobject.o Python/_warnings.o Python/Python-ast.o Python/asdl.o Python/ast.o Python/ast_opt.o Python/ast_unparse.o Python/bltinmodule.o Python/ceval.o Python/codecs.o Python/compile.o Python/context.o Python/dynamic_annotations.o Python/errors.o Python/frozenmain.o Python/future.o Python/getargs.o Python/getcompiler.o Python/getcopyright.o Python/getplatform.o Python/getversion.o Python/hamt.o Python/hashtable.o Python/import.o Python/importdl.o Python/initconfig.o Python/marshal.o Python/modsupport.o Python/mysnprintf.o Python/mystrtoul.o Python/pathconfig.o Python/preconfig.o Python/pyarena.o Python/pyctype.o Python/pyfpe.o Python/pyhash.o Python/pylifecycle.o Python/pymath.o Python/pystate.o Python/pythonrun.o Python/pytime.o Python/bootstrap_hash.o Python/structmember.o Python/symtable.o Python/sysmodule.o Python/thread.o Python/traceback.o Python/getopt.o Python/pystrcmp.o Python/pystrtod.o Python/pystrhex.o Python/dtoa.o Python/formatter_unicode.o Python/fileutils.o Python/suggestions.o Python/dynload_shlib.o Modules/config.o Modules/getpath.o Modules/main.o Modules/gcmodule.o Modules/posixmodule.o Modules/errnomodule.o Modules/pwdmodule.o Modules/_sre.o Modules/_codecsmodule.o Modules/_weakref.o Modules/_functoolsmodule.o Modules/_operator.o Modules/_collectionsmodule.o Modules/_abc.o Modules/itertoolsmodule.o Modules/atexitmodule.o Modules/signalmodule.o Modules/_stat.o Modules/timemodule.o Modules/_threadmodule.o Modules/_localemodule.o Modules/_iomodule.o Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o Modules/textio.o Modules/stringio.o Modules/faulthandler.o Modules/_tracemalloc.o Modules/symtablemodule.o Modules/xxsubtype.o Python/frozen.o
clang -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/readline/lib -L/Users/kino/.pyenv/versions/3.10.4/lib -L/opt/homebrew/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/readline/lib -L/Users/kino/.pyenv/versions/3.10.4/lib -L/opt/homebrew/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib -Wl,-stack_size,1000000 -framework CoreFoundation -o python.exe Programs/python.o libpython3.10.a -lintl -ldl -framework CoreFoundation
clang -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/readline/lib -L/Users/kino/.pyenv/versions/3.10.4/lib -L/opt/homebrew/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/readline/lib -L/Users/kino/.pyenv/versions/3.10.4/lib -L/opt/homebrew/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib -Wl,-stack_size,1000000 -framework CoreFoundation -o Programs/_testembed Programs/_testembed.o libpython3.10.a -lintl -ldl -framework CoreFoundation
ld: warning: directory not found for option '-L/Users/kino/.pyenv/versions/3.10.4/lib'
ld: warning: directory not found for option '-L/Users/kino/.pyenv/versions/3.10.4/lib'
ld: warning: directory not found for option '-L/Users/kino/.pyenv/versions/3.10.4/lib'
ld: warning: directory not found for option '-L/Users/kino/.pyenv/versions/3.10.4/lib'
ld: warning: ignoring file libpython3.10.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file libpython3.10.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
Undefined symbols for architecture arm64:
"_Py_BytesMain", referenced from:
_main in python.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Undefined symbols for architecture arm64:
"_PyArg_ParseTuple", referenced from:
__audit_hook in _testembed.o
"_PyConfig_Clear", referenced from:
_test_repeated_init_and_inittab in _testembed.o
_test_init_from_config in _testembed.o
_test_init_python_env in _testembed.o
_test_init_dont_configure_locale in _testembed.o
_test_init_dev_mode in _testembed.o
_test_init_isolated_flag in _testembed.o
_test_preinit_isolated1 in _testembed.o
...
"_PyConfig_InitIsolatedConfig", referenced from:
_test_preinit_dont_parse_argv in _testembed.o
_test_init_set_config in _testembed.o
_check_preinit_isolated_config in _testembed.o
"_PyConfig_InitPythonConfig", referenced from:
_test_repeated_init_and_inittab in _testembed.o
_test_init_python_env in _testembed.o
_test_init_dont_configure_locale in _testembed.o
_test_init_dev_mode in _testembed.o
_test_init_isolated_flag in _testembed.o
_test_preinit_parse_argv in _testembed.o
_test_init_read_set in _testembed.o
...
"_PyConfig_Read", referenced from:
_test_init_read_set in _testembed.o
_test_init_warnoptions in _testembed.o
_test_get_argc_argv in _testembed.o
"_PyConfig_SetArgv", referenced from:
_test_repeated_init_and_inittab in _testembed.o
_test_init_from_config in _testembed.o
_test_preinit_parse_argv in _testembed.o
_test_preinit_dont_parse_argv in _testembed.o
_test_init_run_main in _testembed.o
_test_init_main in _testembed.o
_test_init_sys_add in _testembed.o
...
"_PyConfig_SetBytesString", referenced from:
_test_init_from_config in _testembed.o
_test_init_read_set in _testembed.o
"_PyConfig_SetString", referenced from:
_test_init_from_config in _testembed.o
_test_init_python_env in _testembed.o
_test_init_dont_configure_locale in _testembed.o
_test_init_dev_mode in _testembed.o
_test_init_isolated_flag in _testembed.o
_test_preinit_isolated1 in _testembed.o
_test_preinit_isolated2 in _testembed.o
...
"_PyConfig_SetWideStringList", referenced from:
_test_init_from_config in _testembed.o
"_PyErr_Clear", referenced from:
_test_audit in _testembed.o
"_PyErr_Format", referenced from:
__audit_hook_run in _testembed.o
"_PyErr_Occurred", referenced from:
_test_audit in _testembed.o
"_PyErr_Print", referenced from:
_test_init_set_config in _testembed.o
_test_open_code_hook in _testembed.o
_test_audit in _testembed.o
"_PyErr_SetString", referenced from:
__audit_hook in _testembed.o
"_PyEval_ReleaseThread", referenced from:
_test_repeated_init_and_subinterpreters in _testembed.o
"_PyEval_RestoreThread", referenced from:
_test_repeated_init_and_subinterpreters in _testembed.o
_test_bpo20891 in _testembed.o
"_PyEval_SaveThread", referenced from:
_test_bpo20891 in _testembed.o
"_PyExc_RuntimeError", referenced from:
__audit_hook in _testembed.o
__audit_hook_run in _testembed.o
"_PyFile_OpenCode", referenced from:
_test_open_code_hook in _testembed.o
"_PyFile_SetOpenCodeHook", referenced from:
_test_open_code_hook in _testembed.o
"_PyGILState_Check", referenced from:
_bpo20891_thread in _testembed.o
"_PyGILState_Ensure", referenced from:
_test_repeated_init_and_subinterpreters in _testembed.o
_bpo20891_thread in _testembed.o
"_PyGILState_Release", referenced from:
_test_repeated_init_and_subinterpreters in _testembed.o
_bpo20891_thread in _testembed.o
"_PyImport_AppendInittab", referenced from:
_test_repeated_init_and_inittab in _testembed.o
"_PyImport_FrozenModules", referenced from:
_list_frozen in _testembed.o
"_PyImport_ImportModule", referenced from:
_test_open_code_hook in _testembed.o
__open_code_hook in _testembed.o
"_PyInterpreterState_GetID", referenced from:
_test_repeated_init_and_subinterpreters in _testembed.o
"_PyLong_AsVoidPtr", referenced from:
_test_open_code_hook in _testembed.o
"_PyLong_FromVoidPtr", referenced from:
__open_code_hook in _testembed.o
"_PyMem_RawFree", referenced from:
_test_pre_initialization_api in _testembed.o
_test_init_setpath in _testembed.o
_test_init_setpath_config in _testembed.o
_test_init_setpythonhome in _testembed.o
"_PyModule_Create2", referenced from:
_PyInit_embedded_ext in _testembed.o
"_PyObject_CallMethod", referenced from:
_test_open_code_hook in _testembed.o
__open_code_hook in _testembed.o
"_PyPreConfig_InitIsolatedConfig", referenced from:
_test_preinit_dont_parse_argv in _testembed.o
make: *** [python.exe] Error 1
_check_preinit_isolated_config in _testembed.o
"_PyPreConfig_InitPythonConfig", referenced from:
make: *** Waiting for unfinished jobs....
_test_init_dont_configure_locale in _testembed.o
_test_init_setpath_config in _testembed.o
_check_init_python_config in _testembed.o
"_PyRun_SimpleStringFlags", referenced from:
_test_forced_io_encoding in _testembed.o
_test_repeated_init_and_subinterpreters in _testembed.o
_test_pre_initialization_api in _testembed.o
_test_pre_initialization_sys_options in _testembed.o
_test_init_initialize_config in _testembed.o
_test_init_global_config in _testembed.o
_test_init_from_config in _testembed.o
...
"_PyStatus_Exception", referenced from:
_test_repeated_init_and_inittab in _testembed.o
_test_init_from_config in _testembed.o
_test_init_python_env in _testembed.o
_test_init_dont_configure_locale in _testembed.o
_test_init_dev_mode in _testembed.o
_test_init_isolated_flag in _testembed.o
_test_preinit_isolated1 in _testembed.o
...
"_PySys_AddAuditHook", referenced from:
_test_audit in _testembed.o
_test_audit_subinterpreter in _testembed.o
_test_audit_run_command in _testembed.o
_test_audit_run_file in _testembed.o
_run_audit_run_test in _testembed.o
"_PySys_AddWarnOption", referenced from:
_test_pre_initialization_sys_options in _testembed.o
_test_init_sys_add in _testembed.o
_test_init_warnoptions in _testembed.o
"_PySys_AddXOption", referenced from:
_test_pre_initialization_sys_options in _testembed.o
_test_init_sys_add in _testembed.o
"_PySys_Audit", referenced from:
_test_audit in _testembed.o
"_PySys_ResetWarnOptions", referenced from:
_test_pre_initialization_sys_options in _testembed.o
"_PyThreadState_Get", referenced from:
_test_repeated_init_and_subinterpreters in _testembed.o
"_PyThreadState_Swap", referenced from:
_test_repeated_init_and_subinterpreters in _testembed.o
"_PyThread_acquire_lock", referenced from:
_test_bpo20891 in _testembed.o
"_PyThread_allocate_lock", referenced from:
_test_bpo20891 in _testembed.o
"_PyThread_exit_thread", referenced from:
_bpo20891_thread in _testembed.o
"_PyThread_free_lock", referenced from:
_test_bpo20891 in _testembed.o
"_PyThread_release_lock", referenced from:
_bpo20891_thread in _testembed.o
"_PyThread_start_new_thread", referenced from:
_test_bpo20891 in _testembed.o
"_PyTuple_Type", referenced from:
__audit_hook in _testembed.o
"_PyUnicode_AsUTF8", referenced from:
__audit_hook_run in _testembed.o
"_PyUnicode_Compare", referenced from:
_test_unicode_id_init in _testembed.o
"_PyUnicode_CompareWithASCIIString", referenced from:
__open_code_hook in _testembed.o
"_PyUnicode_FromFormat", referenced from:
__audit_hook_run in _testembed.o
"_PyUnicode_FromString", referenced from:
_test_unicode_id_init in _testembed.o
"_PyWideStringList_Append", referenced from:
_test_init_read_set in _testembed.o
_test_init_sys_add in _testembed.o
_test_init_warnoptions in _testembed.o
"_PyWideStringList_Insert", referenced from:
_test_init_read_set in _testembed.o
_test_init_warnoptions in _testembed.o
"_Py_BytesWarningFlag", referenced from:
_test_init_global_config in _testembed.o
_test_init_from_config in _testembed.o
_check_preinit_isolated_config in _testembed.o
_check_init_python_config in _testembed.o
"_Py_DebugFlag", referenced from:
_check_preinit_isolated_config in _testembed.o
_check_init_python_config in _testembed.o
"_Py_DecodeLocale", referenced from:
_test_pre_initialization_api in _testembed.o
_test_init_setpath in _testembed.o
_test_init_setpath_config in _testembed.o
_test_init_setpythonhome in _testembed.o
"_Py_DontWriteBytecodeFlag", referenced from:
_test_init_global_config in _testembed.o
_test_init_from_config in _testembed.o
_check_preinit_isolated_config in _testembed.o
_check_init_python_config in _testembed.o
"_Py_EndInterpreter", referenced from:
_test_repeated_init_and_subinterpreters in _testembed.o
"_Py_ExitStatusException", referenced from:
_test_repeated_init_and_inittab in _testembed.o
_test_init_from_config in _testembed.o
_test_init_python_env in _testembed.o
_test_init_dont_configure_locale in _testembed.o
_test_init_dev_mode in _testembed.o
_test_init_isolated_flag in _testembed.o
_test_preinit_isolated1 in _testembed.o
...
"_Py_Finalize", referenced from:
_test_forced_io_encoding in _testembed.o
_test_repeated_init_and_subinterpreters in _testembed.o
_test_pre_initialization_api in _testembed.o
_test_pre_initialization_sys_options in _testembed.o
_test_initialize_twice in _testembed.o
_test_initialize_pymain in _testembed.o
_test_init_initialize_config in _testembed.o
...
"_Py_FrozenFlag", referenced from:
_test_init_global_config in _testembed.o
_test_init_from_config in _testembed.o
_check_preinit_isolated_config in _testembed.o
_check_init_python_config in _testembed.o
"_Py_GetArgcArgv", referenced from:
_test_get_argc_argv in _testembed.o
"_Py_IgnoreEnvironmentFlag", referenced from:
_test_init_compat_env in _testembed.o
_test_init_env_dev_mode in _testembed.o
_test_init_env_dev_mode_alloc in _testembed.o
_test_open_code_hook in _testembed.o
_test_audit in _testembed.o
_test_audit_subinterpreter in _testembed.o
_test_audit_run_command in _testembed.o
...
"_Py_Initialize", referenced from:
_test_forced_io_encoding in _testembed.o
_test_repeated_init_and_subinterpreters in _testembed.o
_test_pre_initialization_api in _testembed.o
_test_pre_initialization_sys_options in _testembed.o
_test_bpo20891 in _testembed.o
_test_initialize_twice in _testembed.o
_test_initialize_pymain in _testembed.o
...
"_Py_InitializeFromConfig", referenced from:
_test_repeated_init_and_inittab in _testembed.o
_test_init_from_config in _testembed.o
_test_init_python_env in _testembed.o
_test_init_dont_configure_locale in _testembed.o
_test_init_dev_mode in _testembed.o
_test_init_isolated_flag in _testembed.o
_test_preinit_isolated1 in _testembed.o
...
"_Py_InspectFlag", referenced from:
_test_init_global_config in _testembed.o
_test_init_from_config in _testembed.o
_check_preinit_isolated_config in _testembed.o
_check_init_python_config in _testembed.o
"_Py_InteractiveFlag", referenced from:
_test_init_global_config in _testembed.o
_test_init_from_config in _testembed.o
_check_preinit_isolated_config in _testembed.o
_check_init_python_config in _testembed.o
"_Py_IsolatedFlag", referenced from:
_test_init_isolated_flag in _testembed.o
_test_preinit_isolated2 in _testembed.o
_check_preinit_isolated_config in _testembed.o
_check_init_python_config in _testembed.o
"_Py_Main", referenced from:
_test_initialize_pymain in _testembed.o
_test_audit_run_command in _testembed.o
_test_audit_run_file in _testembed.o
"_Py_NewInterpreter", referenced from:
_test_repeated_init_and_subinterpreters in _testembed.o
_test_audit_subinterpreter in _testembed.o
"_Py_NoSiteFlag", referenced from:
_test_init_global_config in _testembed.o
_test_init_from_config in _testembed.o
_check_preinit_isolated_config in _testembed.o
_check_init_python_config in _testembed.o
"_Py_NoUserSiteDirectory", referenced from:
_test_init_global_config in _testembed.o
_test_init_from_config in _testembed.o
_check_preinit_isolated_config in _testembed.o
_check_init_python_config in _testembed.o
"_Py_OptimizeFlag", referenced from:
_test_init_global_config in _testembed.o
_test_init_from_config in _testembed.o
_check_preinit_isolated_config in _testembed.o
_check_init_python_config in _testembed.o
"_Py_PreInitialize", referenced from:
_test_init_from_config in _testembed.o
_test_init_dont_configure_locale in _testembed.o
_test_preinit_isolated1 in _testembed.o
_test_preinit_isolated2 in _testembed.o
_test_init_setpath_config in _testembed.o
_check_init_compat_config in _testembed.o
_check_preinit_isolated_config in _testembed.o
...
"_Py_PreInitializeFromArgs", referenced from:
_test_preinit_dont_parse_argv in _testembed.o
"_Py_QuietFlag", referenced from:
_test_init_global_config in _testembed.o
_test_init_from_config in _testembed.o
_check_preinit_isolated_config in _testembed.o
_check_init_python_config in _testembed.o
"_Py_RunMain", referenced from:
_test_repeated_init_and_inittab in _testembed.o
_test_init_run_main in _testembed.o
_test_init_main in _testembed.o
_test_run_main in _testembed.o
_run_audit_run_test in _testembed.o
"_Py_SetPath", referenced from:
_test_init_setpath in _testembed.o
_test_init_setpath_config in _testembed.o
"_Py_SetProgramName", referenced from:
_test_forced_io_encoding in _testembed.o
_test_repeated_init_and_subinterpreters in _testembed.o
_test_pre_initialization_api in _testembed.o
_test_pre_initialization_sys_options in _testembed.o
_test_bpo20891 in _testembed.o
_test_initialize_twice in _testembed.o
_test_initialize_pymain in _testembed.o
...
"_Py_SetPythonHome", referenced from:
_test_init_setpythonhome in _testembed.o
"_Py_SetStandardStreamEncoding", referenced from:
_test_forced_io_encoding in _testembed.o
_test_init_from_config in _testembed.o
"_Py_UTF8Mode", referenced from:
_test_init_global_config in _testembed.o
_test_init_from_config in _testembed.o
"_Py_UnbufferedStdioFlag", referenced from:
_test_init_global_config in _testembed.o
_test_init_from_config in _testembed.o
_check_preinit_isolated_config in _testembed.o
_check_init_python_config in _testembed.o
"_Py_VerboseFlag", referenced from:
_test_init_global_config in _testembed.o
_test_init_from_config in _testembed.o
_check_preinit_isolated_config in _testembed.o
_check_init_python_config in _testembed.o
"__PyConfig_InitCompatConfig", referenced from:
_test_init_from_config in _testembed.o
_test_preinit_isolated1 in _testembed.o
_test_preinit_isolated2 in _testembed.o
_check_init_compat_config in _testembed.o
"__PyInterpreterState_GetConfigCopy", referenced from:
_test_init_set_config in _testembed.o
"__PyInterpreterState_SetConfig", referenced from:
_test_init_set_config in _testembed.o
"__PyPreConfig_InitCompatConfig", referenced from:
_test_init_from_config in _testembed.o
_test_preinit_isolated1 in _testembed.o
_test_preinit_isolated2 in _testembed.o
_check_init_compat_config in _testembed.o
"__PyRuntime", referenced from:
_check_preinit_isolated_config in _testembed.o
"__PyUnicode_FromId", referenced from:
_test_unicode_id_init in _testembed.o
"__Py_Dealloc", referenced from:
_test_open_code_hook in _testembed.o
_test_unicode_id_init in _testembed.o
__audit_hook_run in _testembed.o
"__Py_InitializeMain", referenced from:
_test_init_main in _testembed.o
_test_init_set_config in _testembed.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Programs/_testembed] Error 1
OHHH its the problem of ar!! Some uninstalling remaining replaced my ar executable!
Colleagues, i have a same task.
$ pyenv install 3.9.1
...
BUILD FAILED (OS X 12.5 using python-build 20180424)
Inspect or clean up the working tree at /var/folders/ff/5wj2knrd1jd3_rfz31f4gfth0000gq/T/python-build.20220912182823.29434
Results logged to /var/folders/ff/5wj2knrd1jd3_rfz31f4gfth0000gq/T/python-build.20220912182823.29434.log
Last 10 log lines:
if test $? -ne 0 ; then \
echo "generate-posix-vars failed" ; \
rm -f ./pybuilddir.txt ; \
exit 1 ; \
fi
CC='clang' LDSHARED='clang -bundle -undefined dynamic_lookup -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/readline/lib -L/Users/{system_nick}/.pyenv/versions/3.9.1/lib -L/opt/homebrew/lib -Wl,-rpath,/opt/homebrew/lib -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/readline/lib -L/Users/{system_nick}/.pyenv/versions/3.9.1/lib -L/opt/homebrew/lib -Wl,-rpath,/opt/homebrew/lib -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib ' OPT='-DNDEBUG -g -fwrapv -O3 -Wall' _TCLTK_INCLUDES='' _TCLTK_LIBS='' ./python.exe -E ./setup.py build
running build
running build_ext
error: [Errno 13] Permission denied: '/tmp/_osx_support.38637'
make: *** [sharedmods] Error 1
My MacOS version: 12.5 (21G72)
@joshfriend , perhaps you could take a look as the one with the hardware?
You're trying to build for Arm64 but are using Pyenv from an x64 Homebrew installation.
As a rule, you should have the same installation of Homebrew in PATH as your current architecture, use Pyenv from that installation, and set
PYENV_ROOTdifferently depending on architecture to avoid mixing up stuff for the two architectures. (See #1853 (comment) and #1853 (comment) for an example.)Regardless, in the log, I do see that Pyenv adds the correct compiler switches to use libs from the Arm64 Homebrew. So it seems strange that
ldpicks a wrong instance oflibintl.Do you have
gettextin the Arm64 Homebrew installed and linked? There should be alibintl*.soin/opt/homebrew/lib, built for the Arm64 architecture.If you have it, check if it has the exported symbols that the linker complains about.
Before I ask the question, I had try the way. But the arch 64 builds failed!
@Jokky6 seems like the solution is here: https://github.com/pyenv/pyenv/issues/1348#issuecomment-514057168 see the second part (updated)
Without the required diagnostic information as per the issue tempalte, we cannot diagnose an issue.