ld: library not found for -lrt - c++

I am trying to run a project that was made and works for Ubuntu but on Mac OS. And when I am doing the make I got the following error:
ld: library not found for -lrt
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [consumer] Error 1
make[1]: *** [CMakeFiles/consumer.dir/all] Error 2
make: *** [all] Error 2
I can't see any library with that name at thole project.
Can anyone explain what it is and how to solve it?

On old Linux systems, several functions, such as clock_gettime, are documented to need -lrt for old versions of GNU libc. This is no more the case on recent glibc (after 2.17 from 2013).
So you can remove -lrt from your Makefile (and remove the thing from your cmake configuration thing generating it).
BTW, removing -lrt should also fit for recent Linux distributions.
PS. If you are paying support for your Linux system, you should ask your support for advice.

Related

Error with linking flag when using the cmake build for cppyy

I am trying to build the example for a make build for cppyy in the cppyy-knearestneighbors example (https://github.com/jclay/cppyy-knearestneighbors-example). From what I understand it used the more modern cppyy cmake.
However when it comes to the linking I find this error,
ld: unknown option: --no-as-needed
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [knn_example/libknn_exampleCppyy.dylib] Error 1
make[1]: *** [CMakeFiles/knn_exampleCppyy.dir/all] Error 2
make: *** [all] Error 2
I couldn't find away to remove this flag as it seems to be something internal to cppyy cmake. Is there any work around to fix the compilation?
I cannot talk about cppyy since I have never used it, but since it internally uses CMake, the issue that you have could control by the value of the LINK_WHAT_YOU_USE property.
I would first try to disable the default value of LINK_WHAT_YOU_USE with:
# When running cmake configure:
cmake -GNinja -DCMAKE_LINK_WHAT_YOU_USE=OFF
If it does not work, a more evolve approach which means iterating all of the targets and unsetting their LINK_WHAT_YOU_USE property. Let me know if you need help for this
https://cmake.org/cmake/help/latest/variable/CMAKE_LINK_WHAT_YOU_USE.html#variable:CMAKE_LINK_WHAT_YOU_USE

I cannot build the library for feature engineering written by c++

I tried to build this library, but couldn't make it.
This documentation for the library tells us how to install it.
After I run ./configure file, I run ./install file and got the following error.
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[2]: *** [libfeat_lib.dylib] Error 1
make[1]: *** [CMakeFiles/feat_lib.dir/all] Error 2
make: *** [all] Error 2
I made a new issue(there is more info for this error), but I cast this question also here to get some solutions.
How should I do to fix this?
Or, could you build this library?
My environment is here:
Mojave 10.14.6
Using Anaconda
Python 3.6.8
cmake version 3.15.5
GNU Make 3.81
Eigen 3.3.4
Shogun installed by homebrew
Thank you.

Vulkan SDK Version 1.1.85.0 linking on Kubuntu 18.10

I'm currently working on a game engine with vulkan.
I just wanted to try whether it compiles on linux, but I don't know how to link my Vulkan SDK libraries. I downloaded the "vulkansdk-linux-x86_64-1.1.85.0.tar.gz" from the LunarG homepage, but now I dont know what I should link under "target_link_libraries".
I tried to link the "libvulkan.so" from the lib folder, but it does not work.
Some help from you would be great, because I never worked with CMAKE on linux.
/usr/bin/ld: cannot find -lvulkan
collect2: error: ld returned 1 exit status
make[3]: *** [CMakeFiles/Untitled.dir/build.make:669: ../output_linux /Untitled] Error 1
make[2]: *** [CMakeFiles/Makefile2:73: CMakeFiles/Untitled.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:85: CMakeFiles/Untitled.dir/rule] Error 2
make: *** [Makefile:118: Untitled] Error 2
Thanks for help,
Marlon
The SDK's Linux Getting Started Guide found in your SDK tarball and at this link explains much of this. In fact, there's even a section called "Using Vulkan in CMake Projects" that shows how to use the FindVulkan CMake module. The SDK also contains numerous example programs, also built with CMake.

opencv installation error ubuntu

I'm trying to install opencv to my Ubuntu 14.04 machine using the documentation provided in
http://docs.opencv.org/doc/tutorials/introduction/linux_install/linux_install.html#linux-installation
However, during the compilation process I get the following error.
Linking CXX shared library ../../lib/libopencv_videoio.so
/usr/bin/ld: /usr/local/lib/libavcodec.a(avpacket.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libavcodec.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libopencv_videoio.so.3.0.0] Error 1
make[1]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2
make: *** [all] Error 2
I noticed a few posts mentioning similar errors and some solutions suggest removing the libavcodec.a from /usr/local/lib/. I'd like not to do that as I need ffmpeg libraries in the machine as well.
Could someone please help me to resolve this issue?.
Thanks
I got it to work (for installing ffmpeg) by simply reinstalling the whole thing from the beginning with all instances of $ ./configure replaced by $ ./configure --enable-shared (first make sure to delete all the folders and files including the .so files from the previous attempt).
Apparently this works because https://stackoverflow.com/a/13812368/10593190.
And this matches with #camino's comment on https://stackoverflow.com/a/19365454/10593190 and XavierStuvw's answer.
Just run these 2 lines in your terminal/environment:
pip install opencv-python==3.4.5.20
pip install opencv-contrib-python==3.4.5.20

Compiling LibQGLViewer fails due to library not found lGLU

I was trying to compile libQGLViewer in OS X Yosemite but after executing make the following error appears
ld: library not found for -lGLU
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [/Users/MyUser/Library/Frameworks/QGLViewer.framework/QGLViewer] Error 1
make: *** [sub-QGLViewer-make_first-ordered] Error 2
I found that there is a library called libGLU.1.dylib under /usr/X11/lib but I have no idea on where to add that line in order to compile correctly the library. Moreover, I don't know if it is the right library that the compilation is asking for.
Any thoughts?
It was easy to solve the problem by simply removing the following line
QMAKE_LIBS_OPENGL *= -lGLU
from all the .pro files in libQGLViewer