Megvii-BaseDetection / Megvii-BaseDetection/YOLOX

RuntimeError: Error compiling objects for extension

Open
#585 18 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10.6k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

您好,我在执行 python3 setup.py develop 时遇到下面这个问题,想请教您是哪里出了问题,cuda是11.0,谢谢
(yolox) bash-4.2$ python3 setup.py develop
running develop
running egg_info
writing yolox.egg-info/PKG-INFO
writing dependency_links to yolox.egg-info/dependency_links.txt
writing top-level names to yolox.egg-info/top_level.txt
reading manifest file 'yolox.egg-info/SOURCES.txt'
writing manifest file 'yolox.egg-info/SOURCES.txt'
running build_ext
/home/wsuser/.conda/envs/yolox/lib/python3.7/site-packages/torch/utils/cpp_extension.py:312: UserWarning:

                           !! WARNING !!

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Your compiler (g++ 4.8.5) may be ABI-incompatible with PyTorch!
Please use a compiler that is ABI-compatible with GCC 5.0 and above.
See https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html.

See https://gist.github.com/goldsborough/d466f43e8ffc948ff92de7486c5216d6
for instructions on how to install GCC 5 or higher.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

                          !! WARNING !!

warnings.warn(ABI_INCOMPATIBILITY_WARNING.format(compiler))
building 'yolox._C' extension
/home/wsuser/.conda/envs/yolox/lib/python3.7/site-packages/torch/utils/cpp_extension.py:287: UserWarning:

                           !! WARNING !!

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Your compiler (c++) is not compatible with the compiler Pytorch was
built with for this platform, which is g++ on linux. Please
use g++ to to compile your extension. Alternatively, you may
compile PyTorch from source using c++, and then you can also use
c++ to compile your extension.

See https://github.com/pytorch/pytorch/blob/master/CONTRIBUTING.md for help
with compiling PyTorch from source.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

                          !! WARNING !!

