Solved path of bcm2835 library after install it in linux
-
hello people, I have installed in linux bcm2835 library of pi2
I need the path of the installed library for the integrating into qt creator denn i make a cross-compilling.
i done this: sudo find / -name bcm2835* but do not help me -
if you did
make install
there is alibbcm2835.a
in/usr/local/lib
and abcm2835.h
in/usr/local/include
I guess you used this guid (https://wiki.qt.io/RaspberryPi2EGLFS) for cross build qt . If so, you have to copy thelibbcm2835.a
from/usr/local/lib
to/usr/lib
and thebcm2835.h
from/usr/local/include
to/usr/include
and rsync your sysroot again. -
yes i used that guid (https://wiki.qt.io/RaspberryPi2EGLFS)
yes i did make install
yes i looked libbcm2835.a is in /usr/local/lib and a bcm2835.h is in /usr/local/include
that mean i only need to rsync bcm2835.h und bcm2835.a like you say and write this in Qtcreator
projektname dann right click/add library/extern library
library file=~/raspi/sysroot
include path=~/raspi/sysroot
is it true? -
after rsync you can include the header with
#include <bcm2835.h>
in your project without the need of adding an extra header path. Also you dont need to specify an linker path. Just addLIBS += -llibbcm2835
to your .pro file. -
that mean i do this :
-
copy the libbcm2835.a from /usr/local/lib to /usr/lib and the bcm2835.h from /usr/local/include to /usr/include and rsync your sysroot again.
-
rsync -avz pi@IP:/lib sysroot
rsync -avz pi@IP:/usr/include sysroot/usr
rsync -avz pi@IP:/usr/lib sysroot/usr
rsync -avz pi@IP:/opt/vc sysroot/opt -
-header file #include <bcm2835.h>
-.pro file add LIBS += -llibbcm2835
-
-
exactly! And keep in mind, that using bcm283 lib requires to run your program with root privilege. If your running your program from qt creator with pi user it will cause an access denied error. You can either run the deployed program with sudo on your pi directly or enable root for ssh and use the root to start the debug session from qt creator.
-
@sneubert :i get this two error after build
cannot find -llibbcm2835
ld returned 1 exit status -
sorry try
-lbcm2835
-
thanks it work
-
please mark thread as solved