Caffe installation, linking issue - linux

I have the following issue encoutering during caffe installation:
/usr/bin/ld: cannot find -lopencv_imgcodecs
I built opencv3.2, but I believe I have an issue with linking the cv2.cpython-36m-x86_64-linux-gnu.so library. I tried adding it to the LD_LIBRARY_PATH but it still fails with the same error.
Shall I make a link to the cv2.cpython-36m-x86_64-linux-gnu.so in the LD path? if yes, which path exactly shall I make the link in it.
Here is the last few lines of the output (the error msg):
CXX examples/mnist/convert_mnist_data.cpp
CXX .build_release/src/caffe/proto/caffe.pb.cc
AR -o .build_release/lib/libcaffe.a
LD -o .build_release/lib/libcaffe.so.1.0.0
/usr/bin/ld: cannot find -lopencv_imgcodecs
collect2: error: ld returned 1 exit status
Makefile:572: recipe for target '.build_release/lib/libcaffe.so.1.0.0' failed
make: *** [.build_release/lib/libcaffe.so.1.0.0] Error 1

It can't find the way to reach libopencv_imgcodecs.so, check where it is located & add same path in LIBRARY_DIRS of Makefile.config
Open your Makefile.config file, you'll find the following lines:
# Whatever else you find you need goes here.
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib
If you've found the location, for example /home/username/anaconda3/envs/env-name/lib, then add it to LIBRARY_DIRS.
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /home/<username>/anaconda3/envs/<env-name>/lib

Related

run into error "/usr/bin/ld: cannot find -lgfortran" while I do have libgfortran.so installed

When I was doing catkin_make in my ROS workspace, following error occurred.
[100%] Linking CXX executable /home/georgehan/catkin_fasttracker/devel/lib/plan_manage/tracking_fsm_node
/usr/bin/ld: cannot find -lgfortran
collect2: error: ld returned 1 exit status
Fast-tracker/src/plan_manage/CMakeFiles/tracking_fsm_node.dir/build.make:832: recipe for target '/home/georgehan/catkin_fasttracker/devel/lib/plan_manage/tracking_fsm_node' failed
make[2]: *** [/home/georgehan/catkin_fasttracker/devel/lib/plan_manage/tracking_fsm_node] Error 1
And by doing locate libgfortran.so, it turns out that there were already libgfortran.so files in my system:
~$ locate libgfortran.so
/usr/lib/gcc/x86_64-linux-gnu/7/libgfortran.so
/usr/lib/x86_64-linux-gnu/libgfortran.so.4
/usr/lib/x86_64-linux-gnu/libgfortran.so.4.0.0
I read about making some symlink to fix my problem, but I do not know the which .so file to link to.
Please help me with specific command line !

LD can't find libraries when building with cmake

For my thesis work I will have to work with a project that was created with cmake. Therefore, I installed cmake on my PopOS! 21.04 laptop.
cmake --version
cmake version 3.21.3
dpkg doesn't find it though (I had build cmake myself, can I add it to dpkg somehow).
dpkg -l cmake
||/ Name Version Architecture Description
+++-==============-============-============-
===============================>
un cmake <none> <none> (no description
available)`
So I went ahead and downloaded the source code and extracted it on my Desktop. Inside the root source folder I entered:
mkdir build
cd build
sudo cmake ..
sudo cmake --build . --config Release --target install
which works until I get this:
/usr/bin/ld: cannot find -lXrandr /usr/bin/ld: cannot find -lXinerama
/usr/bin/ld: cannot find -lfontconfig /usr/bin/ld: cannot find
-lXrandr /usr/bin/ld: cannot find -lXinerama /usr/bin/ld: cannot find -lfontconfig collect2: error: ld returned 1 exit status gmake[2]: *** [EnvironmentSimulator/Libraries/esminiLib/CMakeFiles/esminiLib.dir/build.make:122:
EnvironmentSimulator/Libraries/esminiLib/libesminiLib.so] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:584:
EnvironmentSimulator/Libraries/esminiLib/CMakeFiles/esminiLib.dir/all]
Error 2 gmake: *** [Makefile:136: all] Error 2
For me it looks like ld cannot find the libraries, if I look if xrandr is in /usr/bin/ it is. I tried linking it with a LD_PATH sth which didnt work and writing to the ld config file.
So now I don't know what else I can try.

ld: error: unable to find library -lmysqlclient

I am trying to compile my game program and it s giving me this
root#vps:/usr/src/Sursa/Server/source/game/src # gmake -j20
linking ../game
ld: error: unable to find library -lmysqlclient
c++: error: linker command failed with exit code 1 (use -v to see invocation)
gmake: *** [Makefile:228: ../game] Error 1
root#vps:/usr/src/Sursa/Server/source/game/src #
This is my Makefile path for library
# mysql
INCDIR += -I../../../extern/mysql
LIBDIR += -L/usr/local/lib/mysq
LIBS += -lmysqlclient -lz -pthread -lm -lssl -lcrypto
### END
You need to update your GCC compiler since some features of c++14 is not supported by gcc4.9.
You can search the available packages in FreeBSD using
pkg search <package_name>
and install whatever you want via
pkg install <package_name>
Note : you might need sudo before those commands if your current user is not root
Finally if you have problems such as
Fatal error : "some_file"."some_extension" file not found
you can search the package name via the aforementioned command and install them in order to compile successfully.
For example to mitigate the following error
fatal error: 'boost/intrusive_ptr.hpp' file not found
you can install the boost-libs package.

Installing Caffe on Linux Mint: /usr/bin/ld: cannot find -lhdf5_hl

Whenever I try installing caffe onto my linux mint machine, I keep getting this:
AR -o .build_release/lib/libcaffe.a
LD -o .build_release/lib/libcaffe.so.1.0.0
/usr/bin/ld: cannot find -lhdf5_hl
/usr/bin/ld: cannot find -lhdf5
collect2: error: ld returned 1 exit status
Makefile:572: recipe for target '.build_release/lib/libcaffe.so.1.0.0' failed
make: *** [.build_release/lib/libcaffe.so.1.0.0] Error 1
Do any of you know what I might be doing wrong? Thank you for responding.
If you build caffe using make + Makefile.config, add the location of libhdf5.so (can be retrieved by locate libhdf5.so), for example
/usr/lib/x86_64-linux-gnu/hdf5/serial, to LIBRARY_DIRS variable.
If you use cmake based build, add this path to LD_LIBRARY_PATH and run ldconfig:
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/hdf5/serial:$LD_LIBRARY_PATH
sudo ldconfig

error when trying to link libraries

I am trying to compile my c code on linux i386.
I have the sqlite3 library at:
/usr/lib/i386-linux-gnu/libsqlite3.so.0
/usr/lib/i386-linux-gnu/libsqlite3.so.0.8.6
but the linker does not find them. I even specified the path manually with the -L option which I suspect is not necessary:
cc -pthread -L/lib/i386-linux-gnu -L/usr/lib/i386-linux-gnu -L../i386/debug/lib/ ./bin/i386/debug/*.o -lsculib -lpthread -lsqlite3 -o ../i386/debug/bin/myProgram
/usr/bin/ld: cannot find -lsqlite3
collect2: error: ld returned 1 exit status
make: *** [../i386/debug/bin/core] Error 1
any ideas why it does not find them?
Presumably, you also need the header files.
$ sudo apt-get install libsqlite3-dev

Resources