首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在macOS中编译CPython失败

在macOS中编译CPython失败
EN

Stack Overflow用户
提问于 2019-05-21 21:19:33
回答 1查看 101关注 0票数 0

版本:macOS 10.14.4Apple LLVM version 10.0.1 (clang-1001.0.46.4)

我从GitHub克隆了CPython源代码,然后编译它,这在过去工作得很好。然而,我在几天前因为安装gdb而搞砸了我的终端。现在,当我尝试用./configure --with-pydebug && make -j编译CPython源代码时,我总是得到错误消息:

代码语言:javascript
复制
ld: warning: ld: warning: ignoring file libpython3.8d.a, file was built for archive which is not the architecture being linked (x86_64): libpython3.8d.aignoring file libpython3.8d.a, file was built for archive which is not the architecture being linked (x86_64): libpython3.8d.a

Undefined symbols for architecture x86_64:
  "__Py_UnixMain", referenced from:
      _main in python.o
ld: symbol(s) not found for architecture x86_64
Undefined symbols for architecture x86_64:
  "_PyEval_InitThreads", referenced from:
      _test_repeated_init_and_subinterpreters 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
  "_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
  "_PyInterpreterState_GetID", referenced from:
      _print_subinterp in _testembed.o
  "_PyMem_RawFree", referenced from:
      _test_pre_initialization_api in _testembed.o
  "_PyRun_SimpleStringFlags", referenced from:
      _test_pre_initialization_api in _testembed.o
      _test_pre_initialization_sys_options in _testembed.o
      _test_init_main in _testembed.o
      _check_stdio_details in _testembed.o
      _print_subinterp in _testembed.o
      _dump_config in _testembed.o
  "_PySys_AddWarnOption", referenced from:
      _test_pre_initialization_sys_options in _testembed.o
  "_PySys_AddXOption", referenced from:
      _test_pre_initialization_sys_options 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
      _print_subinterp 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
  "_Py_BytesWarningFlag", referenced from:
      _test_init_global_config in _testembed.o
      _test_init_from_config in _testembed.o
      _set_all_global_config_variables in _testembed.o
  "_Py_DebugFlag", referenced from:
      _set_all_global_config_variables in _testembed.o
  "_Py_DecodeLocale", referenced from:
      _test_pre_initialization_api in _testembed.o
  "_Py_DontWriteBytecodeFlag", referenced from:
      _test_init_global_config in _testembed.o
      _test_init_from_config in _testembed.o
      _set_all_global_config_variables in _testembed.o
      _check_init_python_config in _testembed.o
  "_Py_EndInterpreter", referenced from:
      _test_repeated_init_and_subinterpreters 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_default_config in _testembed.o
      ...
  "_Py_FrozenFlag", referenced from:
      _test_init_global_config in _testembed.o
      _test_init_from_config in _testembed.o
      _set_all_global_config_variables in _testembed.o
      _check_init_python_config in _testembed.o
  "_Py_IgnoreEnvironmentFlag", referenced from:
      _test_init_env in _testembed.o
      _test_init_env_dev_mode in _testembed.o
      _test_init_env_dev_mode_alloc in _testembed.o
      _set_all_global_config_variables in _testembed.o
      _check_init_python_config in _testembed.o
  "_Py_Initialize", referenced from:
      _test_forced_io_encoding in _testembed.o
      _test_pre_initialization_api in _testembed.o
      _test_initialize_twice in _testembed.o
      _test_init_global_config in _testembed.o
      __testembed_Py_Initialize in _testembed.o
  "_Py_InspectFlag", referenced from:
      _test_init_global_config in _testembed.o
      _test_init_from_config in _testembed.o
      _set_all_global_config_variables in _testembed.o
  "_Py_InteractiveFlag", referenced from:
      _test_init_global_config in _testembed.o
      _test_init_from_config in _testembed.o
      _set_all_global_config_variables in _testembed.o
  "_Py_IsolatedFlag", referenced from:
      _test_init_isolated_flag in _testembed.o
      _test_preinit_isolated2 in _testembed.o
      _set_all_global_config_variables in _testembed.o
      _check_init_python_config in _testembed.o
  "_Py_Main", referenced from:
      _test_initialize_pymain in _testembed.o
  "_Py_NewInterpreter", referenced from:
      _test_repeated_init_and_subinterpreters in _testembed.o
  "_Py_NoSiteFlag", referenced from:
      _test_init_global_config in _testembed.o
      _test_init_from_config in _testembed.o
      _set_all_global_config_variables 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
      _set_all_global_config_variables 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
      _set_all_global_config_variables in _testembed.o
  "_Py_QuietFlag", referenced from:
      _test_init_global_config in _testembed.o
      _test_init_from_config in _testembed.o
      _set_all_global_config_variables in _testembed.o
  "_Py_SetProgramName", referenced from:
      _test_pre_initialization_api in _testembed.o
      _test_init_global_config in _testembed.o
      _test_init_from_config in _testembed.o
      __testembed_Py_Initialize in _testembed.o
  "_Py_SetStandardStreamEncoding", referenced from:
      _test_forced_io_encoding in _testembed.o
      _test_init_from_config in _testembed.o
      _check_stdio_details 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
      _set_all_global_config_variables 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
      _set_all_global_config_variables in _testembed.o
  "__PyCoreConfig_Clear", referenced from:
      _test_preinit_parse_argv in _testembed.o
      _test_preinit_dont_parse_argv in _testembed.o
      _test_init_read_set in _testembed.o
      _test_run_main in _testembed.o
  "__PyCoreConfig_DecodeLocale", referenced from:
      _test_init_read_set in _testembed.o
  "__PyCoreConfig_Init", referenced from:
      _test_init_from_config in _testembed.o
      _test_preinit_isolated1 in _testembed.o
      _test_preinit_isolated2 in _testembed.o
  "__PyCoreConfig_InitIsolatedConfig", referenced from:
      _test_preinit_dont_parse_argv in _testembed.o
      _check_preinit_isolated_config in _testembed.o
  "__PyCoreConfig_InitPythonConfig", referenced from:
      _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
      _test_init_run_main in _testembed.o
      _test_init_main in _testembed.o
      ...
  "__PyCoreConfig_Read", referenced from:
      _test_init_read_set in _testembed.o
  "__PyCoreConfig_SetString", referenced from:
      _test_preinit_parse_argv in _testembed.o
      _test_preinit_dont_parse_argv in _testembed.o
      _test_init_read_set in _testembed.o
      _test_run_main in _testembed.o
  "__PyCoreConfig_SetWideArgv", referenced from:
      _test_preinit_parse_argv in _testembed.o
      _test_preinit_dont_parse_argv in _testembed.o
      _test_run_main in _testembed.o
  "__PyInitError_Failed", referenced from:
      _test_init_from_config 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
      _test_preinit_parse_argv in _testembed.o
      ...
  "__PyInitError_NoMemory", referenced from:
      _test_init_read_set in _testembed.o
  "__PyPreConfig_Init", referenced from:
      _test_init_from_config in _testembed.o
      _test_preinit_isolated1 in _testembed.o
      _test_preinit_isolated2 in _testembed.o
  "__PyPreConfig_InitIsolatedConfig", referenced from:
      _test_preinit_dont_parse_argv in _testembed.o
      _check_preinit_isolated_config in _testembed.o
  "__PyPreConfig_InitPythonConfig", referenced from:
      _test_init_dont_configure_locale in _testembed.o
      _check_init_python_config in _testembed.o
  "__PyRuntime", referenced from:
      _check_preinit_isolated_config in _testembed.o
  "__PyWstrList_Append", referenced from:
      _test_init_read_set in _testembed.o
  "__Py_ExitInitError", referenced from:
      _test_init_from_config 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
      _test_preinit_parse_argv in _testembed.o
      ...
  "__Py_InitializeFromConfig", referenced from:
      _test_init_from_config 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
      _test_preinit_parse_argv in _testembed.o
      ...
  "__Py_InitializeMain", referenced from:
      _test_init_main 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
      _check_preinit_isolated_config in _testembed.o
      _check_init_python_config in _testembed.o
  "__Py_PreInitializeFromWideArgs", referenced from:
      _test_preinit_dont_parse_argv in _testembed.o
  "__Py_RunMain", referenced from:
      _test_init_run_main in _testembed.o
      _test_init_main in _testembed.o
      _test_run_main in _testembed.o
ld: symbol(s) not found for architecture x86_64
clangclang: : errorerror: : linker command failed with exit code 1 (use -v to see invocation)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

我尝试运行make distclean并重置我的终端,但仍然不能工作。谢谢你的帮助。

EN

回答 1

Stack Overflow用户

发布于 2019-05-24 09:39:28

多亏了python-list中的稻田,我找到了一个post about it,看起来由于某种原因,arranlib并没有像预期的那样工作。我为这些工具创建了一些软链接:

代码语言:javascript
复制
ln -s /usr/bin/ranlib /usr/local/bin/ranlib

ln -s /usr/bin/ar /usr/local/bin/ar

然后一切都会按预期进行。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56239229

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档