XuyangBai / D3Feat

[TensorFlow] Official implementation of CVPR'20 oral paper - D3Feat: Joint Learning of Dense Detection and Description of 3D Local Features https://arxiv.org/abs/2003.03164
MIT License
259 stars 38 forks source link

Failed to compile cpp_wrappers #16

Closed zjjdes closed 3 years ago

zjjdes commented 3 years ago

Hi there,

Firstly thanks for the excellent work. I'm having trouble compiling the grid_subsampling extention (compile_wrappers.sh). The error log is here:

running build_ext
building 'grid_subsampling' extension
Warning: Can't read registry to find the necessary compiler setting
Make sure that Python modules winreg, win32api or win32con are installed.
C compiler: gcc -pthread -B /home/des/anaconda3/envs/D3Feat/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC
creating build
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/cpp_wrappers
creating build/temp.linux-x86_64-3.6/cpp_wrappers/cpp_utils
creating build/temp.linux-x86_64-3.6/cpp_wrappers/cpp_utils/cloud
creating build/temp.linux-x86_64-3.6/grid_subsampling
compile options: '-I/home/des/anaconda3/envs/D3Feat/lib/python3.6/site-packages/numpy/core/include -I/home/des/anaconda3/envs/D3Feat/include/python3.6m -c'
extra options: '-std=c++11'
gcc: ../cpp_utils/cloud/cloud.cpp
gcc: grid_subsampling/grid_subsampling.cpp
gcc: wrapper.cpp
cc1plus: warning: command-line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
cc1plus: warning: command-line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
cc1plus: warning: command-line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from /home/des/anaconda3/envs/D3Feat/lib/python3.6/site-packages/numpy/core/include/numpy/ndarraytypes.h:1832,
from /home/des/anaconda3/envs/D3Feat/lib/python3.6/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
from /home/des/anaconda3/envs/D3Feat/lib/python3.6/site-packages/numpy/core/include/numpy/arrayobject.h:4,
from wrapper.cpp:2:
/home/des/anaconda3/envs/D3Feat/lib/python3.6/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
17 | #warning "Using deprecated NumPy API, disable it with " \
grid_subsampling/grid_subsampling.cpp: In function ‘void grid_subsampling(std::vector&, std::vector&, std::vector&, std::vector&, std::vector&, std::vector&, float, int)’:
grid_subsampling/grid_subsampling.cpp:99:25: warning: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
99 | for (int i = 0; i < ldim; i++)
wrapper.cpp: In function ‘PyObject grid_subsampling_compute(PyObject, PyObject, PyObject)’:
wrapper.cpp:70:27: warning: ISO C++ forbids converting a string constant to ‘char’ [-Wwrite-strings]
70 | static char
kwlist[] = {"points", "features", "classes", "sampleDl", "method", "verbose", NULL };
wrapper.cpp:70:37: warning: ISO C++ forbids converting a string constant to ‘char’ [-Wwrite-strings]
70 | static char
kwlist[] = {"points", "features", "classes", "sampleDl", "method", "verbose", NULL };
wrapper.cpp:70:49: warning: ISO C++ forbids converting a string constant to ‘char’ [-Wwrite-strings]
70 | static char
kwlist[] = {"points", "features", "classes", "sampleDl", "method", "verbose", NULL };
wrapper.cpp:70:60: warning: ISO C++ forbids converting a string constant to ‘char’ [-Wwrite-strings]
70 | static char
kwlist[] = {"points", "features", "classes", "sampleDl", "method", "verbose", NULL };
wrapper.cpp:70:72: warning: ISO C++ forbids converting a string constant to ‘char’ [-Wwrite-strings]
70 | static char
kwlist[] = {"points", "features", "classes", "sampleDl", "method", "verbose", NULL };
wrapper.cpp:70:82: warning: ISO C++ forbids converting a string constant to ‘char’ [-Wwrite-strings]
70 | static char
kwlist[] = {"points", "features", "classes", "sampleDl", "method", "verbose", NULL };
g++ -pthread -shared -B /home/des/anaconda3/envs/D3Feat/compiler_compat -L/home/des/anaconda3/envs/D3Feat/lib -Wl,-rpath=/home/des/anaconda3/envs/D3Feat/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.6/cpp_wrappers/cpp_utils/cloud/cloud.o build/temp.linux-x86_64-3.6/grid_subsampling/grid_subsampling.o build/temp.linux-x86_64-3.6/wrapper.o -o /mnt/G/LiDAR datasets/d3feat/cpp_wrappers/cpp_subsampling/grid_subsampling.cpython-36m-x86_64-linux-gnu.so
/home/des/anaconda3/envs/D3Feat/compiler_compat/ld: build/temp.linux-x86_64-3.6/cpp_wrappers/cpp_utils/cloud/cloud.o: unable to initialize decompress status for section .debug_info
/home/des/anaconda3/envs/D3Feat/compiler_compat/ld: build/temp.linux-x86_64-3.6/cpp_wrappers/cpp_utils/cloud/cloud.o: unable to initialize decompress status for section .debug_info
/home/des/anaconda3/envs/D3Feat/compiler_compat/ld: build/temp.linux-x86_64-3.6/cpp_wrappers/cpp_utils/cloud/cloud.o: unable to initialize decompress status for section .debug_info
/home/des/anaconda3/envs/D3Feat/compiler_compat/ld: build/temp.linux-x86_64-3.6/cpp_wrappers/cpp_utils/cloud/cloud.o: unable to initialize decompress status for section .debug_info
build/temp.linux-x86_64-3.6/cpp_wrappers/cpp_utils/cloud/cloud.o: file not recognized: file format not recognized
collect2: error: ld returned 1 exit status
error: Command "g++ -pthread -shared -B /home/des/anaconda3/envs/D3Feat/compiler_compat -L/home/des/anaconda3/envs/D3Feat/lib -Wl,-rpath=/home/des/anaconda3/envs/D3Feat/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.6/cpp_wrappers/cpp_utils/cloud/cloud.o build/temp.linux-x86_64-3.6/grid_subsampling/grid_subsampling.o build/temp.linux-x86_64-3.6/wrapper.o -o /mnt/G/LiDAR datasets/d3feat/cpp_wrappers/cpp_subsampling/grid_subsampling.cpython-36m-x86_64-linux-gnu.so" failed with exit status 1

