Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Building a Project in Qt-Creator on Mac for Android
Forum Updated to NodeBB v4.3 + New Features

Building a Project in Qt-Creator on Mac for Android

Scheduled Pinned Locked Moved Qt Creator and other tools
9 Posts 2 Posters 3.5k 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.
  • E Offline
    E Offline
    EricRFMA
    wrote on last edited by
    #1

    I'm having trouble doing an Android build (my first attempt) on my Mac, using c++11 features in QtCreator 2.8, Qt 5.1.2.

    When I build, I get the following errors (this is just a subset) that imply that c++11 features aren't there:

    @../WeightPlates/weightplate.h:41:9: error: 'shared_ptr' does not name a type
    ../WeightPlates/weightplate.h:46:9: error: 'shared_ptr' does not name a type
    ../WeightPlates/weightplate.h:343:7: error: looser throw specifier for 'virtual wException::~wException()'@

    I've had no problem building this natively on the Mac.

    In the project, I've added the following "Additional Arguments:"

    @CONFIG+=c++11@

    Adding just c++11 resulting in a compilation command-line that specified -std=gnu++0x, which looks like it's the default (in qtbase/mkspecs/android-g++/qmake.conf) If I add the following to "Additional Arguments:"

    @CONFIG+=c++11 QMAKE_CXXFLAGS+=-std=c++11@

    Then the command line contains these two -std arguments: -std=gnu++0x -std=c++11
    And even in that case, I get the same compilation errors.

    The complete compilation line that's generated is:
    @/Volumes/Projects/android-ndk-r8e/toolchains/arm-linux-androideabi-4.7/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-g++ -c -Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -DANDROID -Wa,--noexecstack -std=gnu++0x -std=c++11 -O0 -g -g -marm -O0 -fno-omit-frame-pointer -Wall -Wno-psabi -W -D_REENTRANT -fPIE -DQT_NO_PRINTER -DQT_NO_PRINTDIALOG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../qt5-android/qtbase/mkspecs/android-g++ -I../WeightPlates -I../../qt5-android/qtbase/include -I../../qt5-android/qtbase/include/QtWidgets -I../../qt5-android/qtbase/include/QtGui -I../../qt5-android/qtbase/include/QtCore -I. -I. -I../../android-ndk-r8e/sources/cxx-stl/gnu-libstdc++/4.7/include -I../../android-ndk-r8e/sources/cxx-stl/gnu-libstdc++/4.7/libs/armeabi-v7a/include -I../../android-ndk-r8e/platforms/android-9/arch-arm/usr/include -I. -o main.o ../WeightPlates/main.cpp@

    Is c++11 support for cross compilation between Mac and Android available? If so, can anyone advise what I might be doing wrong?

    Thanks!

    -Eric

    1 Reply Last reply
    0
    • E Offline
      E Offline
      EricRFMA
      wrote on last edited by
      #2

      No? Nothing? No one? Was it something I said...? Didn't say...? ;)

      1 Reply Last reply
      0
      • E Offline
        E Offline
        EricRFMA
        wrote on last edited by
        #3

        So I just cajoled qmake to generate only -std=c++11, and the compiler didn't complain about it, but it also didn't accept the C++11 features I'm using.

        Anyone have any ideas...?

        Thanks!

        1 Reply Last reply
        0
        • E Offline
          E Offline
          EricRFMA
          wrote on last edited by
          #4

          OK, so I figured it out...

          Specifically, the problem was with shared_ptr. For some reason, in the android build environment (in Qt-Creator), you have to explicitly @#include <memory>@

          When building for the Mac native, I didn't have to. Yet, when I did some testing on the command-line to build a quick test on the Mac, I did have to #include <memory>, in, if I remember right, every case. I tried gcc48 and clang++ 4.1.

          Oh, and in case it helps anyone in the future, I found that even after installing gcc48, it would by default use the gcc 4.2.1 header files in /usr/include/c++/4.2.1 So don't assume anything!!!

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

            Hi and thanks for sharing your findings

            For the gcc stuff, did you install gcc_select ? (I didn't tested it yet)

            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
            • E Offline
              E Offline
              EricRFMA
              wrote on last edited by
              #6

              I looked for gcc_select, but it looks like it hasn't come with Mac OS X for quite a while. The only alternative I could find was to change the symbolic link from gcc to whatever I wanted to use. Not sure how that influences where to find the include files. Someone claims the gcc executable figures that out (not sure how) and/or there's the -I command-line option and/or the INCLUDE environment variable... though that seems to have been renamed CPATH or CPLUS_INCLUDE_PATH for gcc (been a while since I used that one)

              Thanks!

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

                IFAIK It's from macports

                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
                • E Offline
                  E Offline
                  EricRFMA
                  wrote on last edited by
                  #8

                  I looked into it, but apparently it's for the "port select" options of MacPorts:

                  bq. gcc_select installs files that allow 'port select' to switch the default version of gcc. It symlinks
                  the standard compiler executables in the MacPorts prefix to the selected version.

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

                    But should it do what you need ?

                    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