M1-Mac配置Jittor环境-遇到的问题

在M1芯片的Mac上安装Jittor,在运行python -m jittor.test.test_example进行测试时出现问题,完整log如下;在本论坛上找到了相关问题讨论(https://discuss.jittor.org/t/topic/245),得知是libomp和onednn安装有问题,因为无法在/opt/homebrew/lib下查找到libomp.dylib;对此想请教如何解决。

ld: library not found for -lomp
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Traceback (most recent call last):
File “/opt/miniconda3/envs/jittor/lib/python3.8/runpy.py”, line 185, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File “/opt/miniconda3/envs/jittor/lib/python3.8/runpy.py”, line 111, in _get_module_details
import(pkg_name)
File “/opt/miniconda3/envs/jittor/lib/python3.8/site-packages/jittor/init.py”, line 18, in
from . import compiler
File “/opt/miniconda3/envs/jittor/lib/python3.8/site-packages/jittor/compiler.py”, line 1180, in
check_cache_compile()
File “/opt/miniconda3/envs/jittor/lib/python3.8/site-packages/jittor/compiler.py”, line 884, in check_cache_compile
recompile = compile(cc_path, cc_flags+f" {opt_flags} “, files, jit_utils.cache_path+‘/jit_utils_core’+extension_suffix, True)
File “/opt/miniconda3/envs/jittor/lib/python3.8/site-packages/jittor/compiler.py”, line 126, in compile
return do_compile(fix_cl_flags(cmd))
File “/opt/miniconda3/envs/jittor/lib/python3.8/site-packages/jittor/compiler.py”, line 91, in do_compile
run_cmd(cmd)
File “/opt/miniconda3/envs/jittor/lib/python3.8/site-packages/jittor_utils/init.py”, line 188, in run_cmd
raise Exception(err_msg)
Exception: Run cmd failed: “/usr/bin/g++” “/opt/miniconda3/envs/jittor/lib/python3.8/site-packages/jittor/src/utils/cache_compile.cc” “/opt/miniconda3/envs/jittor/lib/python3.8/site-packages/jittor/src/utils/log.cc” “/opt/miniconda3/envs/jittor/lib/python3.8/site-packages/jittor/src/utils/tracer.cc” “/opt/miniconda3/envs/jittor/lib/python3.8/site-packages/jittor/src/utils/jit_utils.cc” “/opt/miniconda3/envs/jittor/lib/python3.8/site-packages/jittor/src/utils/str_utils.cc” -Wall -Wno-unknown-pragmas -std=c++14 -fPIC -mcpu=apple-a14 -fdiagnostics-color=always -I/opt/homebrew/include -lstdc++ -ldl -shared -undefined dynamic_lookup -lomp -L/opt/miniconda3/envs/jittor/lib -Wl,-rpath,/opt/miniconda3/envs/jittor/lib -L/opt/homebrew/lib -Wl,-rpath,/opt/homebrew/lib -I”/opt/miniconda3/envs/jittor/lib/python3.8/site-packages/jittor/src" -I/opt/miniconda3/envs/jittor/include/python3.8 -I/opt/miniconda3/envs/jittor/include/python3.8 -O2 -o “/Users/stian/.cache/jittor/jt1.3.5/g++14.0.0/py3.8.15/macOS-13.0.1-ax30/AppleM1Pro/default/jit_utils_core.cpython-38-darwin.so”

1 Like

你好,

我们已经复现了这个问题,并找到了原因。近期 homebrew 安装 libomp 的动态链接库和头文件位置发生了变化,因此 Jittor 找不到对应的位置。

我们已经更新了 Jittor 至 1.3.5.44 版本,目前已经可以正常编译。您可以用 python3 -m pip install -U jittor 升级 Jittor。

感谢您的反馈!

1 Like