我正在尝试构建OpenMVG,但是无法解决某些依赖性错误。我在anaconda环境中,使用的是conda安装的g ++版本和一些库(我没有root特权)。
$ cmake --build . --target install
... (lots of output from seemingly successful steps) ...
[ 77%] Built target openMVG_sample_main_features_repeatability_dataset
[ 77%] Linking CXX executable ../../Linux-x86_64-RELEASE/openMVG_sample_features_affine
/home/user/anaconda3/envs/sfm/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: cannot find -ljpeg
/home/user/anaconda3/envs/sfm/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: cannot find -lpng
/home/user/anaconda3/envs/sfm/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: cannot find -lz
/home/user/anaconda3/envs/sfm/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: cannot find -ltiff
collect2: error: ld returned 1 exit status
gmake[2]: *** [Linux-x86_64-RELEASE/openMVG_sample_features_affine] Error 1
gmake[1]: *** [openMVG_Samples/features_affine_demo/CMakeFiles/openMVG_sample_features_affine.dir/all] Error 2
gmake: *** [all] Error 2
但是libjpeg
,libpng
等都是/home/user/anaconda3/envs/sfm/lib/
。例如:
(sfm) [openMVG]$ find /home/user/anaconda3/envs/sfm/ -name 'libjpeg*'
/home/user/anaconda3/envs/sfm/conda-meta/libjpeg-turbo-cos6-x86_64-1.2.1-h24432d5_0.json
/home/user/anaconda3/envs/sfm/lib/libjpeg.a
/home/user/anaconda3/envs/sfm/lib/libjpeg.so
...
所以我尝试了以下两种方法:
export LD_PRELOAD=/home/user/anaconda3/envs/sfm/lib/libjpeg.so
和
export LD_LIBRARY_PATH=/home/user/anaconda3/envs/sfm/lib/:/home/user/anaconda3/lib/:/usr/lib64/:/usr/lib/
在重新运行之前$ cmake --build . --target install
,但得到相同的结果。
在我看来,编译器找不到某些库。因此,我告诉了它确切的位置,甚至尝试对其进行预加载,但仍然找不到它们。为达到这一目的,必须将路径添加到LD_LIBRARY_PATH-因此,它似乎确实可以用于其他用途。只是不是这个问题。如何从这里进行故障排除?