last week I recieved my brand new Colibri VF61 with the Aster carrier board from Toradex.
I followed Toradex's guide on how to prepare the board to cross compile with qt here.
Everything from the tuturial went perfect, however I tried deploying my app and everything goes fine until I open the executable on my target device because I get the following message :
error while loading shared libraries: libQt5PrintSupport.so.5: cannot open shared object file: No such file or directory
I went to see if I had any Qt files in my target device at all, and there weren't so I went to my sysroot folder in my host device and I copied all the Qt files to my target device, (Qt5PrintSupport was there) but after I copied all the files in the exact same location as they where in my sysroot the same error keep appearing.
The files I copied were:
LibIcal Qt5Core Qt5OpenGLExtensions Qt5Svg
PulseAudio Qt5DBus Qt5Positioning Qt5SystemInfo
Qt5 Qt5Declarative Qt5PrintSupport Qt5Test
Qt53DCore Qt5Designer Qt5PublishSubscribe Qt5UiPlugin
Qt53DExtras Qt5Enginio Qt5Qml Qt5UiTools
Qt53DInput Qt5Gui Qt5Quick Qt5WebChannel
Qt53DLogic Qt5Help Qt5QuickTest Qt5WebKit
Qt53DQuick Qt5LinguistTools Qt5QuickWidgets Qt5WebKitWidgets
Qt53DQuickExtras Qt5Location Qt5Script Qt5WebSockets
Qt53DQuickInput Qt5Multimedia Qt5ScriptTools Qt5Widgets
Qt53DQuickRender Qt5MultimediaWidgets Qt5Sensors Qt5X11Extras
Qt53DRender Qt5Network Qt5SerialPort Qt5Xml
Qt5Bluetooth Qt5Nfc Qt5ServiceFramework Qt5XmlPatterns
Qt5Concurrent Qt5OpenGL Qt5Sql libxml2
Inside /usr/lib/cmake
and:
imports libexec mkspecs plugins qml
folders to /usr/lib/qt5
I have noticed that the problem may be that I dont have the "lib" folder inside /usr/lib/qt5 however I don't know how to create it since it wasn't in my sysroot.
Summing up: I want to execute my app by cross compiling but the lib folder is missing and I don't know how to create it or link it.
Having a library in the same path with the app using it doesn't necessarily mean that your app can find it. Follow one of the methods below;
Install the required qt libraries into system's standard lib directory(e.g. /usr/lib/)
Set environment variable LD_LIBRARY_PATH to where your qt libraries exist. Convention is generally having a bash script setting it then launching your app) or
At compile time, you set rpath variable to the location of qt libraries folder (-rpath for gcc)
Related
I tries to use FOREACH to generated several pb files. And make two list names PROTO_SRCS & PROTO_HDRS like below.
I can use it in the main CMakeLists. Like add_executable(a SHARED ${PROTO_SRCS} main.cpp).
But I can not use this param in subdirectories to make a library. when I type "cmake .." in main CMakelists build dir. It shown that "Cannot find source file: a.pb.cc".
main CMakeLists.txt
add_library(xxx SHARED ${PROTO_SRCS})
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/back back)
in src/back CMakeLists.txt
add_executable(yyy ${PROTO_SRCS})
and I can use message to show ${PROTO_SRCS} in subdir so it pass into successfully.
Please help me to point out the problem. Thx a lot
The issue is that in CMake versions older than 3.20 the GENERATED property of source files is only visible in the directory where it is set. Thus, when you add the protobuf-generated source files to a target defined in a different directory, CMake will no longer know that these are files generated during the build. Consequently, CMake will try to locate these files at configuration time, when they obviously do not exist yet.
Unfortunately, at the time of writing there is only a release candidate for CMake 3.20 and no official release yet. So depending on whether you need to coordinate with other coworkers or whether you're working on this project on your own it might not be feasible to use the release candidate.
If you can't use it, the alternative is to create an object library via add_library(protobuf_objs OBJECT ${PROTO_SRCS}) in the directory where you generate the files and to use target_sources(xxx PRIVATE $<TARGET_OBJECTS:protobuf_objs>) and target_sources(yyy PRIVATE $<TARGET_OBJECTS:protobuf_objs>) instead of adding the ${PROTO_SRCS} as source files to these targets directly.
I am working at a Robot Communication system. This System runs on Ubuntu. To get a working communication I need to install a debian package which installs a library with shared objects.
I want to get that working on an ARM-device. I can not install the debian-package on the ARM-device. I am thinking about trying to cross compile the binary. The Problem is that it depends on binaries for x86-64. Is there any way to still get the executable working on the ARM-device?
For compiling I am using a cmake file which loos like this (without cross-compiling):
cmake_minimum_required(VERSION 2.8)
project(dummy_service)
find_package(XXX)
include_directories(${XXX_INCLUDE_DIR})
link_directories(${XXX_LIBRARY_DIR})
XXX_message_library(
TARGET XXX_messages
DIRECTORY msg
STATIC)
add_executable(dummy_service src/dummy_service.c++)
target_link_libraries(dummy_service ${XXX_LIBRARY} dummy_messages)
As the XXX library is not owned by our company and not public, I am not allowed to talk about it, but I could answers questions if you have any.
The debian package includes following objects:
-bin
--xxx-gen
--xxx-core
--xxx-master
-include
--headerfiles
---xxx.h
---types.h
---internal
----utilities.h
----descriptors.h
----logging.h
----master.h
----service.h
-lib
--libxxx.so
--cmake
---.cmake files
I am trying to compile this project: https://github.com/computationalpathologygroup/ASAP.git from source.
Pugixml is a dependency
I have built pugixml from source and set PugiXML_DIR and PUGIXML_INCLUDE_DIR And it still gives me error: "CMake Error: The following variables are used in this project, but they are set to NOTFOUND."
Things I have tried:
I am doing this on windows, using cmake 3.14 and visual studio 2017.
I have successfully built pugixml from source and included the .lib file as well
I have tried including and excluding combinations of PUGIXML_INCLUDE_DIR, PUGIXML_LIBRARY, PugiXML_DIR.
This is the error I get:
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
cpp/ASAP/annotation/PUGIXML_INCLUDE_DIR
used as include directory in directory
/cpp/ASAP/annotation
cpp/ASAP/multiresolutionimageinterface/PUGIXML_INCLUDE_DIR
used as include directory in directory cpp/ASAP/multiresolutionimageinterface
Other information: setting PugiXML_DIR is mandatory, and the cmake looks for a file named "pugixml-config.cmake" in that directory. And the config cmake file is supposed to point to compiled lib file. But when it wasn't able to find, I simply copied the lib file I compiled to the location pugixml-config.cmake was pointing.
In ASAP versions before 4.04.2019 they play dirty games with extracting include directory from the IMPORTED target. annotation/CMakeLists.txt:30:
get_target_property(PUGIXML_INCLUDE_DIR pugixml INTERFACE_INCLUDE_DIRECTORIES)
In some cases this results in setting PUGIXML_INCLUDE_DIR variable to "-NOTFOUND", thus you got corresponded error message from CMake.
In commit 36d8bd75 they add FindPugiXML.cmake script, which handle find_package(PugiXML) call instead of configuration script shipped with PugiXML. In that find script they obtain include directory with find_path, which looks more natually:
find_path(PugiXML_INCLUDE_DIR pugixml.hpp)
Because in newer ASAP versions the configuration script (pugixml-config.cmake), shipped with PugiXML, is no longer used, one cannot hint about PugiXML location with PugiXML_DIR or PugiXML_ROOT. In case PugiXML is installed into non-system-default location, one may simply set PugiXML_INCLUDE_DIR variable to the PugiXML include directory.
I am trying to make a C++ program that uses the OpenSubdiv library from Pixar: https://github.com/PixarAnimationStudios/OpenSubdiv
I have managed to build the library, including the "tutorials", which uses the library.
Both OpenSubdiv and my own program is built with CMake (which I have some, but not much experince with). For testing purposes, I have a project folder where my C++ code lies, and I inside this folder I also have an OpenSubdiv folder where I have built the library in OpenSubdiv/build. The C++ code That I am using for testing purposes is identical to one of the tutorials provided by pixar with opensubdiv, called "far_tutorial_0.cpp". This tutorial compiles and work fine inside the Opensubdiv folder, with the very long and complex CMake script intended to install the entire library. However, when I move it out of the Opensubdiv folder, and try to compile with a simple CMake script, I get problems. This is the CMake script that I use:
cmake_minimum_required (VERSION 2.6)
project (test)
add_executable(test test.cpp)
include_directories(OpenSubdiv/build)
target_link_libraries(test osdCPU)
This manages to compile the code without any error messages, but when I try to execute the code, it says "error while loading shared libraries: libosdCPU.so.3.0.0.beta: cannot open shared object file: No such file or directory".
I have tried change the library name to "osdCPU.so.3.0.0.beta" (which gives an error while compiling), and I have tried using both library names (which gives the same error). The file "libosdCPU.so.3.0.0.beta" is inside the OpenSubdiv/build/lib folder, right next to "libosdCPU.so".
Does anybody know what's wrong?
You also have to provide the location of the library osdCPU with the CMake command link_directories.
Moreover, I encourage you to formalize your code with specific variables like this (including a cache variable you can modify through the command ccmake) :
set(osdCPU_PATH_DEFAULT "/default/path/to/osdCPU")
set(osdCPU_PATH "${osdCPU_PATH_DEFAULT}" CACHE PATH "Path to osdCPU")
set(osdCPU_INCLUDE_DIRS ${osdCPU_PATH}/include)
set(osdCPU_LIBRARY_DIRS ${osdCPU_PATH}/lib)
set(osdCPU_LIBRARIES osdCPU)
Then you can call
include_directories(${osdCPU_INCLUDE_DIRS})
link_directories(${osdCPU_LIBRARY_DIRS})
# ...
target_link_libraries(test ${osdCPU_LIBRARIES})
hi every one i have installed qwt and include the path
INCLUDEPATH += /usr/local/qwt-6.0.0-rc5/include
LIBS += -L/usr/local/qwt-6.0.0-rc5/lib -lqwt
in my pro file
but when i run my program i get the error
error while loading shared libraries: libqwt.so.6: cannot open shared object file: No such file or directory
/home/cv/abc/abc exited with code 127
even i remove the paths i.e INCLUDE and LIBS and all qwt related thing i am still getting an error am i missing some thing kingly help me
i am using ubuntu 10.04
thanks
In order to execute any program using a shared library, you have to specify where they are.
In your case, you are using shared libraries located at /usr/local/gwt-6.0.0-rc5/lib and you have to tell Linux "ld" that this path is a library path.
To do that, you can include this path at the LD_LIBRARY_PATH environment variable or add it to the /etc/ld.so.conf (or even as a file inside /etc/ld.so.conf.d). After that, ensure you run "ldconfig" make the system aware of this change and try again.