1

I'm trying to build OpenMVG, and can't resolve some dependency errors. I'm in an anaconda environment and using conda installed versions of g++ and some of the libs (I do not have root priveleges).

$ 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

But libjpeg, libpng etc. are all /home/user/anaconda3/envs/sfm/lib/. For example:

(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
...

So I've tried both of the following:

export LD_PRELOAD=/home/user/anaconda3/envs/sfm/lib/libjpeg.so

and

export LD_LIBRARY_PATH=/home/user/anaconda3/envs/sfm/lib/:/home/user/anaconda3/lib/:/usr/lib64/:/usr/lib/

before rerunning$ cmake --build . --target install, but get the same result.

It seems to me that the compiler couldn't find some libs. So I told it exactly where to look, and even tried preoloading them, and it still can't find them. Adding the paths to LD_LIBRARY_PATH was necessary to get this far - so it does seem to have worked for other things. Just not this problem. How do I troubleshoot from here?

Kevin
  • 16,549
  • 8
  • 60
  • 74
argentum2f
  • 4,842
  • 2
  • 25
  • 30
  • Both `LD_PRELOAD` and `LD_LIBRARY_PATH` affects on searching **shared** libraries when the program is **run**. But you have an error at *linking* stage. You may try to set `LIBRARY_PATH` variable instead. See that questions about meaning these variables:https://stackoverflow.com/questions/4250624/ld-library-path-vs-library-path, https://stackoverflow.com/questions/426230/what-is-the-ld-preload-trick. – Tsyvarev Nov 07 '19 at 22:39
  • I see now. I was misunderstanding an error I had at the beginning. cmake itself needed a shared library that it couldn't find. Setting LD_LIBRARY_PATH only fixed that problem. – argentum2f Nov 12 '19 at 19:37

0 Answers0