GStreamer-WARNING **: Failed to load plugins while they are existent - gstreamer

I am porting wayland KMS protocol to communication between waylandsink 1.12.2 and weston 2.0. I am getting stuck at loading some libraries.
They do exist in our system, but the errors still generated during run-time execution.
(gst-plugin-scanner:1694): GStreamer-WARNING **: Failed to load plugin '/usr/lib/gstreamer-1.0/libgstrsvg.so': librsvg-2.so.2: cannot open shared object file: No such file or directory
(gst-plugin-scanner:1694): GStreamer-WARNING **: Failed to load plugin '/usr/lib/gstreamer-1.0/libgstsdpelem.so': libgstsdp-1.0.so.0: cannot open shared object file: No such file or directory
(gst-plugin-scanner:1694): GStreamer-WARNING **: Failed to load plugin '/usr/lib/gstreamer-1.0/libgstuvch264.so': libgstapp-1.0.so.0: cannot open shared object file: No such file or directory
(gst-plugin-scanner:1694): GStreamer-WARNING **: Failed to load plugin '/usr/lib/gstreamer-1.0/libgstneonhttpsrc.so': libneon.so.27: cannot open shared object file: No such file or directory
(gst-plugin-scanner:1694): GStreamer-WARNING **: Failed to load plugin '/usr/lib/gstreamer-1.0/libgstsbc.so': libsbc.so.1: cannot open shared object file: No such file or directory
(gst-plugin-scanner:1694): GStreamer-WARNING **: Failed to load plugin '/usr/lib/gstreamer-1.0/libgsthls.so': libgstapp-1.0.so.0: cannot open shared object file: No such file or directory
(gst-plugin-scanner:1694): GStreamer-WARNING **: Failed to load plugin '/usr/lib/gstreamer-1.0/libgstvulkan.so': libvulkan.so.1: cannot open shared object file: No such file or directory
(gst-plugin-scanner:1694): GStreamer-WARNING **: Failed to load plugin '/usr/lib/gstreamer-1.0/libgstcamerabin.so': libgstapp-1.0.so.0: cannot open shared object file: No such file or directory
(gst-plugin-scanner:1694): GStreamer-WARNING **: Failed to load plugin '/usr/lib/gstreamer-1.0/libgstdashdemux.so': libgstapp-1.0.so.0: cannot open shared object file: No such file or directory
(gst-plugin-scanner:1694): GStreamer-WARNING **: Failed to load plugin '/usr/lib/gstreamer-1.0/libgstaudiovisualizers.so': libgstfft-1.0.so.0: cannot open shared object file: No such file or directory
(gst-plugin-scanner:1694): GStreamer-WARNING **: Failed to load plugin '/usr/lib/gstreamer-1.0/libgstwebp.so': libwebp.so.7: cannot open shared object file: No such file or directory
(gst-plugin-scanner:1694): GStreamer-WARNING **: Failed to load plugin '/usr/lib/gstreamer-1.0/libgstsmoothstreaming.so': libgstapp-1.0.so.0: cannot open shared object file: No such file or directory
-
root#machine:~# ls /usr/lib/gstreamer-1.0/libgstrsvg.so
/usr/lib/gstreamer-1.0/libgstrsvg.so
Anyone can explain this ? Thanks in advance.
Edit: It seemed that the problem came from broken symbolic links
# ldconfig
ldconfig: /usr/lib/libgstwayland-1.0.so.0 is not a symbolic link
ldconfig: /usr/lib/libgsturidownloader-1.0.so.0 is not a symbolic link
ldconfig: /usr/lib/libgstbadbase-1.0.so.0 is not a symbolic link
ldconfig: /usr/lib/libgstbadvideo-1.0.so.0 is not a symbolic link
ldconfig: /usr/lib/libgstphotography-1.0.so.0 is not a symbolic link
ldconfig: /usr/lib/libgstinsertbin-1.0.so.0 is not a symbolic link
ldconfig: /usr/lib/libgstmpegts-1.0.so.0 is not a symbolic link
ldconfig: /usr/lib/libgstplayer-1.0.so.0 is not a symbolic link
ldconfig: /usr/lib/libgstbadaudio-1.0.so.0 is not a symbolic link
ldconfig: /usr/lib/libgstbasecamerabinsrc-1.0.so.0 is not a symbolic link
ldconfig: /usr/lib/libgstadaptivedemux-1.0.so.0 is not a symbolic link
I tried to rebuild the system. Everything worked ok.