platform=sys.platform))
Emitting ninja build file /home/wsuser/work/project_git_repo/YOLOX-main/build/temp.linux-x86_64-3.7/build.ninja...
Compiling objects...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
[1/2] c++ -MMD -MF /home/wsuser/work/project_git_repo/YOLOX-main/build/temp.linux-x86_64-3.7/home/wsuser/work/project_git_repo/YOLOX-main/yolox/layers/csrc/vision.o.d -pthread -B /home/wsuser/.conda/envs/yolox/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/wsuser/work/project_git_repo/YOLOX-main/yolox/layers/csrc -I/home/wsuser/.conda/envs/yolox/lib/python3.7/site-packages/torch/include -I/home/wsuser/.conda/envs/yolox/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/wsuser/.conda/envs/yolox/lib/python3.7/site-packages/torch/include/TH -I/home/wsuser/.conda/envs/yolox/lib/python3.7/site-packages/torch/include/THC -I/home/wsuser/.conda/envs/yolox/include/python3.7m -c -c /home/wsuser/work/project_git_repo/YOLOX-main/yolox/layers/csrc/vision.cpp -o /home/wsuser/work/project_git_repo/YOLOX-main/build/temp.linux-x86_64-3.7/home/wsuser/work/project_git_repo/YOLOX-main/yolox/layers/csrc/vision.o -O3 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
FAILED: /home/wsuser/work/project_git_repo/YOLOX-main/build/temp.linux-x86_64-3.7/home/wsuser/work/project_git_repo/YOLOX-main/yolox/layers/csrc/vision.o
c++ -MMD -MF /home/wsuser/work/project_git_repo/YOLOX-main/build/temp.linux-x86_64-3.7/home/wsuser/work/project_git_repo/YOLOX-main/yolox/layers/csrc/vision.o.d -pthread -B /home/wsuser/.conda/envs/yolox/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/wsuser/work/project_git_repo/YOLOX-main/yolox/layers/csrc -I/home/wsuser/.conda/envs/yolox/lib/python3.7/site-packages/torch/include -I/home/wsuser/.conda/envs/yolox/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/wsuser/.conda/envs/yolox/lib/python3.7/site-packages/torch/include/TH -I/home/wsuser/.conda/envs/yolox/lib/python3.7/site-packages/torch/include/THC -I/home/wsuser/.conda/envs/yolox/include/python3.7m -c -c /home/wsuser/work/project_git_repo/YOLOX-main/yolox/layers/csrc/vision.cpp -o /home/wsuser/work/project_git_repo/YOLOX-main/build/temp.linux-x86_64-3.7/home/wsuser/work/project_git_repo/YOLOX-main/yolox/layers/csrc/vision.o -O3 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
c++: error: unrecognized command line option ‘-std=c++14’
[2/2] c++ -MMD -MF /home/wsuser/work/project_git_repo/YOLOX-main/build/temp.linux-x86_64-3.7/home/wsuser/work/project_git_repo/YOLOX-main/yolox/layers/csrc/cocoeval/cocoeval.o.d -pthread -B /home/wsuser/.conda/envs/yolox/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/wsuser/work/project_git_repo/YOLOX-main/yolox/layers/csrc -I/home/wsuser/.conda/envs/yolox/lib/python3.7/site-packages/torch/include -I/home/wsuser/.conda/envs/yolox/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/wsuser/.conda/envs/yolox/lib/python3.7/site-packages/torch/include/TH -I/home/wsuser/.conda/envs/yolox/lib/python3.7/site-packages/torch/include/THC -I/home/wsuser/.conda/envs/yolox/include/python3.7m -c -c /home/wsuser/work/project_git_repo/YOLOX-main/yolox/layers/csrc/cocoeval/cocoeval.cpp -o /home/wsuser/work/project_git_repo/YOLOX-main/build/temp.linux-x86_64-3.7/home/wsuser/work/project_git_repo/YOLOX-main/yolox/layers/csrc/cocoeval/cocoeval.o -O3 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
FAILED: /home/wsuser/work/project_git_repo/YOLOX-main/build/temp.linux-x86_64-3.7/home/wsuser/work/project_git_repo/YOLOX-main/yolox/layers/csrc/cocoeval/cocoeval.o
c++ -MMD -MF /home/wsuser/work/project_git_repo/YOLOX-main/build/temp.linux-x86_64-3.7/home/wsuser/work/project_git_repo/YOLOX-main/yolox/layers/csrc/cocoeval/cocoeval.o.d -pthread -B /home/wsuser/.conda/envs/yolox/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/wsuser/work/project_git_repo/YOLOX-main/yolox/layers/csrc -I/home/wsuser/.conda/envs/yolox/lib/python3.7/site-packages/torch/include -I/home/wsuser/.conda/envs/yolox/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/wsuser/.conda/envs/yolox/lib/python3.7/site-packages/torch/include/TH -I/home/wsuser/.conda/envs/yolox/lib/python3.7/site-packages/torch/include/THC -I/home/wsuser/.conda/envs/yolox/include/python3.7m -c -c /home/wsuser/work/project_git_repo/YOLOX-main/yolox/layers/csrc/cocoeval/cocoeval.cpp -o /home/wsuser/work/project_git_repo/YOLOX-main/build/temp.linux-x86_64-3.7/home/wsuser/work/project_git_repo/YOLOX-main/yolox/layers/csrc/cocoeval/cocoeval.o -O3 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
c++: error: unrecognized command line option ‘-std=c++14’
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
File "/home/wsuser/.conda/envs/yolox/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1672, in _run_ninja_build
env=env)
File "/home/wsuser/.conda/envs/yolox/lib/python3.7/subprocess.py", line 512, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "setup.py", line 63, in
packages=setuptools.find_packages(),
File "/home/wsuser/.conda/envs/yolox/lib/python3.7/site-packages/setuptools/init.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/home/wsuser/.conda/envs/yolox/lib/python3.7/distutils/core.py", line 148, in setup
dist.run_commands()
File "/home/wsuser/.conda/envs/yolox/lib/python3.7/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/home/wsuser/.conda/envs/yolox/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/wsuser/.conda/envs/yolox/lib/python3.7/site-packages/setuptools/command/develop.py", line 34, in run
self.install_for_development()
File "/home/wsuser/.conda/envs/yolox/lib/python3.7/site-packages/setuptools/command/develop.py", line 136, in install_for_development
self.run_command('build_ext')
File "/home/wsuser/.conda/envs/yolox/lib/python3.7/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/home/wsuser/.conda/envs/yolox/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/wsuser/.conda/envs/yolox/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 79, in run
_build_ext.run(self)
File "/home/wsuser/.conda/envs/yolox/lib/python3.7/distutils/command/build_ext.py", line 340, in run
self.build_extensions()
File "/home/wsuser/.conda/envs/yolox/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 709, in build_extensions
build_ext.build_extensions(self)
File "/home/wsuser/.conda/envs/yolox/lib/python3.7/distutils/command/build_ext.py", line 449, in build_extensions
self._build_extensions_serial()
File "/home/wsuser/.conda/envs/yolox/lib/python3.7/distutils/command/build_ext.py", line 474, in _build_extensions_serial
self.build_extension(ext)
File "/home/wsuser/.conda/envs/yolox/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 196, in build_extension
_build_ext.build_extension(self, ext)
File "/home/wsuser/.conda/envs/yolox/lib/python3.7/distutils/command/build_ext.py", line 534, in build_extension
depends=ext.depends)
File "/home/wsuser/.conda/envs/yolox/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 539, in unix_wrap_ninja_compile
with_cuda=with_cuda)
File "/home/wsuser/.conda/envs/yolox/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1360, in _write_ninja_file_and_compile_objects
error_prefix='Error compiling objects for extension')
File "/home/wsuser/.conda/envs/yolox/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1682, in _run_ninja_build
raise RuntimeError(message) from e
RuntimeError: Error compiling objects for extension

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with setup.py and the Python 3.7 environment, then inspect the extension sources named in the build output: yolox/layers/csrc/vision.cpp and yolox/layers/csrc/cocoeval/cocoeval.cpp. Reproduce with python3 setup.py develop and examine the compiler warnings and the rejected -std=c++14 option. The issue does not define a repository change or a clear completion condition.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python, pytorch
Domain
build-system, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.