Solved .pro file setup for wiringPi cross compile on Pi
-
Hi all,
I have used cross compile and remote debug/ deployment for a while.
Everything goes well, until I decided to embedded wiringPi to my project. (I used to used it by calling it as Linux cmd )My Version : Qt 5.8 on both Ubuntu PC and rasp-Pi
===
My purpose :- If compile with "Desktop Qt 5.8 GCC" :
Block all wiring pi function by WIRING_PI flag.
eg.
#ifdef WIRING_PI .... digitalRead(pin); #endif
- If compile with my "raspi" kit :
Add WIRING_PI flag to DEFINES and
active the wiringPi function.
====
Here is my .pro file :INCLUDEPATH += /mnt/rasp-pi-rootfs/usr/include LIBS += -L/mnt/rasp-pi-rootfs/usr/lib -lwiringPi DEFINES += WIRING_PI
===
What condition should I use, to package above .pro code, to meet my purpose??
I tried ...linux { contains(QMAKE_TARGET.arch, arm.*):{ INCLUDEPATH += /mnt/rasp-pi-rootfs/usr/include LIBS += -L/mnt/rasp-pi-rootfs/usr/lib -lwiringPi DEFINES += WIRING_PI } }
but not works. Since it's remote deploy...the arch will always be my x86 Desktop.
It seems that I can judge the compiler?? Because they are different,
but I have no idea which macro relate to it.PS. I can compile/run them correctly, by themselves. But I want it can be compatible.
- If compile with "Desktop Qt 5.8 GCC" :
-
@Phong what about using the kit name for the conditions? as mentioned in this answer.
-
Thanks, It works~
-
I am attempting to do similar. Are you installing the wiringpi libraries on the rasp-Pi first? or just including the library when cross compiling?
-
@grk3010 You have to do both. You need the lib in your cross compile environment to be able to link your app and you need the lib on the target device to be able to execute your app there.
-
@jsulm
Ok, I've been doing some experimentation (successfully) with controlling the GPIO pins using direct register access by just defining a new "mmapGpio" class using modified code from here:
http://www.hertaville.com/rpimmapgpio.htmlI am deploying this on a lightweight embedded linux image on rpi3 that does not have the wiringpi libraries installed. This approach is working fine, but where I am running into problems is when I am trying to incorporate some additional technology such as interrupts and integrating analog i/o cards. This is where I need to use the wiringpi or similar libraries.
It sounds like I will need to build or find an embedded linux image that includes the wiringpi libraries. Or is there any other way to accomplish this or deploy the libraries during cross compile?
-
@grk3010 please don't hijack the thread. You've moved from ".pro file setup" into "how to deploy a library while cross-compiling"... :-) so you'd better open a new post on such topic. Thanks.
-
@Pablo-J.-Rogina
Sorry, I have moved inquiry to its own post.thanks