kdab / android_openssl Goto Github PK
View Code? Open in Web Editor NEWOpenSSL scripts and bins for Android (useful for Qt on Android apps)
License: Apache License 2.0
OpenSSL scripts and bins for Android (useful for Qt on Android apps)
License: Apache License 2.0
crypto/aes/aesv8-armx.S:739:2: error: instruction requires: neon
eor v2.16b,v2.16b,v0.16b
^
crypto/aes/aesv8-armx.S:740:2: error: instruction requires: neon
eor v3.16b,v3.16b,v1.16b
^
crypto/aes/aesv8-armx.S:741:2: error: instruction requires: neon
st1 {v2.16b},[x1],#16
^
crypto/aes/aesv8-armx.S:743:2: error: instruction requires: neon
st1 {v3.16b},[x1]
^
make[1]: *** [crypto/aes/aesv8-armx.o] Error 1
make: *** [build_libs] Error 2
Hi,
with this commit works like a charm: aef7ae2
but if I update to the latest version of the Repo, the libssl and libcrypto file will not be added to the lib folder of the generated APK (release mode).
After a rollback to the mentioned commit, they are added to the generated APK and everything works.
Qt: 5.15.2
ndk: 21.3.6528147
Target Platform: ARM v7a
Android Build Platform SDK: 33
Qt Creator 9.0.1
OS-Release: Fedora Linux 35
I'm making a lot of assumptions here, so feel free to whack this down
One of my Qt Creator installs doesn't populate ANDROID_TARGET_ARCH. Presumably this is because there's no device configured for it yet. However, regardless of that, ANDROID_ABI is always assigned. Presuming ANDROID_ABI mates directly to the chosen compiler/NDK, that makes sense.
If all that is true, it seems more sensible to use ANDROID_ABI than ANDROID_TARGET_ARCH in the CMakeLists.txt file. What do you think?
Qt 5.13.2 for Android arm64-v8a
Qt creator 4.13
compiler: Android clang (C++, aarch64, NDK21.1)
Android targetSdkVersion: 31
I used openssl libraries from ssl_1.1/arm64-v8a folder.
When I want to build Qt application I have many errors:
bio_lib.c:-1: error: undefined reference to `__aarch64_ldadd4_relax'
ec_key.c:-1: error: undefined reference to `__aarch64_ldadd4_relax'
ec_mult.c:-1: error: more undefined references to `__aarch64_ldadd4_relax' follow
eng_init.c:-1: error: undefined reference to `__aarch64_ldadd4_acq_rel'
eng_lib.c:-1: error: undefined reference to `__aarch64_ldadd4_relax'
....
Hi,
I'm getting troubles to use it with Qt6.4.2!
I made a simple test project (File->New Project->QtQuickApplicaton) and selected cmake when asked.
This is my CMakeLists.txt:
cmake_minimum_required(VERSION 3.16)
project(cmakeSignageApk VERSION 0.1 LANGUAGES CXX)
set(CMAKE_AUTOMOC ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Qt6 6.2 COMPONENTS Quick REQUIRED)
if (ANDROID)
include(C://Users//matti//AppData//Local//Android//Sdk//android_openssl//CMakeLists.txt)
endif()
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Network)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Network)
qt_add_executable(appcmakeSignageApk
main.cpp
)
qt_add_qml_module(appcmakeSignageApk
URI cmakeSignageApk
VERSION 1.0
QML_FILES main.qml
)
set_target_properties(appcmakeSignageApk PROPERTIES
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
MACOSX_BUNDLE TRUE
WIN32_EXECUTABLE TRUE
)
target_link_libraries(appcmakeSignageApk
PRIVATE Qt6::Quick)
target_link_libraries(appcmakeSignageApk PRIVATE Qt${QT_VERSION_MAJOR}::Core)
target_link_libraries(appcmakeSignageApk PRIVATE Qt${QT_VERSION_MAJOR}::Network)
install(TARGETS appcmakeSignageApk
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
And main.cpp:
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include<QSslSocket>
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
const QUrl url(u"qrc:/cmakeSignageApk/main.qml"_qs);
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
&app, [url](QObject *obj, const QUrl &objUrl) {
if (!obj && url == objUrl)
QCoreApplication::exit(-1);
}, Qt::QueuedConnection);
qDebug() << QSslSocket::supportsSsl() << QSslSocket::sslLibraryBuildVersionString() << QSslSocket::sslLibraryVersionString() << QSslSocket::sslLibraryVersionNumber();
engine.load(url);
return app.exec();
}
The results is:
...
W qt.tlsbackend.ossl: : Failed to load libssl/libcrypto.
D libappcmakeSignageApk_x86_64.so: false "" "" 0
...
I need help and I have also tryed the update version of CMakeLists.txt from KambizAsadzadeh:master
Does this work even when some sources suggest Android would not load versioned (e.g. .so.1.1) libraries?
Issue
The version check for 5.12.4 turns true for Qt 5.12.10.
Proposed solution
Changing 5.12.4 to 5.12.04 seems to resolve the issue.
Qt 6.5 switched to OpenSSL 3. Is there a chance to get support for this?
This is probably not a specific problem for this project but rather an issue with Qt itself.
I am using Qt creator for couple projects and various platforms/Qt versions, so I would be happy to use CMakeLists.txt you are providing everywhere without much work from my side. However, as you mentioned include for this file have to be done before any find_package() with Qt component. In the CMake file I have to know version of Qt to include specific version of SSL, but to do that I have to find_package() first or manually set it somewhere. I don't like to do thing manually as they are usually more error prone, but I am afraid that there is no other way.
If that is the case please close this issue. If not, can you give me a hint what should be done to do it automatically?
missing x64 for 1.0.x
qDebug() << QSslSocket::supportsSsl() << QSslSocket::sslLibraryBuildVersionString() << QSslSocket::sslLibraryVersionString();
produces:
D MyApp: false "OpenSSL 1.1.1b 26 Feb 2019" ""
for both armv7 and arm64 on Qt 5.13.1 snapshot.
I use openssl like this:
android{
include(android_openssl/openssl.pri)
message(QT_VERSION=$${QT_VERSION})
message(ANDROID_TARGET_ARCH=$${ANDROID_TARGET_ARCH})
message(ANDROID_EXTRA_LIBS=$${ANDROID_EXTRA_LIBS})
INCLUDEPATH += android_openssl/static/include
DEPENDPATH += android_openssl/static/include
}
but link failed!
error: undefined reference to 'BIO_new_mem_buf'
error: undefined reference to 'PEM_read_bio_RSAPrivateKey'
error: undefined reference to 'BIO_free'
error: undefined reference to 'RSA_size'
error: undefined reference to 'RSA_private_encrypt'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
my pro file is this
contains(ANDROID_TARGET_ARCH,armeabi-v7a) {
ANDROID_EXTRA_LIBS +=
$$PWD/openssl/armeabi-v7a/libcrypto.so
$$PWD/openssl/armeabi-v7a/libssl.so
}
and I guess that openssl libiary is not load in the android apk,
is it the bug of qt? I donnot know
In recent versions of Qt, ANDROID_EXTRA_LIBS must be defined before the first call of FindPackage(Qt5 ...), this is at least what the example projects suggest.
So it is very likely that users have an include(android_openssl/cmakelists.txt) before any calls to FindPackage(Qt5). In this case, QT_VERSION is not defined yet when the include file is parsed.
Anyhow, the version detection currently is working, even if it doesn't look like this: All comparisons with the undefined variable return false, and this way if (NOT (QT_VERSION LESS 5.14.0))
is the if branch that finally succeeds.
I believe that the following code at the beginning of cmakelists.txt would solve the issue:
if(NOT DEFINED QT_VERSION)
find_program(QMAKE_EXE NAMES qmake)
execute_process(COMMAND ${QMAKE_EXE} -query QT_VERSION OUTPUT_VARIABLE QT_VERSION)
endif()
Note that find_program will work here because CMAKE_PREFIX_PATH must contain the base directory of Qt according to the Qt documentation, so this solution is independent of Qt Creator.
I do not have the old versions of Qt available here so I cannot test this code, and I didn't want to create a PR for code that I could not try out.
If it's not to much trouble
Thank you in advance
Hi!
android_openssl/openssl.pri uses qmake contains function both for x86 and x86_64. It's not a problem? As I understand x86_64 contains x86 too. May be better to use qmake equals function for that check?
There is build for OpenSSL 3.1.x version in ssl_3 folder.
Is possible to make build for OpenSSL 3.0.x version too ?
Hi,
I add to my project
and check output QSslSocket::supportsSsl() = false
With the newest build (de37220) i get an error
E AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: library "libcrypto.so" not found: needed by /data/app/~~rNIbTq05mgOpwkIn9Yh-oA==/org.qtproject.example.unittests_nucleus-8rItmCL1Q_yBZdB-e4glaA==/lib/arm64/libssl_3.so in namespace classloader-namespace
It also happens with the binaries from https://github.com/KDAB/android_openssl/tree/issams_fixes
I'm using the 25.1.8937393 NDK, Qt 6.5.1, and Android 13 on a Pixel 6. Building on Kubuntu 22.04.
It works when i manually copy the binaries from 82c850c
OpenSSL 1.1.1 End of life
For the Qt 5.15 LTS, the version of the used OpenSSL must be upgraded to the 3.x.
In the latest official LGPL updated version that currently is 5.15.13, the required patch is already applied and so, everything is ready to use OpenSSL 3.
Sorry for this naive question.
I'm making Android project with Qt 5.14.1.
I'm having trouble with openssl libraries.
My last build, I built for ARMv7 and ARMv8 are ok.
When I'm moving to AAB format, it keep crashing because of this.
I've tried to include libcryto.so & libssl.so to android/lib
or android/libs
(it working on armv7, armv8 build seperately) also try many others from google (jnilibs, etc)
Did you meet this problem before ?
NOTE: I also extract bundle and check, library are in there, same place with other libraries (in /base/lib/ folder)
Hello,
I'm trying to create a qt android library to use it in Android Studio. I only need of QtCore and QtNetwork with SSL supports.
For my scope I started with a new Android Studio project with Native support and I added to the CMakeLists.txt all the stuff to load Qt6Core and Qt6Network. For the SSL support I have cloned the android_openssl and I have included it in this way
if(ANDROID)
include(${SSL_LIB}\CMakeLists.txt)
endif()
But when the target is a LIBRARY seems there's no way to add the dependecies to the project so, also if QT_ANDROID_EXTRA_LIBS is setted, libcrypto and libssl and the other plugins are not added to the project and QNetwork starts without the SSL supports.
Anyone can help?
README.md says to add the include line before find Qt modules, but then qt_add_executable was not yet called to create a target, and it fails.
android_openssl/CMakeLists.txt
Line 19 in ef412c6
IMO we could have a function to set_QT_ANDROID_EXTRA_LIBS(target_name); and also append to QT_ANDROID_EXTRA_LIBS variable instead of set(). This would also allow to use it when Project name is != than target name.
I had this issue with Qt6.5 and I updated both this repo and Qt.
Hi,
As it is now, I had to add the following in my project's CMakeLists.txt after the include
statement:
set_target_properties(${PROJECT_NAME} PROPERTIES
QT_ANDROID_EXTRA_LIBS "${ANDROID_EXTRA_LIBS}"
)
I was thinking that it could be included in your SSL's CMakeLists.txt.
qt.network.ssl: QSslSocket::connectToHostEncrypted: TLS initialization failed
Getting this issue and unable to connect to internet from application
Thank you for these precompiled libs!
You write "Be aware that on Android 5 (API 21) these libs names are clashing with the system SSL libs which are using OpenSSL 1.0".
Is this the reason I get an error like "java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "EVP_camellia_128_cbc" referenced by ...."
Would this be solved by using static libraries (libssl.a and libcrypto.a)?
If so, would it be possible to also provide these static libs (or give some guidance on how to build them?)
After migrating my app to Qt 6.5.0, and am now using OpenSSL 3 provided by android_openssl, I observed the following error
: java.lang.UnsatisfiedLinkError: dlopen failed: library "libcrypto.so" not found: needed by /data/app/~~nv-NYGsxD8h1JbRF7mG3AA==/com.myapp-RSMRM3Ki5qWP-hfAZG2lAg==/lib/arm/libssl_3.so in namespace classloader-namespace
It seems that libssl_3.so depends on libcrypto.so
even though the file provided by this repo is named libcrypto_3.so
. If I copy libcrypto_3.so
to libcrypto.so
the issue goes away
It would be nice to create git tags when new versions of OpenSSL libs are built.
Hello,
First, thank you for submitting this repo.
Even with your libs in the APK, I got the message :
QSslSocket::connectToHostEncrypted: TLS initialization failed
I use Qt 5.12.4
When I try with Qt 5.12.3 and openssl-1.0.2o, SSL is working.
Hi,
I tried to include your pri last week on a simple example and it was working without any issue.
Now on another app I'm getting a compatible issue for libcrypto_1_1.
Weird thing, the first project that was working is now failing with the same issue...
Here is the full log:
The command "/home/bruel/android/sdk/platform-tools/adb" terminated with exit code 1.
adb: error: listener 'tcp:33109' not found
00:28:02: Debugging starts
I el.test.sendSM: Late-enabling -Xcheck:jni
W ActivityThread: Application com.mbruel.test.sendSMS is waiting for the debugger on port 8100...
The command "/home/bruel/android/sdk/platform-tools/adb" terminated with exit code 1.
adb: error: listener 'tcp:5038' not found
I System.out: Sending WAIT chunk
Could not load shared library symbols for 225 libraries, e.g. /system/lib/libandroid_runtime.so.
Use the "info sharedlibrary" command to see the complete listing.
Do you need "set solib-search-path" or "set sysroot"?I System.out: Debugger has connected
I System.out: waiting for debugger to settle...
I chatty : uid=10390(com.mbruel.test.sendSMS) identical 6 lines
I System.out: waiting for debugger to settle...
Could not load shared library symbols for /system/lib/libqti_performance.so.
Do you need "set solib-search-path" or "set sysroot"?Could not load shared library symbols for /system/lib/[email protected].
Do you need "set solib-search-path" or "set sysroot"?I System.out: debugger has settled (1403)
I Perf : Connecting to perf service.
W System : ClassLoader referenced unknown path:
Could not load shared library symbols for /data/app/com.mbruel.test.sendSMS--1Mx2gP70yNDwuF88ADDmw==/lib/arm/libc++_shared.so.
Do you need "set solib-search-path" or "set sysroot"?I QtCore : Start
I Qt : qt started
`/home/bruel/Documents/android/android_openssl/latest/arm64/libcrypto_1_1.so': Shared library architecture aarch64 is not compatible with target architecture armv8-a.
.dynamic section for "/home/bruel/Documents/android/android_openssl/latest/arm64/libcrypto_1_1.so" is not at the expected address (wrong library or version mismatch?)
Any idea why I'm getting that?
I've just pulled your latest changes and it does the same.
I'm using Qt v5.14.1, android-ndk-21, android build sdk 29, Target sdk: API 28: Android 9.
my phone has a Snapdragon 625 processor.
I suppose it is just a bad setting somewhere but I've no clue what to do...
Thanks in advance for the help ;)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.