My environment:

I suspected the version of GCC might be the cause, so I tried changing both the versions of GCC in the system and in CUDA to 5.5 but the problem persists.

Could you please advise how to solve this issue? Thanks.

XuyangBai commented 3 years ago

Hi @zjjdes Thanks for your interest. I haven't met such problems before. It seems like the object file is corrupted somehow. Could you first remove the *.o in cpp_wrappers and then rerun compile.sh?

zjjdes commented 3 years ago

@XuyangBai Thanks for your reply. I tried removing the build folder and compiling again, no luck. My guess is that the problem is in the following two lines:

build/temp.linux-x86_64-3.6/cpp_wrappers/cpp_utils/cloud/cloud.o: file not recognized: file format not recognized collect2: error: ld returned 1 exit status

So I think I still have issues with the GCC version. The original installation guide of KPConv suggests Ubuntu 16.04, which includes gcc 5.4 by default. I tried using gcc 5.5 but it did not work. Can I ask which version of gcc you used to successfully compile this?

XuyangBai commented 3 years ago

Hi @zjjdes I use gcc 6.5 with Ubuntu 18.04

zjjdes commented 3 years ago

@XuyangBai Thanks for your swift reply! I think I just found the solution here. I followed this guide and ran the script again, this time the aforementioned errors did not occur, and it generated grid_subsampling.cpython-36m-x86_64-linux-gnu.so in cpp_subsampling/grid_subsampling. Does this mean it has been successfully compiled? If so, please feel free to close the issue, and thanks again for your help.

XuyangBai commented 3 years ago

Hi @zjjdes yes, it should be successfully compiled now. You can try the training or evaluation code to verify.