RPI: Using lib bcm2835 from qt
-
Hello,
I would like to understand better what I am doing when I install qt cross compile in Ubuntu for Raspbian buster.
I've installed in my raspberry bcm2835 lib like this:
tar zxvf bcm2835-1.xx.tar.gz cd bcm2835-1.xx ./configure make sudo make check sudo make install
I don't know where this lib has installed, but if I run:
sudo find / bcm2835 | grep bcm2835
I find files in:
/sys/... /usr/include/linux/bcm2835-isp.h /usr/src/linux-headers-5.10.17+/.... /usr/local/include/bcm2835.h /usr/local/lib/libbcm2835.a /lib/modules/ ....
Now from ubuntu, I run:
rsync -avz --rsync-path="sudo rsync" pi@192.168.1.60:/lib sysroot rsync -avz --rsync-path="sudo rsync" pi@192.168.1.60:/usr/include sysroot/usr rsync -avz --rsync-path="sudo rsync" pi@192.168.1.60:/usr/lib sysroot/usr rsync -avz --rsync-path="sudo rsync" pi@192.168.1.60:/opt/vc sysroot/opt
Questions:
- Would I be able to #include <bcm2835.h> from Qt Creator in Ubuntu with my raspberry pi kit? The lib is /usr/local/include/bcm2835.h but /usr/local does not get rsync.
- Do I have to build again qt-everywhere and install? I have to do it every new lib I add?
- Extra: How can I know where make install files are deployed?
Thank you
-
After doing:
rsync -avz --rsync-path="sudo rsync" pi@192.168.1.60:/lib sysroot rsync -avz --rsync-path="sudo rsync" pi@192.168.1.60:/usr/include sysroot/usr rsync -avz --rsync-path="sudo rsync" pi@192.168.1.60:/usr/lib sysroot/usr rsync -avz --rsync-path="sudo rsync" pi@192.168.1.60:/opt/vc sysroot/opt
Qt Creator from Ubuntu does not find <bcm2835.h>
This is my output when I sudo make install my lib:
/bin/mkdir -p '/usr/local/lib' /usr/bin/install -c -m 644 libbcm2835.a '/usr/local/lib' ( cd '/usr/local/lib' && ranlib libbcm2835.a ) /bin/mkdir -p '/usr/local/include' /usr/bin/install -c -m 644 bcm2835.h '/usr/local/include
I've tried this with out success:
rsync -avz --rsync-path="sudo rsync" pi@192.168.1.60:/usr/local sysroot/usr/
I have my header in: sysroot/usr/local/include/bcm2835.h
-
@Drazz said in RPI: Using lib bcm2835 from qt:
I've tried this with out success
What does this mean? What happened?
-
@Drazz I was asking about:
I've tried this with out success:rsync -avz --rsync-path="sudo rsync" pi@192.168.1.60:/usr/local sysroot/usr/
Som what happened?
-
@jsulm said in RPI: Using lib bcm2835 from qt:
@Drazz I was asking about:
I've tried this with out success:
rsync -avz --rsync-path="sudo rsync" pi@192.168.1.60:/usr/local sysroot/usr/
Som what happened?Now, In my Ubuntu I have this:
/opt/qt5pi/sysroot/usr/local/include/bcm2835.h /opt/qt5pi/sysroot/usr/local/lib/libbcm2835.a
I open Qt Creator in my Ubuntu, select one random project and add in main.cpp
#include <bcm2835.h>
Build error:
../lifeRaspberry/main.cpp:18:21: fatal error: bcm2835.h: No such file or directory #include <bcm2835.h> ^ compilation terminated.
-
@Drazz You should add /usr/local/include folder to the include folders in your pro file. https://doc.qt.io/qt-5/qmake-variable-reference.html#includepath
-
@jsulm said in RPI: Using lib bcm2835 from qt:
@Drazz You should add /usr/local/include folder to the include folders in your pro file. https://doc.qt.io/qt-5/qmake-variable-reference.html#includepath
Worked.
Final thought... why do I have to include the path? Does libraries that are in sysroot/usr/include need to include path?
If I rsync my raspberry pi /usr/local with my ubuntu sysrooot/usr, I would be able to quit that INCLUDE path from my .pro?Thanks a lot for you time.
-
@Drazz /usr is automatically searched by tools like compiler. But /usrLocal is not, so you have to tell the compiler to also look there.
"If I rsync my raspberry pi /usr/local with my ubuntu sysrooot/usr, I would be able to quit that INCLUDE path from my .pro?" - if you sync to /usr instead of /usr/local then there is no need to add anything to include paths.