anaconda环境下升级gcc g++编译neural_renderer_pytorch

编译neural_renderer_pytorch需要一致的gcc和g++版本,服务器没有root权限,只能在anaconda下更改gcc和g++版本。

升级gcc与g++

升级gcc到7.3.0

conda install -c moussi gcc_impl_linux-64

升级gxx到7.3.0

conda install -c moussi gxx_impl_linux-64

修改gcc软链接

ln -s ~/anaconda3/envs/(envs_name)/bin/x86_64-conda_cos6-linux-gnu-gcc  ~/anaconda3/envs/(envs_name)/bin/gcc

修改g++软链接

ln -s ~/anaconda3/envs/(envs_name)/bin/x86_64-conda_cos6-linux-gnu-g++  ~/anaconda3/envs/(envs_name)/bin/g++

此时查看gcc与g++版本

gcc -v
Reading specs from ~/anaconda3/envs/(envs_name)/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/specs
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=~/anaconda3/envs/(envs_name)/bin/../libexec/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/lto-wrapper
Target: x86_64-conda_cos6-linux-gnu
Configured with: /home/conda/feedstock_root/build_artifacts/ctng-compilers_1580517382604/work/.build/x86_64-conda_cos6-linux-gnu/src/gcc/configure --build=x86_64-build_pc-linux-gnu --host=x86_64-build_pc-linux-gnu --target=x86_64-conda_cos6-linux-gnu --prefix=/home/conda/feedstock_root/build_artifacts/ctng-compilers_1580517382604/work/gcc_built --with-sysroot=/home/conda/feedstock_root/build_artifacts/ctng-compilers_1580517382604/work/gcc_built/x86_64-conda_cos6-linux-gnu/sysroot --enable-languages=c,c++,fortran,objc,obj-c++ --with-pkgversion='crosstool-NG 1.23.0.450-d54ae' --enable-__cxa_atexit --disable-libmudflap --enable-libgomp --disable-libssp --enable-libquadmath --enable-libquadmath-support --enable-libsanitizer --enable-libmpx --with-gmp=/home/conda/feedstock_root/build_artifacts/ctng-compilers_1580517382604/work/.build/x86_64-conda_cos6-linux-gnu/buildtools --with-mpfr=/home/conda/feedstock_root/build_artifacts/ctng-compilers_1580517382604/work/.build/x86_64-conda_cos6-linux-gnu/buildtools --with-mpc=/home/conda/feedstock_root/build_artifacts/ctng-compilers_1580517382604/work/.build/x86_64-conda_cos6-linux-gnu/buildtools --with-isl=/home/conda/feedstock_root/build_artifacts/ctng-compilers_1580517382604/work/.build/x86_64-conda_cos6-linux-gnu/buildtools --enable-lto --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --enable-threads=posix --enable-target-optspace --enable-plugin --enable-gold --disable-nls --disable-multilib --with-local-prefix=/home/conda/feedstock_root/build_artifacts/ctng-compilers_1580517382604/work/gcc_built/x86_64-conda_cos6-linux-gnu/sysroot --enable-long-long --enable-default-pie
Thread model: posix
gcc version 7.3.0 (crosstool-NG 1.23.0.450-d54ae)
g++ -v
Reading specs from ~/anaconda3/envs/(envs_name)/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/specs
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=~/anaconda3/envs/(envs_name)/bin/../libexec/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/lto-wrapper
Target: x86_64-conda_cos6-linux-gnu
Configured with: /home/conda/feedstock_root/build_artifacts/ctng-compilers_1580517382604/work/.build/x86_64-conda_cos6-linux-gnu/src/gcc/configure --build=x86_64-build_pc-linux-gnu --host=x86_64-build_pc-linux-gnu --target=x86_64-conda_cos6-linux-gnu --prefix=/home/conda/feedstock_root/build_artifacts/ctng-compilers_1580517382604/work/gcc_built --with-sysroot=/home/conda/feedstock_root/build_artifacts/ctng-compilers_1580517382604/work/gcc_built/x86_64-conda_cos6-linux-gnu/sysroot --enable-languages=c,c++,fortran,objc,obj-c++ --with-pkgversion='crosstool-NG 1.23.0.450-d54ae' --enable-__cxa_atexit --disable-libmudflap --enable-libgomp --disable-libssp --enable-libquadmath --enable-libquadmath-support --enable-libsanitizer --enable-libmpx --with-gmp=/home/conda/feedstock_root/build_artifacts/ctng-compilers_1580517382604/work/.build/x86_64-conda_cos6-linux-gnu/buildtools --with-mpfr=/home/conda/feedstock_root/build_artifacts/ctng-compilers_1580517382604/work/.build/x86_64-conda_cos6-linux-gnu/buildtools --with-mpc=/home/conda/feedstock_root/build_artifacts/ctng-compilers_1580517382604/work/.build/x86_64-conda_cos6-linux-gnu/buildtools --with-isl=/home/conda/feedstock_root/build_artifacts/ctng-compilers_1580517382604/work/.build/x86_64-conda_cos6-linux-gnu/buildtools --enable-lto --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --enable-threads=posix --enable-target-optspace --enable-plugin --enable-gold --disable-nls --disable-multilib --with-local-prefix=/home/conda/feedstock_root/build_artifacts/ctng-compilers_1580517382604/work/gcc_built/x86_64-conda_cos6-linux-gnu/sysroot --enable-long-long --enable-default-pie
Thread model: posix
gcc version 7.3.0 (crosstool-NG 1.23.0.450-d54ae) 

