dvlab-research / SphereFormer

The official implementation for "Spherical Transformer for LiDAR-based 3D Recognition" (CVPR 2023).
Apache License 2.0
300 stars 34 forks source link

RuntimeError: Error compiling objects for extension #67

Open xiaosa269 opened 8 months ago

xiaosa269 commented 8 months ago

Hello, I encountered the following error while performing the step "cd third_party/SparseTransformer && python setup.py install" on GitHub. Could you please advise me on how to resolve it? Thank you very much for your assistance. running install /home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. setuptools.SetuptoolsDeprecationWarning, /home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/setuptools/command/easy_install.py:147: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools. EasyInstallDeprecationWarning, running bdist_egg running egg_info writing sptr.egg-info/PKG-INFO writing dependency_links to sptr.egg-info/dependency_links.txt writing top-level names to sptr.egg-info/top_level.txt reading manifest file 'sptr.egg-info/SOURCES.txt' writing manifest file 'sptr.egg-info/SOURCES.txt' installing library code to build/bdist.linux-x86_64/egg running install_lib running build_ext building 'sptr_cuda' extension Emitting ninja build file /home/xhy/code/SphereFormer-master/third_party/SparseTransformer/build/temp.linux-x86_64-cpython-37/build.ninja... Compiling objects... Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N) [1/3] /usr/bin/nvcc --generate-dependencies-with-compile --dependency-output /home/xhy/code/SphereFormer-master/third_party/SparseTransformer/build/temp.linux-x86_64-cpython-37/src/sptr/attention/attention_cuda_kernel.o.d -I/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/torch/include -I/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/torch/include/TH -I/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/torch/include/THC -I/home/xhy/miniconda3/envs/SphereFormer/include/python3.7m -c -c /home/xhy/code/SphereFormer-master/third_party/SparseTransformer/src/sptr/attention/attention_cuda_kernel.cu -o /home/xhy/code/SphereFormer-master/third_party/SparseTransformer/build/temp.linux-x86_64-cpython-37/src/sptr/attention/attention_cuda_kernel.o -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -O2 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=sptr_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -std=c++14 FAILED: /home/xhy/code/SphereFormer-master/third_party/SparseTransformer/build/temp.linux-x86_64-cpython-37/src/sptr/attention/attention_cuda_kernel.o /usr/bin/nvcc --generate-dependencies-with-compile --dependency-output /home/xhy/code/SphereFormer-master/third_party/SparseTransformer/build/temp.linux-x86_64-cpython-37/src/sptr/attention/attention_cuda_kernel.o.d -I/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/torch/include -I/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/torch/include/TH -I/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/torch/include/THC -I/home/xhy/miniconda3/envs/SphereFormer/include/python3.7m -c -c /home/xhy/code/SphereFormer-master/third_party/SparseTransformer/src/sptr/attention/attention_cuda_kernel.cu -o /home/xhy/code/SphereFormer-master/third_party/SparseTransformer/build/temp.linux-x86_64-cpython-37/src/sptr/attention/attention_cuda_kernel.o -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -O2 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=sptr_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -std=c++14 nvcc fatal : Unknown option '-generate-dependencies-with-compile' [2/3] /usr/bin/nvcc --generate-dependencies-with-compile --dependency-output /home/xhy/code/SphereFormer-master/third_party/SparseTransformer/build/temp.linux-x86_64-cpython-37/src/sptr/rpe/relative_pos_encoding_cuda_kernel.o.d -I/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/torch/include -I/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/torch/include/TH -I/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/torch/include/THC -I/home/xhy/miniconda3/envs/SphereFormer/include/python3.7m -c -c /home/xhy/code/SphereFormer-master/third_party/SparseTransformer/src/sptr/rpe/relative_pos_encoding_cuda_kernel.cu -o /home/xhy/code/SphereFormer-master/third_party/SparseTransformer/build/temp.linux-x86_64-cpython-37/src/sptr/rpe/relative_pos_encoding_cuda_kernel.o -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -O2 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=sptr_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -std=c++14 FAILED: /home/xhy/code/SphereFormer-master/third_party/SparseTransformer/build/temp.linux-x86_64-cpython-37/src/sptr/rpe/relative_pos_encoding_cuda_kernel.o /usr/bin/nvcc --generate-dependencies-with-compile --dependency-output /home/xhy/code/SphereFormer-master/third_party/SparseTransformer/build/temp.linux-x86_64-cpython-37/src/sptr/rpe/relative_pos_encoding_cuda_kernel.o.d -I/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/torch/include -I/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/torch/include/TH -I/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/torch/include/THC -I/home/xhy/miniconda3/envs/SphereFormer/include/python3.7m -c -c /home/xhy/code/SphereFormer-master/third_party/SparseTransformer/src/sptr/rpe/relative_pos_encoding_cuda_kernel.cu -o /home/xhy/code/SphereFormer-master/third_party/SparseTransformer/build/temp.linux-x86_64-cpython-37/src/sptr/rpe/relative_pos_encoding_cuda_kernel.o -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -O2 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=sptr_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -std=c++14 nvcc fatal : Unknown option '-generate-dependencies-with-compile' [3/3] /usr/bin/nvcc --generate-dependencies-with-compile --dependency-output /home/xhy/code/SphereFormer-master/third_party/SparseTransformer/build/temp.linux-x86_64-cpython-37/src/sptr/precompute/precompute_cuda_kernel.o.d -I/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/torch/include -I/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/torch/include/TH -I/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/torch/include/THC -I/home/xhy/miniconda3/envs/SphereFormer/include/python3.7m -c -c /home/xhy/code/SphereFormer-master/third_party/SparseTransformer/src/sptr/precompute/precompute_cuda_kernel.cu -o /home/xhy/code/SphereFormer-master/third_party/SparseTransformer/build/temp.linux-x86_64-cpython-37/src/sptr/precompute/precompute_cuda_kernel.o -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -O2 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=sptr_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -std=c++14 FAILED: /home/xhy/code/SphereFormer-master/third_party/SparseTransformer/build/temp.linux-x86_64-cpython-37/src/sptr/precompute/precompute_cuda_kernel.o /usr/bin/nvcc --generate-dependencies-with-compile --dependency-output /home/xhy/code/SphereFormer-master/third_party/SparseTransformer/build/temp.linux-x86_64-cpython-37/src/sptr/precompute/precompute_cuda_kernel.o.d -I/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/torch/include -I/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/torch/include/TH -I/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/torch/include/THC -I/home/xhy/miniconda3/envs/SphereFormer/include/python3.7m -c -c /home/xhy/code/SphereFormer-master/third_party/SparseTransformer/src/sptr/precompute/precompute_cuda_kernel.cu -o /home/xhy/code/SphereFormer-master/third_party/SparseTransformer/build/temp.linux-x86_64-cpython-37/src/sptr/precompute/precompute_cuda_kernel.o -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -O2 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=sptr_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -std=c++14 nvcc fatal : Unknown option '-generate-dependencies-with-compile' ninja: build stopped: subcommand failed. Traceback (most recent call last): File "/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1673, in _run_ninja_build env=env) File "/home/xhy/miniconda3/envs/SphereFormer/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 27, in cmdclass={'build_ext': BuildExtension} File "/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/setuptools/init.py", line 87, in setup return distutils.core.setup(**attrs) File "/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/setuptools/_distutils/core.py", line 185, in setup return run_commands(dist) File "/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/setuptools/_distutils/core.py", line 201, in run_commands dist.run_commands() File "/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands self.run_command(cmd) File "/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/setuptools/dist.py", line 1208, in run_command super().run_command(command) File "/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/setuptools/_distutils/dist.py", line 988, in run_command cmd_obj.run() File "/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/setuptools/command/install.py", line 74, in run self.do_egg_install() File "/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/setuptools/command/install.py", line 123, in do_egg_install self.run_command('bdist_egg') File "/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command self.distribution.run_command(command) File "/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/setuptools/dist.py", line 1208, in run_command super().run_command(command) File "/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/setuptools/_distutils/dist.py", line 988, in run_command cmd_obj.run() File "/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/setuptools/command/bdist_egg.py", line 165, in run cmd = self.call_command('install_lib', warn_dir=0) File "/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/setuptools/command/bdist_egg.py", line 151, in call_command self.run_command(cmdname) File "/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command self.distribution.run_command(command) File "/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/setuptools/dist.py", line 1208, in run_command super().run_command(command) File "/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/setuptools/_distutils/dist.py", line 988, in run_command cmd_obj.run() File "/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/setuptools/command/install_lib.py", line 11, in run self.build() File "/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/setuptools/_distutils/command/install_lib.py", line 112, in build self.run_command('build_ext') File "/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command self.distribution.run_command(command) File "/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/setuptools/dist.py", line 1208, in run_command super().run_command(command) File "/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/setuptools/_distutils/dist.py", line 988, in run_command cmd_obj.run() File "/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 84, in run _build_ext.run(self) File "/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/setuptools/_distutils/command/build_ext.py", line 346, in run self.build_extensions() File "/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 708, in build_extensions build_ext.build_extensions(self) File "/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/setuptools/_distutils/command/build_ext.py", line 468, in build_extensions self._build_extensions_serial() File "/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/setuptools/_distutils/command/build_ext.py", line 494, in _build_extensions_serial self.build_extension(ext) File "/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 246, in build_extension _build_ext.build_extension(self, ext) File "/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/setuptools/_distutils/command/build_ext.py", line 556, in build_extension depends=ext.depends, File "/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 538, in unix_wrap_ninja_compile with_cuda=with_cuda) File "/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1359, in _write_ninja_file_and_compile_objects error_prefix='Error compiling objects for extension') File "/home/xhy/miniconda3/envs/SphereFormer/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1683, in _run_ninja_build raise RuntimeError(message) from e RuntimeError: Error compiling objects for extension

Vonct commented 7 months ago

same issue. Have you solved it?

Tombo551 commented 5 months ago

Had the same issue, solved it by changing all the occurences of #include <THC/THC.h> to #include <ATen/ATen.h>. The reason is that the namespace THC is deprecated and functions were moved to ATen namespace, as discussed in https://discuss.pytorch.org/t/question-about-thc-thc-h/147145/11