Important: Please read the Qt Code of Conduct -

Mapbox / openSSL

  • Hi there.

    I am currently trying to utilize a "mapbox" map inside an android application. I am using Qt 5.7 on windows. When I try to run example code that I have found online I merely get a blank screen on my tablet. It is my understanding that I need to include the 2 built openSSL libraries but I am struggling to do so. I was originally getting errors relating to not finding the libraries but after tracking down some prebuilt ones I appear to get this error.

    W (null):0 ((null)): QSslSocket: cannot resolve SSLv2_client_method
    W (null):0 ((null)): QSslSocket: cannot resolve SSLv2_server_method

    TEMPLATE = app
    QT += qml quick location positioning network
    CONFIG += c++11
    SOURCES += main.cpp
    RESOURCES += qml.qrc
    LIBS += -L C:/openssl-1.0.2/armeabi-v7a/lib
    INCLUDEPATH += -L C:/openssl-1.0.2/include
    # Additional import path used to resolve QML modules in Qt Creator's code model
    # Default rules for deployment.
    contains(ANDROID_TARGET_ARCH,armeabi-v7a) {
            C:/openssl-1.0.2/armeabi-v7a/lib/ \
            C:/openssl-1.0.2/armeabi-v7a/lib/ \


    import QtQuick 2.5
    import QtQuick.Window 2.2
    import QtQuick.Controls 1.3
    import QtQuick.Dialogs 1.2
    import QtPositioning 5.6
    import QtLocation 5.6
    import "C:/Users/Jayce/Desktop/mapbox-gl-native-master/platform/qt/include/QMapbox"
               id: mapbox
               PluginParameter { name: "mapbox.access_token"; value: "//access_token//" }
               PluginParameter { name: "mapbox.map_id"; value: "//map id//" }
               id: map
               anchors.fill: parent
               plugin: mapbox
               zoomLevel: 15


    #include <QGuiApplication>
    #include <QQmlApplicationEngine>
    #include <QQuickView>
    #include <C:/Users/Jayce/Desktop/mapbox-gl-native-master/platform/qt/include/QMapbox>
    #include <openssl/ssl.h>
    #include <openssl/ssl2.h>
    #include <openssl/ssl23.h>
    #include <openssl/aes.h>
    #include <QtNetwork>
    #include <QMap>
    int main(int argc, char *argv[])
        QGuiApplication app(argc, argv);
        QQmlApplicationEngine engine;
        return app.exec();

    I also tried building my own openSSL libs using MSYS2 from this documentation:

    it appeared to configure okay but then got to the "make build_libs" stage and received this error

    make build_libs
    making all in crypto...
    make[1]: Entering directory '/c/openssl-1.0.2h/crypto'
    /usr/bin/perl ../util/ "gcc -I. -I.. -I../include  -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -march=armv7-a -mandroid -I/include -B/lib -O3 -fomit-frame-pointer -Wall -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM" "android-armv7" >buildinf.h
    gcc -I. -I.. -I../include  -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -march=armv7-a -mandroid -I/include -B/lib -O3 -fomit-frame-pointer -Wall -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM   -c -o cryptlib.o cryptlib.c
    gcc.exe: error: unrecognized command line option '-mandroid'
    <builtin>: recipe for target 'cryptlib.o' failed
    make[1]: *** [cryptlib.o] Error 1
    make[1]: Leaving directory '/c/openssl-1.0.2h/crypto'
    Makefile:284: recipe for target 'build_crypto' failed
    make: *** [build_crypto] Error 1

    I even tried making an ubuntu virtual machine and tried to build Qt there as I read that is comes with openssl enabled as default on linux. But after installing and restarting the VM it just hangd with a strange graphical glitch. I may create a dual boot for ubuntu and try again on linux without a virtual machine, but would prefer to be able to use windows to build my apps. Any thoughts?

  • Did you put the OpenSSL binaries in your path? Placing these in my path are typically enough for me to get past the issue. If you got pre-built binaries for Windows, were they built with the same version of VS you are building with? I believe there may be some dependency, so you could end up trying to build with 2015, and using 2013 built OpenSSL libs.

Log in to reply