HIT-SCIR / pyltp

pyltp: the python extension for LTP
1.53k stars 352 forks source link

mac10.15无法编译 #225

Closed eheroqiu closed 4 years ago

eheroqiu commented 4 years ago

问题类型

构建失败

出错场景

无法从源码编译,cmake版本已经最新了

代码片段

-- Configuring incomplete, errors occurred! See also "/Users/ballray/opt/anaconda3/lib/python3.7/site-packages/pyltp/build/temp.macosx-10.9-x86_64-3.7/CMakeFiles/CMakeOutput.log". See also "/Users/ballray/opt/anaconda3/lib/python3.7/site-packages/pyltp/build/temp.macosx-10.9-x86_64-3.7/CMakeFiles/CMakeError.log". Traceback (most recent call last): File "setup.py", line 93, in cmdclass=dict(build_ext=CMakeBuild) File "/Users/ballray/opt/anaconda3/lib/python3.7/site-packages/setuptools/init.py", line 161, in setup return distutils.core.setup(**attrs) File "/Users/ballray/opt/anaconda3/lib/python3.7/distutils/core.py", line 148, in setup dist.run_commands() File "/Users/ballray/opt/anaconda3/lib/python3.7/distutils/dist.py", line 966, in run_commands self.run_command(cmd) File "/Users/ballray/opt/anaconda3/lib/python3.7/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/Users/ballray/opt/anaconda3/lib/python3.7/site-packages/setuptools/command/install.py", line 67, in run self.do_egg_install() File "/Users/ballray/opt/anaconda3/lib/python3.7/site-packages/setuptools/command/install.py", line 109, in do_egg_install self.run_command('bdist_egg') File "/Users/ballray/opt/anaconda3/lib/python3.7/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/Users/ballray/opt/anaconda3/lib/python3.7/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/Users/ballray/opt/anaconda3/lib/python3.7/site-packages/setuptools/command/bdist_egg.py", line 173, in run cmd = self.call_command('install_lib', warn_dir=0) File "/Users/ballray/opt/anaconda3/lib/python3.7/site-packages/setuptools/command/bdist_egg.py", line 159, in call_command self.run_command(cmdname) File "/Users/ballray/opt/anaconda3/lib/python3.7/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/Users/ballray/opt/anaconda3/lib/python3.7/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/Users/ballray/opt/anaconda3/lib/python3.7/site-packages/setuptools/command/install_lib.py", line 11, in run self.build() File "/Users/ballray/opt/anaconda3/lib/python3.7/distutils/command/install_lib.py", line 107, in build self.run_command('build_ext') File "/Users/ballray/opt/anaconda3/lib/python3.7/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/Users/ballray/opt/anaconda3/lib/python3.7/distutils/dist.py", line 985, in run_command cmd_obj.run() File "setup.py", line 33, in run self.build_extension(ext) File "setup.py", line 58, in build_extension subprocess.check_call(['cmake', ext.sourcedir] + cmake_args, cwd=self.build_temp, env=env) File "/Users/ballray/opt/anaconda3/lib/python3.7/subprocess.py", line 347, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['cmake', '/Users/ballray/opt/anaconda3/lib/python3.7/site-packages/pyltp', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/Users/ballray/opt/anaconda3/lib/python3.7/site-packages/pyltp/build/lib.macosx-10.9-x86_64-3.7', '-DPYTHON_EXECUTABLE=/Users/ballray/opt/anaconda3/bin/python', '-DCMAKE_BUILD_TYPE=Release']' returned non-zero exit status 1.

如何复现这一错误

运行环境

python37 mac10.15

期望结果

期望解决

其他

AlongWY commented 4 years ago

编译命令是什么呢? 我使用 python setup.py bdist_wheel 构建成功 无法复现?

eheroqiu commented 4 years ago

Python setup.py bidist_wheel
和 install 均失败了 一样的错误

2020年8月6日 下午5:14,Along notifications@github.com 写道:

编译命令是什么呢? 我使用 python setup.py bdist_wheel 构建成功

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/HIT-SCIR/pyltp/issues/225#issuecomment-669812208, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFSTKBVES72GIKMLHJMZXPTR7JX7DANCNFSM4PWLJBMA.

AlongWY commented 4 years ago

编译器版本是多少呢,我在 clang 11.0 下编译成功

eheroqiu commented 4 years ago

同是clang 11.0.3

2020年8月6日 下午6:33,Along notifications@github.com 写道:

编译器版本是多少呢,我在 clang 11.0 下编译成功

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/HIT-SCIR/pyltp/issues/225#issuecomment-669849897, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFSTKBRZ7IFPKC4UW2DVMWLR7KBIRANCNFSM4PWLJBMA.

eheroqiu commented 4 years ago

现在问题已经解决了 问题:/Library/Developer/CommandLineTools/usr/bin 中 c++的软连接到了clang 而不是clang++ 这样会造成c++编译头文件出错 解决方案:cd /Library/Developer/CommandLineTools/usr/bin sudo rm c++ sudo ln -s clang++ c++ 其中c++的编译器不能使用gcc, gcc 不支持LTO