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. Building Qt 5.3.1 for OpenSSL in Android
Forum Updated to NodeBB v4.3 + New Features

Building Qt 5.3.1 for OpenSSL in Android

Scheduled Pinned Locked Moved Mobile and Embedded
9 Posts 2 Posters 3.7k 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.
  • A Offline
    A Offline
    agiovacchini
    wrote on last edited by
    #1

    I'm evaluating QT for mobile development and one of the first thing I tryed was making a network request via HTTPS and I've seen it working well in OSx desktop, iOs emulator but not in Android device, with surprise I've seen the problem is related to "some countries" where SSL is not accepted so it has not been included and I need to build QT Android and OpenSSL library myself to be able to use it; this is weird, I think that giving an SSL enabled build which uses it only if the user add the needed libraries would have been better but anyway I like QT so I tryed the build and here comes the nightmare, I've followed what is sayd here: http://qt-project.org/forums/viewthread/30537 and then here: http://qt-project.org/wiki/Qt5ForAndroidBuilding and also I've tryed to build the full QT; the last thing kept my Mac building for 10 hours and gave me an unusable result that had no iOs, no Android at all, the first after over an hour of build came out with this error:

    @/Applications/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/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 -O2 -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -mthumb -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -Wno-psabi -W -D_REENTRANT -fPIC -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_PLUGIN -DQT_QUICK_LIB -DQT_MULTIMEDIA_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/Users/andreagiovacchini/Documents/Sviluppo/Qt531Src/qt-everywhere-opensource-src-5.3.1/qtbase/mkspecs/android-g++ -I. -I../../multimedia/audio -I../../../include/QtMultimedia/5.3.1 -I../../../include/QtMultimedia/5.3.1/QtMultimedia -I/Users/andreagiovacchini/Documents/Sviluppo/Qt531Src/qt-everywhere-opensource-src-5.3.1/qtdeclarative/include -I/Users/andreagiovacchini/Documents/Sviluppo/Qt531Src/qt-everywhere-opensource-src-5.3.1/qtdeclarative/include/QtQuick -I../../../include -I../../../include/QtMultimedia -I/Users/andreagiovacchini/Documents/Sviluppo/Qt531Src/qt-everywhere-opensource-src-5.3.1/qtdeclarative/include/QtQml -I/Users/andreagiovacchini/Documents/Sviluppo/Qt531Src/qt-everywhere-opensource-src-5.3.1/qtbase/include -I/Users/andreagiovacchini/Documents/Sviluppo/Qt531Src/qt-everywhere-opensource-src-5.3.1/qtbase/include/QtNetwork -I/Users/andreagiovacchini/Documents/Sviluppo/Qt531Src/qt-everywhere-opensource-src-5.3.1/qtbase/include/QtGui -I/Users/andreagiovacchini/Documents/Sviluppo/Qt531Src/qt-everywhere-opensource-src-5.3.1/qtbase/include/QtCore -I.moc -I/Applications/android-ndk-r9d/sources/cxx-stl/gnu-libstdc++/4.8/include -I/Applications/android-ndk-r9d/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include -isystem /Applications/android-ndk-r9d/platforms/android-9/arch-arm/usr/include -o .obj/qaudioengine_p.o qaudioengine_p.cpp
    In file included from qaudioengine_p.cpp:46:0:
    qaudioengine_openal_p.h:54:19: fatal error: AL/al.h: No such file or directory
    #include <AL/al.h>
    ^
    compilation terminated.
    make[4]: *** [.obj/qaudioengine_p.o] Error 1
    make[3]: *** [sub-audioengine-make_first] Error 2
    make[2]: *** [sub-imports-make_first] Error 2
    make[1]: *** [sub-src-make_first] Error 2
    make: *** [module-qtmultimedia-make_first] Error 2@

    Well, this message is for me total nonsense as for what I understand it is not related to some missing requirement nor to something someone out of the dev team can understand, who knows what is al.h?, my Mac has a copy in /System/Library/Frameworks/OpenAL.framework/Headers but it would not work as "<AL/al.h>".

    My command lines were these launched in OSx 10.9:
    @./configure -xplatform android-g++ -nomake tests -nomake examples -android-ndk /Applications/android-ndk-r9d -android-sdk /Applications/adt-bundle-mac-x86_64-20130219/sdk -android-ndk-host darwin-x86_64 -android-toolchain-version 4.8 -skip qttranslations -skip qtwebkit -skip qtserialport -skip qtwebkit-examples -no-warnings-are-errors

    make
    @

    Can someone help?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      agiovacchini
      wrote on last edited by
      #2

      For what I read it is an OpenAL header, which was a library used for older Android versions (<2.2) and now not more needed so just to be able to continue the build I've removed all the references to audioengine from makefiles (I'm also not interested in audio) so the build continued for some other minutes until it stopped on another error:
      @
      ...
      /Applications/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-g++ --sysroot=/Applications/android-ndk-r9d/platforms/android-9/arch-arm/ -Wl,-rpath=/usr/local/Qt-5.3.1/lib -Wl,-rpath-link=/Users/andreagiovacchini/Documents/Sviluppo/Qt531Src/qt-everywhere-opensource-src-5.3.1/qtxmlpatterns/lib -Wl,-rpath-link=/Users/andreagiovacchini/Documents/Sviluppo/Qt531Src/qt-everywhere-opensource-src-5.3.1/qtbase/lib -Wl,--no-undefined -Wl,-z,noexecstack -shared -o libqmlwebkitplugin.so .obj/qdeclarativewebview.o .obj/plugin.o .obj/moc_qdeclarativewebview_p.o -L/Applications/android-ndk-r9d/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a -L/Applications/android-ndk-r9d/platforms/android-9/arch-arm//usr/lib -L/Users/andreagiovacchini/Documents/Sviluppo/Qt531Src/qt-everywhere-opensource-src-5.3.1/qtwebkit/lib -lQt5WebKitWidgets -L/Users/andreagiovacchini/Documents/Sviluppo/Qt531Src/qt-everywhere-opensource-src-5.3.1/qtdeclarative/lib -lQt5Quick -L/Users/andreagiovacchini/Documents/Sviluppo/Qt531Src/qt-everywhere-opensource-src-5.3.1/qtbase/lib -L/Users/andreagiovacchini/Documents/Sviluppo/Qt531Src/qt-everywhere-opensource-src-5.3.1/qtmultimedia/lib -lQt5MultimediaWidgets -lQt5OpenGL -lQt5PrintSupport -L/Users/andreagiovacchini/Documents/Sviluppo/Qt531Src/qt-everywhere-opensource-src-5.3.1/qtquick1/lib -lQt5Declarative -L/Users/andreagiovacchini/Documents/Sviluppo/Qt531Src/qt-everywhere-opensource-src-5.3.1/qtxmlpatterns/lib -lQt5XmlPatterns -lQt5Sql -L/Users/andreagiovacchini/Documents/Sviluppo/Qt531Src/qt-everywhere-opensource-src-5.3.1/qtscript/lib -lQt5WebKit -lQt5Qml -lQt5Multimedia -lQt5Widgets -lQt5Network -L/Users/andreagiovacchini/Documents/Sviluppo/Qt531Src/qt-everywhere-opensource-src-5.3.1/qtlocation/lib -lQt5Positioning -L/Users/andreagiovacchini/Documents/Sviluppo/Qt531Src/qt-everywhere-opensource-src-5.3.1/qtsensors/lib -lQt5Sensors -lQt5Script -lQt5Gui -lQt5Core -lGLESv2 -lgnustl_shared -llog -lz -lm -ldl -lc -lgcc
      ##<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
      /Applications/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lQt5WebKitWidgets
      /Applications/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lQt5WebKit
      .obj/qdeclarativewebview.o:qdeclarativewebview.cpp:function QDeclarativeWebPage::~QDeclarativeWebPage(): error: undefined reference to 'QWebPage::~QWebPage()'
      .obj/qdeclarativewebview.o:qdeclarativewebview.cpp:function GraphicsWebView::GraphicsWebView(QDeclarativeWebView*): error: undefined reference to 'QGraphicsWebView::QGraphicsWebView(QGraphicsItem*)'
      .obj/qdeclarativewebview.o:qdeclarativewebview.cpp:function QDeclarativeWebView::setRenderingEnabled(bool): error: undefined reference to 'QGraphicsWebView::setTiledBackingStoreFrozen(bool)'
      .obj/qdeclarativewebview.o:qdeclarativewebview.cpp:function QDeclarativeWebView::page() const: error: undefined reference to 'QGraphicsWebView::page() const'
      .obj/qdeclarativewebview.o:qdeclarativewebview.cpp:function QDeclarativeWebView::evaluateJavaScript(QString const&): error: undefined reference to 'QWebPage::mainFrame() const'
      .obj/qdeclarativewebview.o:qdeclarativewebview.cpp:function QDeclarativeWebView::evaluateJavaScript(QString const&): error: undefined reference to 'QWebFrame::evaluateJavaScript(QString const&)'
      .obj/qdeclarativewebview.o:qdeclarativewebview.cpp:function QDeclarativeWebView::updateContentsSize(): error: undefined reference to 'QWebPage::setPreferredContentsSize(QSize const&) const'
      .obj/qdeclarativewebview.o:qdeclarativewebview.cpp:function QDeclarativeWebView::backAction() const: error: undefined reference to 'QWebPage::action(QWebPage::WebAction) const'
      .obj/qdeclarativewebview.o:qdeclarativewebview.cpp:function QDeclarativeWebView::forwardAction() const: error: undefined reference to 'QWebPage::action(QWebPage::WebAction) const'
      .obj/qdeclarativewebview.o:qdeclarativewebview.cpp:function QDeclarativeWebView::reloadAction() const: error: undefined reference to 'QWebPage::action(QWebPage::WebAction) const'
      .obj/qdeclarativewebview.o:qdeclarativewebview.cpp:function QDeclarativeWebView::stopAction() const: error: undefined reference to 'QWebPage::action(QWebPage::WebAction) const'
      ...
      @

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

        Hi and welcome to devnet,

        Can you post the exact line you used to configure Qt for android ?

        Also, skip the webkit module, it's not available on Android nor iOS (platform/store rules restriction, nothing Qt can do about)

        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
        • A Offline
          A Offline
          agiovacchini
          wrote on last edited by
          #4

          Hi SGaist and thank for replying, my configure line is this:

          ./configure -xplatform android-g++ -nomake tests -nomake examples -android-ndk /Applications/android-ndk-r9d -android-sdk /Applications/adt-bundle-mac-x86_64-20130219/sdk -android-ndk-host darwin-x86_64 -android-toolchain-version 4.8 -skip qttranslations -skip qtwebkit -skip qtserialport -skip qtwebkit-examples -no-warnings-are-errors

          For my understanding seems like webkit is already disabled, or are there other disable flags to add?

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

            webkitwidgets IIRC, but personally I simply remove (or just move out) the qtwebkit folder so there's nothing to build at all.

            The reset of the line seems correct however I don't see anything openssl related in it

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

              Yes you are right it was a copy and paste mistake, the actual line was

              ./configure -xplatform android-g++ -nomake tests -nomake examples -android-ndk /Applications/android-ndk-r9d -android-sdk /Applications/adt-bundle-mac-x86_64-20130219/sdk -android-ndk-host darwin-x86_64 -android-toolchain-version 4.8 -skip qttranslations -skip qtwebkit -skip qtserialport -skip qtwebkit-examples -no-warnings-are-errors -openssl

              Now following your direction to delete qtwebkit folders the build got completed (thank you) then I've added the new QT to the creator and then the new kit to my app; then I've added the libcrypto.so and libssl.so in the deploy step and when I launched the app "myApp" and in my phone's log (open -a monitor) I see:

              ...
              07-10 17:20:49.056: D/dalvikvm(28874): Trying to load lib /data/app-lib/org.qtproject.example.MyApp-1/libcrypto.so 0x4240ef38
              07-10 17:20:49.056: D/dalvikvm(28874): Added shared lib /data/app-lib/org.qtproject.example.MyApp-1/libcrypto.so 0x4240ef38
              07-10 17:20:49.056: D/dalvikvm(28874): No JNI_OnLoad found in /data/app-lib/org.qtproject.example.MyApp-1/libcrypto.so 0x4240ef38, skipping init
              07-10 17:20:49.056: D/dalvikvm(28874): Trying to load lib /data/app-lib/org.qtproject.example.MyApp-1/libssl.so 0x4240ef38
              07-10 17:20:49.056: D/dalvikvm(28874): Added shared lib /data/app-lib/org.qtproject.example.MyApp-1/libssl.so 0x4240ef38
              07-10 17:20:49.056: D/dalvikvm(28874): No JNI_OnLoad found in /data/app-lib/org.qtproject.example.MyApp-1/libssl.so 0x4240ef38, skipping init
              07-10 17:20:49.061: D/dalvikvm(28874): Trying to load lib /data/app-lib/org.qtproject.example.MyApp-1/libMyApp.so 0x4240ef38
              07-10 17:20:49.066: D/dalvikvm(28874): Added shared lib /data/app-lib/org.qtproject.example.MyApp-1/libMyApp.so 0x4240ef38
              07-10 17:20:49.066: D/dalvikvm(28874): No JNI_OnLoad found in /data/app-lib/org.qtproject.example.MyApp-1/libMyApp.so 0x4240ef38, skipping init
              ...

              which seems ok but I still can't open an https address which works well from iOS or OSx desktop.

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

                What error are you getting ?

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

                  The error was protocol "https" is unknown, then I've found this comment on a bug:

                  https://bugreports.qt-project.org/browse/QTBUG-34244?focusedCommentId=218850&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-218850

                  I've retryed the build with also the -I param to the openssl headers path and now it's a little better, I get an "SSL Handshake failed", which means that anyway SSL support is inside my Android app, now I can investigate about this message.

                  I've seen after adding the "-I" param that the final result included a line like this:
                  OpenSSL .............. yes (loading libraries at run-time)
                  Instead of:
                  OpenSSL .............. no

                  The docs are not clear about all the steps needed, is there a place where I can write everything I have done for other newbies?

                  Thank you!

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

                    There's already the "Adding OpenSSL Support" chapter in Qt's documentation but there's room for improvement

                    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