Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Building for android from source; undefined reference to Win32MakefileGenerator
QtWS25 Last Chance

Building for android from source; undefined reference to Win32MakefileGenerator

Scheduled Pinned Locked Moved Solved Installation and Deployment
15 Posts 3 Posters 2.5k 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.
  • sierdzioS Offline
    sierdzioS Offline
    sierdzio
    Moderators
    wrote on last edited by sierdzio
    #2

    You forgot to tell Qt that it should cross-compile: please add the -xplatform android-g++ flag to your configure call.

    (Z(:^

    1 Reply Last reply
    1
    • W Offline
      W Offline
      Wiru
      wrote on last edited by Wiru
      #3

      Wish that would help, I tried with and without it (randomly trying to see what's wrong) and posted the line where I didn't include the -xplatform but even with it I get the same error.
      I don't know if it would help to change some parameters maybe?

      Previously I build the same source for linux without issues, but then again it's different for android.

      sierdzioS 1 Reply Last reply
      0
      • W Wiru

        Wish that would help, I tried with and without it (randomly trying to see what's wrong) and posted the line where I didn't include the -xplatform but even with it I get the same error.
        I don't know if it would help to change some parameters maybe?

        Previously I build the same source for linux without issues, but then again it's different for android.

        sierdzioS Offline
        sierdzioS Offline
        sierdzio
        Moderators
        wrote on last edited by
        #4

        @Wiru said in Building for android from source; undefined reference to Win32MakefileGenerator:

        Previously I build the same source for linux without issues, but then again it's different for android.

        Make sure your build dir is clean, then.

        Also, what is -android-ndk-host linux-x86_64 doing there? Perhaps follow the Windows instructions since your host is Windows https://wiki.qt.io/Building_qt-android_on_windows . Not sure if they work, I've never tried building Qt for Android on Windows.

        (Z(:^

        1 Reply Last reply
        0
        • W Offline
          W Offline
          Wiru
          wrote on last edited by
          #5

          The thing is that the host is linux, that's why the Win32MakefileGenerator is even more confusing. I deleted all the modified flies, at least all that git said were different. I'll try to clone again just in case some files got ignored and didn't show up in git.

          sierdzioS 1 Reply Last reply
          0
          • W Offline
            W Offline
            Wiru
            wrote on last edited by Wiru
            #6

            Ok that was one reason, apparently some stuff stays from old builds and it's not shown in git.
            Now the only issue is I get the ERROR: Unknown command line option -skip, if I understand right it should be used to not build unsupported modules.
            But it does say

            Creating qmake...
            .Done.
            ERROR: Unknown command line option -skip
            

            So not sure if that's something that can be ignored.

            sierdzioS 1 Reply Last reply
            0
            • W Wiru

              The thing is that the host is linux, that's why the Win32MakefileGenerator is even more confusing. I deleted all the modified flies, at least all that git said were different. I'll try to clone again just in case some files got ignored and didn't show up in git.

              sierdzioS Offline
              sierdzioS Offline
              sierdzio
              Moderators
              wrote on last edited by
              #7

              @Wiru said in Building for android from source; undefined reference to Win32MakefileGenerator:

              The thing is that the host is linux, that's why the Win32MakefileGenerator is even more confusing. I deleted all the modified flies, at least all that git said were different. I'll try to clone again just in case some files got ignored and didn't show up in git.

              Ah, ok sorry I got confused :-)

              If you use git and clean it (git clean -dxf) make sure the repo is initialized.

              Best way to safely compile Qt is to do an out of source build:

              git clone ...
              cd repo
              perl init-repository
              cd ..
              mkdir build 
              cd build
              ../repo/configure ...
              

              Easier yet - use a tarball from qt.io archive. It's a faster download, no need to init-repository, in general just less hassle.

              (Z(:^

              1 Reply Last reply
              1
              • sierdzioS Offline
                sierdzioS Offline
                sierdzio
                Moderators
                wrote on last edited by
                #8

                Here is a script I use to compile Qt on Android, maybe it will help you. Host is Kubuntu 18.10 in this case.

                export QTVER=5.11.1
                    wget http://download.qt.io/official_releases/qt/5.11/$QTVER/single/qt-everywhere-src-$QTVER.tar.xz
                    tar -xaf qt-everywhere-src-$QTVER.tar.xz
                    mv qt-everywhere-src-$QTVER $QTVER-src
                    mkdir qtbuild
                    cd qtbuild
                    # Check if this path is correct
                    export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64
                    export ANDROID_NDK_ROOT=/path/to/android/ndk-r10e
                    ../$QTVER-src/configure -release -xplatform android-g++ --disable-rpath -nomake tests -nomake examples -android-ndk-host linux-x86_64 -android-toolchain-version 4.9 -android-ndk $ANDROID_NDK_ROOT -android-sdk /path/to/android/sdk -no-warnings-are-errors -opensource -confirm-license -prefix ../$QTVER-android -skip qttranslations -skip qtserialport -skip qtserialbus -skip qtscxml -skip qtscript -skip qtcharts -skip qt3d -skip qtdatavis3d -skip qtcanvas3d -skip qtgamepad -skip qtvirtualkeyboard -skip qtwayland -skip qtwebengine -skip qtwebchannel -skip qtwebsockets -android-arch armeabi-v7a
                    time make -j `nproc`
                    make install
                

                You may want to experiment with some OpenSSL flags, too, but I've left them out to make it easier.

                (Z(:^

                1 Reply Last reply
                1
                • W Wiru

                  Ok that was one reason, apparently some stuff stays from old builds and it's not shown in git.
                  Now the only issue is I get the ERROR: Unknown command line option -skip, if I understand right it should be used to not build unsupported modules.
                  But it does say

                  Creating qmake...
                  .Done.
                  ERROR: Unknown command line option -skip
                  

                  So not sure if that's something that can be ignored.

                  sierdzioS Offline
                  sierdzioS Offline
                  sierdzio
                  Moderators
                  wrote on last edited by
                  #9

                  @Wiru said in Building for android from source; undefined reference to Win32MakefileGenerator:

                  Ok that was one reason, apparently some stuff stays from old builds and it's not shown in git.
                  Now the only issue is I get the ERROR: Unknown command line option -skip, if I understand right it should be used to not build unsupported modules.
                  But it does say

                  Creating qmake...
                  .Done.
                  ERROR: Unknown command line option -skip
                  

                  So not sure if that's something that can be ignored.

                  Nope. Your build dir or environment is seriously wrong if it fails to recognise -skip.

                  (Z(:^

                  1 Reply Last reply
                  0
                  • W Offline
                    W Offline
                    Wiru
                    wrote on last edited by
                    #10

                    Thanks for the help, I'll play around with settings.
                    First I'll try to download the zip because using perl init-repository just ends up with Can't open perl script "init-repository" no such file or directory, and first I do cd qtbase, so who knows what's not working correctly.

                    1 Reply Last reply
                    0
                    • W Offline
                      W Offline
                      Wiru
                      wrote on last edited by
                      #11

                      Ok I simply have no luck.
                      I downloaded the tar 5 times, and every time
                      wget http://download.qt.io/official_releases/qt/5.11/5.11.1/single/qt-everywhere-src-5.11.1.tar.xz

                      ~/source_qt $ tar -xaf qt-everywhere-src-5.11.1.tar.xz 
                      xz: (stdin): Compressed data is corrupt
                      tar: Unexpected EOF in archive
                      tar: Unexpected EOF in archive
                      tar: Error is not recoverable: exiting now
                      

                      I'll continue trying with the git source... :S

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

                        Hi,

                        The .zip archive is for Windows.
                        The .tar.xz archive is for Linux.

                        Completely unrelated to the target you want to build for, it's a question of line ending type.

                        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
                        1
                        • W Offline
                          W Offline
                          Wiru
                          wrote on last edited by
                          #13

                          It is for linux, I tried one more time and now it was ok. Only thing is that's not what I need, since I can't edit the files like this, so I still have to use the git version.

                          1 Reply Last reply
                          0
                          • W Offline
                            W Offline
                            Wiru
                            wrote on last edited by
                            #14

                            The mystery about -skip not found is simply because I was building the wrong repo the whole time qtbase instead of qt5, that's also why the perl init-repository didn't work...
                            I feel a bit stupid, but now I know something new.
                            Thank you all for the help.

                            1 Reply Last reply
                            0
                            • sierdzioS Offline
                              sierdzioS Offline
                              sierdzio
                              Moderators
                              wrote on last edited by
                              #15

                              No worries :-) Building Qt is a complex thing, I guess we all understand it and went through similar hurdles at some point in the past ;-) Happy coding!

                              (Z(:^

                              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