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

Failed to compile cpp_wrappers #16

Closed
zjjdes opened this issue Sep 23, 2020 · 5 comments
Closed

Failed to compile cpp_wrappers #16

zjjdes opened this issue Sep 23, 2020 · 5 comments

Comments

@zjjdes
Copy link

zjjdes commented Sep 23, 2020

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:

  • Anaconda on ArchLinux
  • CUDA 9.0
  • tensorflow=1.12.0
  • cudatoolkit=9.0
  • cudnn=7.6.0
  • Default system GCC version: 10.2
  • Default CUDA9.0 GCC version: 6.5

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
Copy link
Owner

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
Copy link
Author

zjjdes commented Sep 28, 2020

@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
Copy link
Owner

Hi @zjjdes I use gcc 6.5 with Ubuntu 18.04

@zjjdes
Copy link
Author

zjjdes commented Sep 28, 2020

@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
Copy link
Owner

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

@zjjdes zjjdes closed this as completed Sep 28, 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