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. [SOLVED] Add external C lib (zeromq) to project that will run on android
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Add external C lib (zeromq) to project that will run on android

Scheduled Pinned Locked Moved Mobile and Embedded
14 Posts 3 Posters 13.4k Views 1 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.
  • M Offline
    M Offline
    Moster
    wrote on last edited by
    #4

    Try it like this

    @ INCLUDEPATH += $$PWD/../../../../../usr/local/include
    DEPENDPATH += $$PWD/../../../../../usr/local/include
    LIBS += $$PWD/../../../../../usr/local/lib/ -lzmq
    @

    Btw, is zeromq supposed to work on android?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DerMas
      wrote on last edited by
      #5

      Like that it doesnt work with the desktop and with the android compilation :)

      I get the following error while compiling for desktop:

      @/usr/bin/ld: cannot find /home/qtappzmq/../../../../../usr/local/lib/: File format not recognized
      collect2: ld returned 1 exit status
      make: *** [zmq] Error 1
      15:41:52: The process "/usr/bin/make" exited with code 2.@

      And this error while compiling for android:

      @ndk/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: fatal error: /home/qtappzmq/../../../../../usr/local/lib/: pread failed: Is a directory
      collect2: error: ld returned 1 exit status
      make: *** [libzmq.so] Error 1
      15:45:46: The process "/usr/bin/make" exited with code 2.@

      bq. Btw, is zeromq supposed to work on android?

      I naivly thought it should, because its just some c code.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Moster
        wrote on last edited by
        #6

        Sorry, I didnt see that you were already using an absolute path.

        It should look like this then:

        @ INCLUDEPATH += /usr/local/include
        DEPENDPATH += /usr/local/include
        LIBS += /usr/local/lib/ -lzmq
        @

        1 Reply Last reply
        0
        • D Offline
          D Offline
          DerMas
          wrote on last edited by
          #7

          Getting the same errors for desktop and android :/

          -But I found a source for zmq and android. Seems like I have to make a special build for android:-
          -http://zeromq.org/build:android-

          edit: Ok that was about building a jar in order to use zeromq, but since I'd like to use it directly as a C lib with my QT app it might work just like that, if I could only configure it correctly...

          1 Reply Last reply
          0
          • M Offline
            M Offline
            Moster
            wrote on last edited by
            #8

            Are you sure that its the same error? I think it should be at least a little bit different.

            1 Reply Last reply
            0
            • D Offline
              D Offline
              DerMas
              wrote on last edited by
              #9

              It is the same error, but the dir is now the absolute and not the relative one.

              Now it is:
              @/usr/bin/ld: cannot find /usr/local/lib/: File format not recognized@ instead of
              @/usr/bin/ld: cannot find /home/qtappzmq/../../../../../usr/local/lib/: File format not recognized@

              1 Reply Last reply
              0
              • M Offline
                M Offline
                Moster
                wrote on last edited by
                #10

                Like this it builds at least.

                @LIBS += /usr/local/lib/libzmq.a

                INCLUDEPATH += /usr/local/include
                DEPENDPATH += /usr/local/include

                PRE_TARGETDEPS += /usr/local/lib/libzmq.a@

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  DerMas
                  wrote on last edited by
                  #11

                  Yap, it builds for the desktop compile target like that, but for the android compile target I get the "incompatible target" error again, which I showed detailed in my second post.

                  I think there is something special to do for the android compile target, that I forget.

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #12

                    Hi,

                    Are you linking against an ARM version of libqmq when you build for android ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      Moster
                      wrote on last edited by
                      #13

                      Ye, thats what I already asked. You cant expect a desktop lib to work on android. The libraby might be using some other libraries that arent available on android.

                      http://zeromq.org/build:android
                      It creates some libraries and a java wrapper. Maybe you can just bind the libs to your app

                      1 Reply Last reply
                      0
                      • D Offline
                        D Offline
                        DerMas
                        wrote on last edited by
                        #14

                        head -> wall I tried to link to the libzmq that i built for ubuntu. That sounds like reason for the "incompatible" error ;) 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