进入目录编译

cd neural_renderer_pytorch
python setup.py install 

发现报错,报错内容是找不到一些文件

running install
running bdist_egg
running egg_info
writing neural_renderer_pytorch.egg-info/PKG-INFO
writing dependency_links to neural_renderer_pytorch.egg-info/dependency_links.txt
writing top-level names to neural_renderer_pytorch.egg-info/top_level.txt
reading manifest file 'neural_renderer_pytorch.egg-info/SOURCES.txt'
adding license file 'LICENSE'
writing manifest file 'neural_renderer_pytorch.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
running build_ext
building 'neural_renderer.cuda.load_textures' extension
Emitting ninja build file /.../neural_renderer_pytorch/build/temp.linux-x86_64-3.6/build.ninja...
Compiling objects...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
ninja: no work to do.
g++ -pthread -shared -B /opt/anaconda1anaconda2anaconda3/compiler_compat -L/opt/anaconda1anaconda2anaconda3/lib -Wl,-rpath=/opt/anaconda1anaconda2anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ /.../neural_renderer_pytorch/build/temp.linux-x86_64-3.6/neural_renderer/cuda/load_textures_cuda.o /.../neural_renderer_pytorch/build/temp.linux-x86_64-3.6/neural_renderer/cuda/load_textures_cuda_kernel.o -L~/anaconda3/envs/(envs_name)/lib/python3.6/site-packages/torch/lib -L/usr/local/cuda-10.2/lib64 -lc10 -ltorch -ltorch_cpu -ltorch_python -lcudart -lc10_cuda -ltorch_cuda -o build/lib.linux-x86_64-3.6/neural_renderer/cuda/load_textures.cpython-36m-x86_64-linux-gnu.so
~/anaconda3/envs/(envs_name)/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: cannot find /lib/libpthread.so.0: No such file or directory
~/anaconda3/envs/(envs_name)/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: cannot find /usr/lib/libpthread_nonshared.a: No such file or directory
collect2: error: ld returned 1 exit status
error: command 'g++' failed with exit status 1

查阅资料,找到解决方案 在新环境中构建cython扩展:找不到/lib/libpthread.so.0

conda install gxx_linux-64
conda install cmake

显示编译成功

Installed ~/anaconda3/envs/(envs_name)/lib/python3.6/site-packages/neural_renderer_pytorch-1.1.3-py3.6-linux-x86_64.egg
Processing dependencies for neural-renderer-pytorch==1.1.3
Finished processing dependencies for neural-renderer-pytorch==1.1.3
  • 3
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
错误"/usr/bin/ld:找不到-lopengl_helper"表示在构建项目时,ld链接器无法找到名为"libopengl_helper.so"的库文件。这通常是由于缺少必要的OpenGL库引起的。 根据引用和的建议,你可以尝试安装一些OpenGL相关的开发库来解决这个问题。可以使用以下命令来安装这些库: sudo apt-get install libgl1-mesa-dev sudo apt-get install mesa-common-dev sudo apt-get install libglu1-mesa-dev 这些命令将安装所需的OpenGL开发库,包括libGL和libGLU。安装完成后,你应该能够成功编译和链接你的Qt项目,而不再出现"/usr/bin/ld:找不到-lopengl_helper"的错误。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [Ubuntu环境QT问题 /usr/bin/ld: 找不到 -lGL(已解决)](https://download.csdn.net/download/weixin_38655990/14043339)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* *3* [qt编译出错 /usr/bin/ld 找不到 -lGL cannot find -lGL](https://blog.csdn.net/weixin_43729409/article/details/104893310)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值