Qt Cross Compile Library Path for Raspberry pi 3
-
wrote on 29 Jul 2019, 06:05 last edited by qtross
Hi,
I followed instructions in this website for cross compile link and I am able to build succesfully to my Raspberry pi target machine. However, I would like to cross compile with opencv, wiring pi and, raspicam c++ libraries. Before cross compile I already installed these libraries on raspberry pi, to understand cross compiling procedure with libraries I just tried and build an app with opencv library and I could not make it work. While setuping cross compile, I can reach the needed libraries in sysroot folder(raspi/sysroot/usr/include/opencv or opencv2) which were transferred from raspberry pi to my local machine. in .pro file I showed this folder path as in the picture:INCLUDEPATH += /home/nehir-arda/raspi/sysroot/usr/include/opencv
INCLUDEPATH += /home/nehir-arda/raspi/sysroot/usr/include/opencv2
#LIBS += -L/usr/local/lib -lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_videoio -lopencv_imgcodecs -lopencv_features2d
LIBS += -L/home/nehir-arda/raspi/sysroot/usr/lib/arm-linux-gnueabihf -lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_videoio -lopencv_imgcodecs -lopencv_features2dBut, when I try to build it gives my error which says cannot find opencv libraries. What might be the problem?
Thank you for any suggestions.
-
Hi,
I followed instructions in this website for cross compile link and I am able to build succesfully to my Raspberry pi target machine. However, I would like to cross compile with opencv, wiring pi and, raspicam c++ libraries. Before cross compile I already installed these libraries on raspberry pi, to understand cross compiling procedure with libraries I just tried and build an app with opencv library and I could not make it work. While setuping cross compile, I can reach the needed libraries in sysroot folder(raspi/sysroot/usr/include/opencv or opencv2) which were transferred from raspberry pi to my local machine. in .pro file I showed this folder path as in the picture:INCLUDEPATH += /home/nehir-arda/raspi/sysroot/usr/include/opencv
INCLUDEPATH += /home/nehir-arda/raspi/sysroot/usr/include/opencv2
#LIBS += -L/usr/local/lib -lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_videoio -lopencv_imgcodecs -lopencv_features2d
LIBS += -L/home/nehir-arda/raspi/sysroot/usr/lib/arm-linux-gnueabihf -lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_videoio -lopencv_imgcodecs -lopencv_features2dBut, when I try to build it gives my error which says cannot find opencv libraries. What might be the problem?
Thank you for any suggestions.
@qtross Libs are usually NOT inside include directories! It should be /home/.../usr/lib
-
wrote on 29 Jul 2019, 06:33 last edited by qtross
@jsulm Thanks for the reply, I changed the path and, I have now this warning;
Before cross compile, I already had opencv installed on my local machine and I still have. Though, missing file exists in sysroot/usr/lib folder, do you think that having another opencv library on local machine cause that warning? Because, after cross compile, I did not symmlink transferred libraries on my local machine.
Thanks -
@jsulm Thanks for the reply, I changed the path and, I have now this warning;
Before cross compile, I already had opencv installed on my local machine and I still have. Though, missing file exists in sysroot/usr/lib folder, do you think that having another opencv library on local machine cause that warning? Because, after cross compile, I did not symmlink transferred libraries on my local machine.
Thanks@qtross Please do not post screen-shots, post text!
How did you configure your Kit? You should set the sysroot."Before cross compile, I already had opencv installed on my local machine and I still have. Though, missing file exists in sysroot/usr/lib folder, do you think that having another opencv library on local machine cause that warning?" - this is not how cross compiling works. It doesn't matter what you installed on your host machine. What matters is what is in your sysroot.
-
@qtross Please do not post screen-shots, post text!
How did you configure your Kit? You should set the sysroot."Before cross compile, I already had opencv installed on my local machine and I still have. Though, missing file exists in sysroot/usr/lib folder, do you think that having another opencv library on local machine cause that warning?" - this is not how cross compiling works. It doesn't matter what you installed on your host machine. What matters is what is in your sysroot.
wrote on 29 Jul 2019, 06:58 last edited by qtross@jsulm said in Qt Cross Compile Library Path for Raspberry pi 3:
/home/nehir-arda/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: warning: libblas.so.3, needed by /home/nehir-arda/raspi/sysroot/usr/lib/libarmadillo.so.9, not found (try using -rpath or -rpath-link)
/home/nehir-arda/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: warning: liblapack.so.3, needed by /home/nehir-arda/raspi/sysroot/usr/lib/libarmadillo.so.9, not found (try using -rpath or -rpath-link)Sorry about it, this is text version of my warning. My local machine name is :nehir-arda. I showed as local in first picture, but I corrected while I was building.
It says libarmadillo.so.9 and libblass.so.3 are missing but I can find them in the same folder that gives error.
And my sysroot path :
/home/nehir-arda/raspi/sysroot
-
@jsulm said in Qt Cross Compile Library Path for Raspberry pi 3:
/home/nehir-arda/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: warning: libblas.so.3, needed by /home/nehir-arda/raspi/sysroot/usr/lib/libarmadillo.so.9, not found (try using -rpath or -rpath-link)
/home/nehir-arda/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: warning: liblapack.so.3, needed by /home/nehir-arda/raspi/sysroot/usr/lib/libarmadillo.so.9, not found (try using -rpath or -rpath-link)Sorry about it, this is text version of my warning. My local machine name is :nehir-arda. I showed as local in first picture, but I corrected while I was building.
It says libarmadillo.so.9 and libblass.so.3 are missing but I can find them in the same folder that gives error.
And my sysroot path :
/home/nehir-arda/raspi/sysroot
@qtross said in Qt Cross Compile Library Path for Raspberry pi 3:
It says libarmadillo.so.9 and libblass.so.3 are missing but I can find them in the same folder that gives error.
In your sysroot?
-
@qtross said in Qt Cross Compile Library Path for Raspberry pi 3:
It says libarmadillo.so.9 and libblass.so.3 are missing but I can find them in the same folder that gives error.
In your sysroot?
-
Yes I can find libarmadillo.so.9 and libblass.so.3 in this folder
/home/nehir-arda/raspi/sysroot/usr/lib
@qtross libblas.so.3 and liblapack.so.3 are not found actually, so are those two in your sysroot?
-
@qtross libblas.so.3 and liblapack.so.3 are not found actually, so are those two in your sysroot?
-
@jsulm Yes i can find them but their folder is different:
/home/nehir-arda/raspi/sysroot/usr/lib/arm-linux-gnueabihf
I changed the path with the one above and could not build again.
@qtross How did you create the sysroot?
-
wrote on 29 Jul 2019, 07:32 last edited by qtross
@jsulm I created with these commands:
mkdir sysroot sysroot/usr sysroot/opt
rsync -avz pi@raspberrypi.local:/lib sysroot
rsync -avz pi@raspberrypi.local:/usr/include sysroot/usr
rsync -avz pi@raspberrypi.local:/usr/lib sysroot/usr
rsync -avz pi@raspberrypi.local:/opt/vc sysroot/optI changed raspberrypi.local with my raspberry pi adress.
And symlink with these commands:
wget https://raw.githubusercontent.com/Kukkimonsuta/rpi-buildqt/master/scripts/utils/sysroot-relativelinks.py
chmod +x sysroot-relativelinks.py
./sysroot-relativelinks.py sysroot -
@jsulm I created with these commands:
mkdir sysroot sysroot/usr sysroot/opt
rsync -avz pi@raspberrypi.local:/lib sysroot
rsync -avz pi@raspberrypi.local:/usr/include sysroot/usr
rsync -avz pi@raspberrypi.local:/usr/lib sysroot/usr
rsync -avz pi@raspberrypi.local:/opt/vc sysroot/optI changed raspberrypi.local with my raspberry pi adress.
And symlink with these commands:
wget https://raw.githubusercontent.com/Kukkimonsuta/rpi-buildqt/master/scripts/utils/sysroot-relativelinks.py
chmod +x sysroot-relativelinks.py
./sysroot-relativelinks.py sysroot -
wrote on 11 May 2021, 13:13 last edited by
@Fawkees said in Qt Cross Compile Library Path for Raspberry pi 3:
I'm confronted with the same problem right now
this post seems a little old, could it be possible you create a new one of your own, explaining what you've done so far and what issues you're facing? thanks.