I suggest the following ways to resolve this:
You might have to re-configure and rebuild the libraries with the sources.
Or do apt-get install for any packages that resolves this library
The symlinks to these libraries might be mixed up due to the version numbers.
Also try reading this. Better answer over here.

Related

Why does gcc can't find opencv.hpp file?

I'm quite new to CMake, but I want to build a test .cpp file that includes OpenCV and shows me an image. I have built OpenCV in the path /usr/local and I have here folder with opencv.hpp file - /usr/local/include/opencv4/opencv2/opencv.hpp. Here is my CMakeLists.txt file:
cmake_minimum_required(VERSION 3.0)
project(cpp_proj)
find_package(OpenCV REQUIRED)
add_executable(cpp_proj opencv_cpp.cpp)
include_directories(${OPENCV4_INCLUDES})
target_link_libraries(cpp_proj )
I opened ~./bashrc and added there lines:
export OPENCV4_INCLUDES=/usr/local/include/
export OPENCV4_LIBRARIES=/usr/local/lib/
export PATH=$PATH:$OPENCV4_LIBRARIES
export PATH=$PATH:$OPENCV4_INCLUDES
When I run cmake in bash - everything is ok and even find_package finds OpenCV. But when I'm trying to run make it gives me a error:
pi#raspberrypi:~/Desktop/cpp_proj/build $ cmake ..
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/Desktop/cpp_proj/build
pi#raspberrypi:~/Desktop/cpp_proj/build $ make
[ 50%] Building CXX object CMakeFiles/cpp_proj.dir/opencv_cpp.cpp.o
/home/pi/Desktop/cpp_proj/opencv_cpp.cpp:1:10: fatal error: opencv2/opencv.hpp: No such file or directory
#include <opencv2/opencv.hpp>
^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/cpp_proj.dir/build.make:63: CMakeFiles/cpp_proj.dir/opencv_cpp.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/cpp_proj.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
I found questions with the same problem, but they didn't help me. What I am doing wrong? What could be the reason of this? Thanks!
In order to use a library you must specify the include directory as well as the libs.
With find_package (in module mode), in your case it should populate the variables OpenCV_INCLUDE_DIRS and OpenCV_LIBS for you to use.
So I recommend to add / alter your code to add the include directory & link the library (such as below)
target_include_directories(${CMAKE_PROJECT_NAME} public ${OpenCV_INCLUDE_DIRS})
target_link_libraries(${CMAKE_PROJECT_NAME} public ${OpenCV_LIBS})
I don't believe you ever need to touch ~./bashrc when using find_package

"*.so" linked library can't open it's shared object file

I am building project using some libraries and CMake.
There are two projects; first is library using *.so" file and second is library and executable based on the first.
But when I run executable file of second project,
I get the following error:
my_library: error while loading shared libraries: my_lib.so.0: cannot open shared object file: No such file or directory
CMakeLists.txt of FirstProject:
add_library(my_lib SHARED IMPORTED)
set_property(TARGET my_lib PROPERTY IMPORTED_LOCATION lib/my_lib/my_lib.so)
add_library(my_first_lib SHARED my_first_lib.cpp)
target_link_libraries(my_first_lib my_lib)
CMakeLists.txt of SecondProject:
add_library(my_second_lib my_second_lib.cpp)
target_link_libraries(my_second_lib ${my_first_lib_LIBRARIES})
add_executable(my_second_exe my_second_exe.cpp)
target_link_libraries(my_second_exe my_second_lib)
How to link "*.so" file properly?

How to link SDL2 manually in CMake

