mmdetection踩坑記錄 error: command 'g++' failed with exit status 1


最近在搭建一個基於基於mmdetection的一個環境,遇到了各種gcc   g++問題:

1. ''ImportError:

***/miniconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/../../../libstdc++.so.6: version `CXXABI_1.3.11' not found (required by /DB/rhome/yuhangzhou/miniconda3/envs/open-mmlab/lib/python3.7/site ackages/torch/lib/libtorch_python.so)'',

解決辦法:

then i remove original libstdc++.so.6, and run ''ln -s libstdc++.so.6.0.26 libstdc++.so.6'' after that, i run '''python setup.py develop' again,

2.error: command 'g++' failed with exit status 1

/home1/wang-internship-1/anaconda3/envs/aerial/compiler_compat/ld: cannot find -lm
/home1/wang-internship-1/anaconda3/envs/aerial/compiler_compat/ld: cannot find -lpthread
/home1/wang-internship-1/anaconda3/envs/aerial/compiler_compat/ld: cannot find -lc
collect2: error: ld returned 1 exit status
error: command 'g++' failed with exit status 1

這個bug找了很多博客,都說是讓安裝g++,但是我是在服務器上搭環境,沒有root權限

偶然間在下面連接中找到了解決辦法:

https://stackoverflow.com/questions/47512182/cannot-find-lfftw3-omp-error-when-compiling-a-third-party-package-how-to-lin

解決方法是找到包含-lm、-lpthread、-lc的文件,並將其連接到所需的文件夾下

以-lpthread為例:

(1)在終端中輸入指令:ld -lpthread --verbose

 

 找到succeeded路徑,作為path 1

如上圖的中path 1可以為/usr/lib/x86_64-linux-gnu/libpthread.so

(2)然后從錯誤信息:/home1/wang-internship-1/anaconda3/envs/aerial/compiler_compat/ld: cannot find -lpthread

         中獲得path 2=/home1/wang-internship-1/anaconda3/envs/aerial/compiler_compat/

(3)最后在終端中輸入指令:

         ln -s path 1 path 2

(4)用類似的方法分別處理-lm、-lc

         執行編譯程序python setup.py develop 或 bash compile.sh

示例:ln -s /usr/lib/x86_64-linux-gnu/libpthread.so /home1/wang-internship-1/anaconda3/envs/aerial/compiler_compat/

注:過程中會出現很多wanring,大約10分鍾

但是結果會出現finished

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM