Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. .pro file setup for wiringPi cross compile on Pi
Qt 6.11 is out! See what's new in the release blog

.pro file setup for wiringPi cross compile on Pi

Scheduled Pinned Locked Moved Solved Mobile and Embedded
8 Posts 4 Posters 5.0k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Phong
    wrote on last edited by Phong
    #1

    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.

    1 Reply Last reply
    0
    • Pablo J. RoginaP Offline
      Pablo J. RoginaP Offline
      Pablo J. Rogina
      wrote on last edited by
      #2

      @Phong what about using the kit name for the conditions? as mentioned in this answer.

      Upvote the answer(s) that helped you solve the issue
      Use "Topic Tools" button to mark your post as Solved
      Add screenshots via postimage.org
      Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

      P 1 Reply Last reply
      1
      • Pablo J. RoginaP Pablo J. Rogina

        @Phong what about using the kit name for the conditions? as mentioned in this answer.

        P Offline
        P Offline
        Phong
        wrote on last edited by
        #3

        @Pablo-J.-Rogina

        Thanks, It works~

        G 1 Reply Last reply
        0
        • P Phong

          @Pablo-J.-Rogina

          Thanks, It works~

          G Offline
          G Offline
          grk3010
          wrote on last edited by
          #4

          @Phong

          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?

          jsulmJ 1 Reply Last reply
          0
          • G grk3010

            @Phong

            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?

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @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.

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            G 1 Reply Last reply
            1
            • jsulmJ jsulm

              @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.

              G Offline
              G Offline
              grk3010
              wrote on last edited by
              #6

              @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.html

              I 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?

              1 Reply Last reply
              0
              • Pablo J. RoginaP Offline
                Pablo J. RoginaP Offline
                Pablo J. Rogina
                wrote on last edited by
                #7

                @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.

                Upvote the answer(s) that helped you solve the issue
                Use "Topic Tools" button to mark your post as Solved
                Add screenshots via postimage.org
                Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                G 1 Reply Last reply
                1
                • Pablo J. RoginaP Pablo J. Rogina

                  @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.

                  G Offline
                  G Offline
                  grk3010
                  wrote on last edited by
                  #8

                  @Pablo-J.-Rogina
                  Sorry, I have moved inquiry to its own post.

                  thanks

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved