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

mac10.15无法编译 #225

Closed
eheroqiu opened this issue Aug 6, 2020 · 5 comments
Closed

mac10.15无法编译 #225

eheroqiu opened this issue Aug 6, 2020 · 5 comments

Comments

@eheroqiu
Copy link

eheroqiu commented Aug 6, 2020

问题类型

构建失败

出错场景

无法从源码编译,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
Copy link

AlongWY commented Aug 6, 2020

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

@eheroqiu
Copy link
Author

eheroqiu commented Aug 6, 2020 via email

@AlongWY
Copy link

AlongWY commented Aug 6, 2020

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

@eheroqiu
Copy link
Author

eheroqiu commented Aug 7, 2020 via email

@eheroqiu
Copy link
Author

eheroqiu commented Aug 7, 2020

现在问题已经解决了
问题:/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

@eheroqiu eheroqiu closed this as completed Aug 7, 2020
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

No branches or pull requests

2 participants