Cross compile OpenCV for a RaspberryPI - c++

i've been trying to make an application that combines Qt and OpenCV, and then deploy this application on a RaspberryPi.
i managed to cross compile Qt to run applications i built on my host machine on the RaspberryPi but whenever i want to use OpenCV with it, i fail to get to work. The first time i had incompatible libraries with ARM (they were x86-64) and now when i installed ARM version of OpenCV i get this error in Qt Creator (cannot find -lm).
Can u please tell me how to cross compile OpenCV as well ? Thank you

Related

ARM platform specific Qmake.bin

I have been trying to develop a GUI using Qt on STM32MP157C-DK2 as provided by STMicroelectronics.
I am using the SW suite which is given by them i.e https://www.st.com/en/embedded-software/stm32mp1dev.html
y query revolves around the issue where-in i am trying to configure a Qt project for this field
enter image description here
I can seem to find qmake.bin specific to ARM architecture.
If i do qmake --version on my linux host i get o/p as
QMake version 3.1
Using Qt version 5.12.8 in /usr/lib/x86_64-linux-gnu
But if i used this qmake.bin for configuration then QT complains that it is not able to find compatability between the target compiler configuration and current qmake which is 64-bit linux based.
From where i can get a qmake.bin for my stm32mp1 platform ? Any leads will be highly appreciated.

How to know which library is creating a dependency to a shared library

I have the next problem, I'm developing a cuda application for the jetson TX2 board. All the development it's done in a ubuntu machine and then I run the program remotely in the jetson.
I'm using CUDA 10.0 and the PCL library 1.9.1 that was built from sources in the jetson with CUDA and QT5 features. I also compiled from sources in the jetson the VTK library and boost 1.65. Everything compiles fine but every time I try to run my program in the jetson I get the next error:
error while loading shared libraries: libcufft.so.9.0
Because I'm using CUDA 10 I don't have this library and in code I don't any reference to cufft so I guess that a library I'm using is creating this dependency. What I want to know is if there is some way to know what part of the code or what library could be creating this dependency in order to remove the error.
I have tried the command LDD but this command tell me that the program needs the cufft.so.9.0 library but not tell me which part of the code could be creating this dependency.
Next I summarize all the libraries I'm using:
PCL 1.9.1
VTK 8.0
Eigen
Libflann 1.9
Patate library
I'm also using Nvidia nsight eclipse.
Thank you!

Trying to build c++ for a remote arm device on QtCreator, executable is 64bit

I have a board with zynq chipset and Armv7 processor and Ubuntu 12.04. I want to remotely build and debug a c++ program on it with QtCreator.
I tried to create a kit for building the program using this link. added the compiler in the toolchains of board and added qt version 4.8.1 to the kit (version of qt on the board is 4.8.1).
The code builds successfully. the problem is the binary is not executable on my board because it seems it is a 64bit binary and my board is not 64bit.
Am I missing something?
how can I check if my config for compiling qt everywhere source was correct and it resulted in the qmake I wanted?
btw my own OS is Ubuntu 16.04 64bit.
The instruction on the Xilinx's page instruct how to build a cross compiler for ARM, however I belive they assumed you're going to follow these steps on 32-bit Linux platform. On the other hand -xplatform qws/linux-arm-gnueabi-g++ option should produce 32bit compiler.
Are you sure your code is build with right compiler build with right option? have you trie to build any minimal example from command line and check what file command is telling you about the binary produced? For me it looks like, do don't really cross-compile your project.
after hours and hours of searching and trying different things I found the reason. First of all as #michal-f said I installed 32-bit Ubuntu. making in terminal was resulting in ARM binary but QtCreator just compiled for intel proccessor.
as stupid as it seems the reason was that I did not know that Qt variables is not related to system variables and though I had added CROSS_COMPILE variable in terminal, I should have added it to my kit environmental variables too.
so the phrase ${CROSS_COMPILE}g++ in MakeFile was simply g++ and the output was a binary compile with system g++.
I know it was something I should have found sooner, but something this stupid should have been somewhere on internet for beginners like me. So hopefully next person encountering this same problem will find this post.

Error while setting cross compiler in QT5.2.1

I am working on cross compiling QT apps for BeagleBone Black.
I have installed QT5.2.1 on Ubuntu 14.04 and its working perfectly for Ubuntu.
I have installed compiler gcc-linaro-arm-linux-gnueabihf 4.8-2013.04-20130417_linux for cross compilation.
But when I am setting up cross compiler I getting red mark on my kit option and error below :
The Compiler 'xxxxxxxxx'(arm-linux-generic-elf-32bit) cannot produce code for QT version QT 5.2.1 in PATH QT5 (x86-linux-generic-elf-32bit)
Screen shot is below:
I have tried other tool chain also but with no success.
I am unable to understand where I am getting wrong and how to resolve it.

OpenCV can not find library on launch. Backwards compatibility?

I am trying to build and use a piece of C++ code that uses OpenCV. I am working on Linux, working in Code::Blocks (and the code was originally also developed on a Linux platform using C::B).
I followed this to install OpenCV (Ubuntu 12.04 & OpenCV 2.4.3). The project compiles fine, but when I try to execute it, it crashes on launch, with the following message about how it can not find the library:
(file_address): error while loading shared libraries: libopencv_core.so.2.3:
cannot open shared object file: No such file or directory
Process returned 127 (0x7F) execution time : 0.017 s Press ENTER to continue.
I set all the parameters for the linker according to several Code::Blocks install tutorials.
I also checked in /usr/local/lib/ for my libraries (it is the folder I gave to Code::Blocks' compiler); and while I do have a libopencv_core.so, a libopencv_core.so.2.4 and a libopencv_core.2.4.3, I do not have a libopencv_core.so.2.3.
So I'm wondering what the issue is. Is it about backwards compatibility, i.e. do I have to install the exact same version of OpenCV used to develop the original code? (This would be a bit concerning, since I am trying to make a widely-usable library).
Could I force it to use libopencv_core.so.2.4 instead?
EDIT: I managed to make it work by removing everything and reinstalling with a simple apt-get. Sometimes it's the simplest method that works the best! From now on I'll try to apt-get before following installation tutorials. ;)
Have a nice day!