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. QMAKE_POST_LINK doesn't work for Android!
QtWS25 Last Chance

QMAKE_POST_LINK doesn't work for Android!

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
qmakeandroidqmakepostlinksystem
8 Posts 2 Posters 3.3k Views
  • 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.
  • T Offline
    T Offline
    tansgumus
    wrote on 2 Aug 2017, 18:46 last edited by
    #1

    Hello,

    I've two issues not single one as mention in post subject.

    First issue:
    QMAKE_POST_LINK doesn't work for Android as mentioned below while system() works!

    Does this issue related to Android with qmake? Or there is something wrong with my code?

    .pro

    contains(ANDROID_TARGET_ARCH,armeabi-v7a) {
        CONFIG(release, debug|release) {
            APKPATH = $$shadowed($$PWD)/android-build/build/outputs/apk/android-build-debug.apk
            DISTRO_NAME = $$TARGET-android-$${PREFIX}.apk
            COMMAND = '$$PWD/distro-android/create.sh "$$APKPATH" "$$PWD" "$${DISTRO_NAME}" '
    #        Doesn't work!!!
            QMAKE_POST_LINK += $${COMMAND}
    #        Works!
    #       system($${COMMAND})
        }
    
        ANDROID_EXTRA_LIBS = \
            /home/tansu/mysql_driver_qt/libmariadb/libmariadb.so \
            /home/tansu/Qt/5.9.1/android_armv7/plugins/sqldrivers/libqsqlmysql.so
    }
    

    create.sh

    #!/bin/bash
    
    APKPATH=$1
    PROJECT=$2
    DISTRO_NAME=$3
    
    cp -f $APKPATH $PROJECT/../distro/$DISTRO_NAME
    

    Second issue
    In case I used system() instead of QMAKE_POST_LINK I noticed that qmake call the function only in case .pro is not saved!

    Does this issue is a bug in QMake? Or I miss something in my code?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 2 Aug 2017, 22:42 last edited by
      #2

      Hi,

      I can't really comment on that however one thing I would check is what you are getting in your script. You might not be in the folder you think you are when the post link stuff is called.

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

      T 1 Reply Last reply 3 Aug 2017, 01:58
      0
      • S SGaist
        2 Aug 2017, 22:42

        Hi,

        I can't really comment on that however one thing I would check is what you are getting in your script. You might not be in the folder you think you are when the post link stuff is called.

        T Offline
        T Offline
        tansgumus
        wrote on 3 Aug 2017, 01:58 last edited by
        #3

        @SGaist Well, for chekcing my code I added message() in .pro and echo in .sh files

        .pro

        contains(ANDROID_TARGET_ARCH,armeabi-v7a) {
            CONFIG(release, debug|release) {
                APKPATH = $$shadowed($$PWD)/android-build/build/outputs/apk/android-build-debug.apk
                DISTRO_NAME = $$TARGET-android-$${PREFIX}.apk
                COMMAND = '$$PWD/distro-android/create.sh "$$APKPATH" "$$PWD" "$${DISTRO_NAME}" '
                message($${COMMAND})
        #        Doesn't work!!!
                QMAKE_POST_LINK += $${COMMAND}
        #        Works!
        #        system($${COMMAND})
            }
        
            ANDROID_EXTRA_LIBS = \
                /home/tansu/mysql_driver_qt/libmariadb/libmariadb.so \
                /home/tansu/Qt/5.9.1/android_armv7/plugins/sqldrivers/libqsqlmysql.so
        }
        

        create.sh

        #!/bin/bash
        
        APKPATH=$1
        PROJECT=$2
        DISTRO_NAME=$3
        
        echo "${PROJECT}/../distro/${DISTRO_NAME}" > ${PROJECT}/../distro/log.txt
        cp -f $APKPATH $PROJECT/../distro/$DISTRO_NAME
        

        The output of message() is correct as shown below:

        Project MESSAGE: /home/tansu/Projects/Tetris/src-qml/distro-android/create.sh "/home/tansu/Projects/Tetris/build-Tetris-Android_for_armeabi_v7a_GCC_4_9_Qt_5_9_1_for_Android_armv72-Release/android-build/build/outputs/apk/android-build-debug.apk" "/home/tansu/Projects/Tetris/src-qml" "Tetris-android-2017-08-03_04-43-05.apk" 
        

        But I couldn't get log.txt so I get pretty sure QMake doesn't call QMAKE_POST_LINK!

        In case I use:
        .pro

        contains(ANDROID_TARGET_ARCH,armeabi-v7a) {
            CONFIG(release, debug|release) {
                APKPATH = $$shadowed($$PWD)/android-build/build/outputs/apk/android-build-debug.apk
                DISTRO_NAME = $$TARGET-android-$${PREFIX}.apk
                COMMAND = '$$PWD/distro-android/create.sh "$$APKPATH" "$$PWD" "$${DISTRO_NAME}" '
                message($${COMMAND})
        #        Doesn't work!!!
        #        QMAKE_POST_LINK += $${COMMAND}
        #        Works!
                system($${COMMAND})
            }
        
            ANDROID_EXTRA_LIBS = \
                /home/tansu/mysql_driver_qt/libmariadb/libmariadb.so \
                /home/tansu/Qt/5.9.1/android_armv7/plugins/sqldrivers/libqsqlmysql.so
        }
        

        Everything goes fine except QMake doesn't call mesage() and system() functions unless .pro modified (not saved) which force me to modify .pro manually whenever I want to create a distro

        @SGaist Do you believe I've to attach a full project or a full demo project for clarifying this issue well?

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 3 Aug 2017, 21:30 last edited by
          #4

          Yes, that would be nice.

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

          T 1 Reply Last reply 3 Aug 2017, 23:14
          0
          • S SGaist
            3 Aug 2017, 21:30

            Yes, that would be nice.

            T Offline
            T Offline
            tansgumus
            wrote on 3 Aug 2017, 23:14 last edited by
            #5

            @SGaist said in QMAKE_POST_LINK doesn't work for Android!:

            Yes, that would be nice.

            Whenever I try to upload the project I get this error although the zip file doesn't contain on binaries and its size is about 60KB

            0_1501802001170_Screenshot_2017-08-04_02-13-10.png

            T 1 Reply Last reply 3 Aug 2017, 23:19
            0
            • T tansgumus
              3 Aug 2017, 23:14

              @SGaist said in QMAKE_POST_LINK doesn't work for Android!:

              Yes, that would be nice.

              Whenever I try to upload the project I get this error although the zip file doesn't contain on binaries and its size is about 60KB

              0_1501802001170_Screenshot_2017-08-04_02-13-10.png

              T Offline
              T Offline
              tansgumus
              wrote on 3 Aug 2017, 23:19 last edited by tansgumus 8 Mar 2017, 23:27
              #6

              @tansgumus said in QMAKE_POST_LINK doesn't work for Android!:

              @SGaist said in QMAKE_POST_LINK doesn't work for Android!:

              Yes, that would be nice.

              Whenever I try to upload the project I get this error although the zip file doesn't contain on binaries and its size is about 60KB

              0_1501802001170_Screenshot_2017-08-04_02-13-10.png

              I uploaded the project on shared host because this forum doesn't work fine with attachments :(
              https://send.firefox.com/download/9f8c48f645/#s-5nIhjmzt1mvgGEyGcNvw
              [Mirror] https://www.justbeamit.com/8gbxp
              [Mirror] https://ufile.io/fue6k

              Please download QMLDistroTest.tar.bz2 (60 KB)

              1 Reply Last reply
              0
              • T Offline
                T Offline
                tansgumus
                wrote on 27 Aug 2017, 16:27 last edited by
                #7

                @SGaist Did you receive the project. I couldn't figure out how to fix this issue till now :(

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 23 Sept 2017, 22:04 last edited by
                  #8

                  Tested with Qt 5.9.2 and it's working as expected. Well, the script bash is called.

                  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

                  • Login

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