Recently I have started to learn CMake. To practice, I am trying to link SDL2 manually. I know that there is another way around using find_file which is easy. But I want to do it myself for practice.
I get an error when I try to link the libSDL2main.a file (running the Makefile using cmd mingw32-make)
[ 50%] Linking CXX executable exe0.exe
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: cannot find -llibSDL2main
collect2.exe: error: ld returned 1 exit status
CMakeFiles\exe0.dir\build.make:105: recipe for target 'exe0.exe' failed
mingw32-make[2]: *** [exe0.exe] Error 1
CMakeFiles\Makefile2:94: recipe for target 'CMakeFiles/exe0.dir/all' failed
mingw32-make[1]: *** [CMakeFiles/exe0.dir/all] Error 2
Makefile:102: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
Here is my CMakeLists.txt
cmake_minimum_required(VERSION 3.10)
project(SDL_Test_Project)
include_directories(include)
add_executable(exe0 main.cpp)
target_link_libraries(exe0 libSDL2main.a)
Here main.cpp is only a source file. I have put SDL2.dll and libSDL2main.a into the root of the project directory. (I used the CMake GUI to generate the Makefile in Windows 10).
If you want to link to the SDL2 libraries directly in target_link_libraries() (without defining IMPORTED targets, or using find_library()), use the full path to each library. The CMAKE_SOURCE_DIR variable provides the full path to the root directory of the CMake project:
target_link_libraries(exe0 PRIVATE
mingw32
${CMAKE_SOURCE_DIR}/libSDL2main.a
${CMAKE_SOURCE_DIR}/SDL2.dll
)
Note, for SLD2, you may also have to add the mingw32 to this command when using MinGW for compilation.

Using cmake to staticlly link to the C++ AWS SDK in linux fails by linking to a shared object file

I wish to build a c++ static executable to run in a docker alpine linux image. I have a requirement to link the AWS SDK in order to use their services. When linking dynamic everything works fine however I wish to static link to keep my docker image size down.
How do I tell cmake to use the .a file and not the .so file? This is the error I'm getting:
[100%] Linking CXX executable Server
/usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: attempted static link of dynamic object `/usr/lib/libcurl.so'
collect2: error: ld returned 1 exit status
make[2]: *** [Projects/Server/CMakeFiles/Server.dir/build.make:220: Projects/Server/Server] Error 1
make[1]: *** [CMakeFiles/Makefile2:146: Projects/Server/CMakeFiles/Server.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
/app # rm -Rf build/^C
Here is the line I'm using to build my project:
cmake\
../..\
-DCMAKE_FIND_LIBRARY_SUFFIXES=".a"\
-DCMAKE_EXE_LINKER_FLAGS="-static"\
-DBUILD_SHARED_LIBS=OFF\
-DCMAKE_CXX_FLAGS="-pthread"\
-DCMAKE_CXX_COMPILER=/usr/bin/g++\
-DCMAKE_C_COMPILER=/usr/bin/gcc
make -j4
Here is a cut down version of my CMakeLists:
project(Server)
file(GLOB source_files "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
file(GLOB header_files "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h")
add_executable(Server ${source_files} ${header_files})
target_include_directories(
Server
PRIVATE
)
find_package(AWSSDK REQUIRED COMPONENTS core s3 sqs)
target_link_libraries(
Server PUBLIC
ImageDB
/usr/local/lib64/libpqxx.a
${AWSSDK_LINK_LIBRARIES}
)

open cv build with cmake can't find libjpeg

i download opencv 3.1.0 and build it with cmake i unchecked BUILD_SHARED_LIBS
after building finish i try to compile an c++ code as static lib and this is my
CMakeListed.txt file
cmake_minimum_required(VERSION 2.8)
PROJECT(word)
set(OpenCV_DIR "/home/medozeus/videos/opencv/share/opencv")
FIND_PACKAGE( OpenCV REQUIRED )
INCLUDE_DIRECTORIES( ${OpenCV_INCLUDE_DIRS} )
ADD_EXECUTABLE(wordx main.cpp)
TARGET_LINK_LIBRARIES (wordx ${OpenCV_LIBS})
its compiled without error and i run the program also without error but when i send the program to another pc and run it its give me
error while loading shared libraries: libjpeg.so.8: cannot open shared object file: No such file or directory
this is my 3rdparty folder content after build
and the lib inside 3rdparty content
but the source code have all the library i don't know why when i build it only build one library in 3rdparty mabye this cause the error
error while loading shared libraries: libjpeg.so.8: cannot open shared object file: No such file or directory
this is my 3rdparty folder content in source code of open cv
any idea
The error means there is no libjpeg.so.8 file on target machine you are running your executable. You could try installing it:
sudo apt-get install libjpeg-dev