tianzhi0549 / FCOS

FCOS: Fully Convolutional One-Stage Object Detection (ICCV'19)
https://arxiv.org/abs/1904.01355
Other
3.28k stars 630 forks source link

【Two situations】When compiling FCOS: (1) collect2: fatal error: cannot find 'ld'. (2) unable to execute 'x86_64-conda_cos6-linux-gnu-gcc': No such file or directory. #46

Closed Haonan-Qin closed 5 years ago

Haonan-Qin commented 5 years ago

I tried to run the code in two different environment but failed. BTW, my linux environment is offline.

【1】The environment is: (0) Ubuntu 16.04 (1) Anaconda python 3.6.2 (GCC 7.2.0) (2) PyTorch 1.0.0 (3) gcc -v --> 5.4.0 (4) CUDA 9.0.176 【ERROR】: running build running build_py running build_ext /home/qinhaonan/.local/lib/python3.6/site-packages/torch/utils/cpp_extension.py:118: UserWarning:

                           !! WARNING !!

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Your compiler (x86_64-conda_cos6-linux-gnu-c++) may be ABI-incompatible with PyTorch! Please use a compiler that is ABI-compatible with GCC 4.9 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 4.9 or higher. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

                          !! WARNING !!

x86_64-conda_cos6-linux-gnu-c++ -pthread -shared -Wl,-O2,--sort-common,--as-needed,-z,relro,-z,now -Wl,-rpath,/opt/anaconda3/lib -L/opt/anaconda3/lib -Wl,-O2,--sort-common,--as-needed,-z,relro,-z,now -Wl,-rpath,/opt/anaconda3/lib -L/opt/anaconda3/lib build/temp.linux-x86_64-3.6/home/qinhaonan/Algorithm/FCOS/FCOS_01/FCOS-master/maskrcnn_benchmark/csrc/vision.o build/temp.linux-x86_64-3.6/home/qinhaonan/Algorithm/FCOS/FCOS_01/FCOS-master/maskrcnn_benchmark/csrc/cpu/ROIAlign_cpu.o build/temp.linux-x86_64-3.6/home/qinhaonan/Algorithm/FCOS/FCOS_01/FCOS-master/maskrcnn_benchmark/csrc/cpu/nms_cpu.o build/temp.linux-x86_64-3.6/home/qinhaonan/Algorithm/FCOS/FCOS_01/FCOS-master/maskrcnn_benchmark/csrc/cuda/nms.o build/temp.linux-x86_64-3.6/home/qinhaonan/Algorithm/FCOS/FCOS_01/FCOS-master/maskrcnn_benchmark/csrc/cuda/ROIPool_cuda.o build/temp.linux-x86_64-3.6/home/qinhaonan/Algorithm/FCOS/FCOS_01/FCOS-master/maskrcnn_benchmark/csrc/cuda/ROIAlign_cuda.o build/temp.linux-x86_64-3.6/home/qinhaonan/Algorithm/FCOS/FCOS_01/FCOS-master/maskrcnn_benchmark/csrc/cuda/SigmoidFocalLoss_cuda.o -L/usr/local/cuda/lib64 -L/opt/anaconda3/lib -lcudart -lpython3.6m -o build/lib.linux-x86_64-3.6/maskrcnn_benchmark/_C.cpython-36m-x86_64-linux-gnu.so collect2: fatal error: cannot find 'ld' compilation terminated. error: command 'x86_64-conda_cos6-linux-gnu-c++' failed with exit status 1

【2】The environment is: (0) Ubuntu 16.04 (1) Anaconda python 3.6.2 (GCC 7.2.0) (2) PyTorch 0.4.0 (3) gcc -v --> 4.8.5 (4) CUDA 8.0.61 【ERROR】: running build_ext /apps/jhinno/users/.../.local/lib/python3.6/site-packages/torch/utils/cpp_extension.py:80: UserWarning: Error checking compiler version: [Errno 2] No such file or directory: 'x86_64-conda_cos6-linux-gnu-c++' warnings.warn('Error checking compiler version: {}'.format(error)) /apps/jhinno/users/.../.local/lib/python3.6/site-packages/torch/utils/cpp_extension.py:106: UserWarning:

                           !! WARNING !!

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Your compiler (x86_64-conda_cos6-linux-gnu-c++) may be ABI-incompatible with PyTorch! Please use a compiler that is ABI-compatible with GCC 4.9 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 4.9 or higher. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

                          !! WARNING !!

warnings.warn(ABI_INCOMPATIBILITY_WARNING.format(compiler)) building 'maskrcnn_benchmark._C' extension creating build creating build/temp.linux-x86_64-3.6 ... creating build/temp.linux-x86_64-3.6/.../FCOS/FCOS-master/maskrcnn_benchmark/csrc/cpu creating build/temp.linux-x86_64-3.6/.../FCOS/FCOS-master/maskrcnn_benchmark/csrc/cuda x86_64-conda_cos6-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O2 -Wall -Wstrict-prototypes -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -fPIC -DWITH_CUDA -I/apps/jhinno/users/IMGLAB/4003/HeroNet/FCOS/FCOS-master/maskrcnn_benchmark/csrc -I/apps/jhinno/users/IMGLAB/4003/.local/lib/python3.6/site-packages/torch/lib/include -I/apps/jhinno/users/IMGLAB/4003/.local/lib/python3.6/site-packages/torch/lib/include/TH -I/apps/jhinno/users/IMGLAB/4003/.local/lib/python3.6/site-packages/torch/lib/include/THC -I/usr/local/cuda/include -I/opt/anaconda3/include/python3.6m -c /apps/jhinno/users/IMGLAB/4003/HeroNet/FCOS/FCOS-master/maskrcnn_benchmark/csrc/vision.cpp -o build/temp.linux-x86_64-3.6/apps/jhinno/users/IMGLAB/4003/HeroNet/FCOS/FCOS-master/maskrcnn_benchmark/csrc/vision.o -DTORCH_EXTENSION_NAME=maskrcnn_benchmark._C -std=c++11 unable to execute 'x86_64-conda_cos6-linux-gnu-gcc': No such file or directory error: command 'x86_64-conda_cos6-linux-gnu-gcc' failed with exit status 1

tianzhi0549 commented 5 years ago

@Haonan-Qin Please try to use gcc>=5.0.

Haonan-Qin commented 5 years ago

@tianzhi0549 Thanks for your reply. In the first enviroment, when inputting 'python' we can obtain the output 'GCC 7.2.0 on linux', when inputting 'x86_64-conda_cos6-linux-gnu-gcc -version' we can obtain the output 'gcc version 7.2.0', when inputting 'gcc -v' we can obtain the output 'gcc version 5.4.0'. All of them >= 5.0 even though '5.4.0' of ubuntu is different from '7.2.0' of anaconda. So, is the bug made by the lower edition of gcc?

tianzhi0549 commented 5 years ago

@Haonan-Qin do you have x86_64-conda_cos6-linux-gnu-c++?

Haonan-Qin commented 5 years ago

@tianzhi0549 When inputting 'x86_64-conda_cos6-linux-gnu-c++ -version' we can also obtain the output 'gcc version 7.2.0' as follows: Reading specs from /opt/anaconda3/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.2.0/specs COLLECT_GCC=x86_64-conda_cos6-linux-gnu-c++ COLLECT_LTO_WRAPPER=/opt/anaconda3/bin/../libexec/gcc/x86_64-conda_cos6-linux-gnu/7.2.0/lto-wrapper Target: x86_64-conda_cos6-linux-gnu Configured with: /opt/conda/conda-bld/compilers_linux-64_1520532893746/work/.build/src/gcc-7.2.0/configure --build=x86_64-build_pc-linux-gnu --host=x86_64-build_pc-linux-gnu --target=x86_64-conda_cos6-linux-gnu --prefix=/opt/conda/conda-bld/compilers_linux-64_1520532893746/work/gcc_built --with-sysroot=/opt/conda/conda-bld/compilers_linux-64_1520532893746/work/gcc_built/x86_64-conda_cos6-linux-gnu/sysroot --enable-languages=c,c++,fortran,objc,obj-c++ --with-pkgversion='crosstool-NG fa8859cb' --enable-__cxa_atexit --disable-libmudflap --enable-libgomp --disable-libssp --enable-libquadmath --enable-libquadmath-support --enable-libsanitizer --enable-libmpx --with-gmp=/opt/conda/conda-bld/compilers_linux-64_1520532893746/work/.build/x86_64-conda_cos6-linux-gnu/buildtools --with-mpfr=/opt/conda/conda-bld/compilers_linux-64_1520532893746/work/.build/x86_64-conda_cos6-linux-gnu/buildtools --with-mpc=/opt/conda/conda-bld/compilers_linux-64_1520532893746/work/.build/x86_64-conda_cos6-linux-gnu/buildtools --with-isl=/opt/conda/conda-bld/compilers_linux-64_1520532893746/work/.build/x86_64-conda_cos6-linux-gnu/buildtools --enable-lto --enable-threads=posix --enable-target-optspace --enable-plugin --enable-gold --disable-nls --disable-multilib --with-local-prefix=/opt/conda/conda-bld/compilers_linux-64_1520532893746/work/gcc_built/x86_64-conda_cos6-linux-gnu/sysroot --enable-long-long --enable-default-pie Thread model: posix gcc version 7.2.0 (crosstool-NG fa8859cb)

tianzhi0549 commented 5 years ago

@Haonan-Qin Please try to use gcc >= 5.0 but <= 6.0.

Haonan-Qin commented 5 years ago

@tianzhi0549 Thanks for your suggestion, I will try it immediately. But there is a basic question, does this project work with python2.7 or python3.6? When I try to run the code with python2.7, the error information has been changed, which seems to be more solvable. The error with python2.7 as follows.

running build running build_py running build_ext running develop error: can't create or remove files in install directory The following error occurred while trying to add or remove files in the installation directory: [Errno 13] Permission denied: '/opt/anaconda2/lib/python2.7/site-packages/test-easy-install-36314.write-test' The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was: /opt/anaconda2/lib/python2.7/site-packages/ Perhaps your account does not have write access to this directory? If the installation directory is a system-owned directory, you may need to sign in as the administrator or "root" account. If you do not have administrative access to this machine, you may wish to choose a different installation directory, preferably one that is listed in your PYTHONPATH environment variable.

tianzhi0549 commented 5 years ago

@Haonan-Qin It should work with both python versions. The error is because you do not have permission to write in the directory. Just try to add sudo before the command line.

wgqbit95 commented 4 years ago

It has no relationship with gcc version. Just pytorch version problem