Closed paulocoutinhox closed 2 years ago
You should use the new two-profile (build/host) approach https://docs.conan.io/en/latest/systems_cross_building/cross_building.html#conan-v1-24-and-newer
conan install libxml2/2.9.10@ --build missing --profile:host ./conan/profiles/android --profile:build ./conan/profiles/mac
dev workflow conan create recipes/libxml2/all libxml2/2.9.10@ --build missing --profile:host ./conan/profiles/android --profile:build ./conan/profiles/mac --test-folder=None
profile android
[settings] os=Android os.api_level=21
arch=armv8
compiler=clang compiler.libcxx=libc++ compiler.version=9
build_type=Release
[options] [build_requires] *: android-ndk/r21d, cmake/3.19.0, ninja/1.10.1 [env]
profile mac
[settings] os=Macos arch=x86_64
compiler=apple-clang compiler.libcxx=libc++ compiler.version=12.0
build_type=Release
[build_requires]
https://github.com/conan-io/conan-center-index/issues/3627#issuecomment-733132527
Hi.
Nice. I will try.
In my case i need pass some settings to override arch, build type, api level etc: https://github.com/ezored/ezored/blob/master/files/targets/android_aar/verbs/prepare.py#L55-L66
It will change or i can keep in this way?
In my case i need pass some settings to override arch, build type, api level etc: https://github.com/ezored/ezored/blob/master/files/targets/android_aar/verbs/prepare.py#L55-L66
It will change or i can keep in this way?
I need this too but have not tried it yet
Now you can use -s:h and/or -s:b to override the settings.
https://docs.conan.io/en/latest/reference/commands/consumer/install.html?highlight=settings
-s:b SETTINGS_BUILD, --settings:build SETTINGS_BUILD Settings to build the package, overwriting the defaults (build machine). e.g.: -s:b compiler=gcc -s:h SETTINGS_HOST, --settings:host SETTINGS_HOST Settings to build the package, overwriting the defaults (host machine). e.g.: -s:h compiler=gcc
Hi,
I have updated the ezored project and now i has a ndk-stl cmake file to find the correct .so and copy it. https://github.com/ezored/ezored/blob/master/files/targets/android_aar/cmake/CMakeLists.txt#L22
It is working nice without problems.
The other problem is that im trying build the library using gradle default method, that is adding the CMakeLists.txt to it and leave it compile the project:
allprojects {
repositories {
google()
jcenter()
}
}
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
ndkVersion "21.0.6113669"
defaultConfig {
minSdkVersion 16
targetSdkVersion 30
versionCode {VERSION_CODE}
versionName '{VERSION}'
externalNativeBuild {
cmake {
cppFlags ""
arguments '-DANDROID_STL=c++_shared'
}
}
}
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
externalNativeBuild {
cmake {
path "../../../../../files/targets/android_aar/cmake/CMakeLists.txt"
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
}
Problems found:
ndkVersion "21.0.6113669"
, so how to use the Android NDK download from conan (~/.conan/data/android-ndk/...) instead of auto download it?python make.py target android_aar package
[INFO] Running "package" on target "android_aar"...
[INFO] Creating AAR library...
[INFO] Creating AAR library for: Debug...
> Task :externalNativeBuildDebug
Build ezored_armeabi-v7a
ninja: Entering directory `/Users/paulo/Developer/workspaces/cpp/ezored/build/android_aar/Debug/aar/library/.cxx/cmake/debug/armeabi-v7a'
[1/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-helpers/cpp/ezored/helpers/EnvironmentHelper.cpp.o
[2/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-helpers/cpp/ezored/helpers/SimpleStringHelper.cpp.o
[3/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/http-client/cpp/ezored/net/http/HttpClientLoggerImpl.cpp.o
[4/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-helpers/cpp/ezored/helpers/DatabaseHelper.cpp.o
[5/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-helpers/cpp/ezored/helpers/SecurityHelper.cpp.o
[6/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-helpers/cpp/ezored/helpers/TodoHelper.cpp.o
[7/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/logger/cpp/ezored/util/LoggerImpl.cpp.o
[8/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-helpers/cpp/ezored/helpers/SharedDataHelper.cpp.o
[9/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/http-client/cpp/ezored/net/http/HttpClientImpl.cpp.o
[10/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-system-services/cpp/ezored/systemservices/CustomerSystemService.cpp.o
[11/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-helpers/cpp/ezored/helpers/ResponseHelper.cpp.o
[12/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-helpers/cpp/ezored/helpers/EZRCustomerHelper.cpp.o
[13/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp.o
[14/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/shared-data/cpp/ezored/data/SharedDataImpl.cpp.o
[15/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-helpers/cpp/ezored/helpers/MapHelper.cpp.o
[16/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/file-helper/cpp/ezored/io/FileHelperImpl.cpp.o
[17/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/support-lib/jni/main-ext/djinni_main_ext.cpp.o
[18/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-core/cpp/ezored/core/ApplicationCoreImpl.cpp.o
[19/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/app-domain/generated-src/jni/com/ezored/domain/EZRDomainDeviceData.cpp.o
[20/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/app-domain/generated-src/jni/com/ezored/domain/EZRDomainInitializationData.cpp.o
[21/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/app-domain/generated-src/jni/com/ezored/domain/EZRDomainCustomer.cpp.o
[22/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/app-domain/generated-src/jni/com/ezored/domain/EZRDomainResponse.cpp.o
[23/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/app-domain/generated-src/jni/com/ezored/domain/EZRDomainResponseError.cpp.o
[24/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/app-system-services/generated-src/jni/com/ezored/systemservices/EZRSystemServicesCustomerSystemServiceLoginData.cpp.o
[25/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/app-core/generated-src/jni/com/ezored/core/EZRCoreApplicationCore.cpp.o
[26/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/app-system-services/generated-src/jni/com/ezored/systemservices/EZRSystemServicesCustomerSystemService.cpp.o
[27/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/app-data-services/generated-src/jni/com/ezored/dataservices/EZRDataServicesTodoDataService.cpp.o
[28/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/app-helpers/generated-src/jni/com/ezored/helpers/EZRHelpersCustomerHelper.cpp.o
[29/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/app-domain/generated-src/jni/com/ezored/domain/EZRDomainTodo.cpp.o
[30/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/datetime/cpp/ezored/time/DateTime.cpp.o
[31/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/app-helpers/generated-src/jni/com/ezored/helpers/EZRHelpersSecurityHelper.cpp.o
[32/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/app-helpers/generated-src/jni/com/ezored/helpers/EZRHelpersEnvironmentHelper.cpp.o
[33/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/app-helpers/generated-src/jni/com/ezored/helpers/EZRHelpersSharedDataHelper.cpp.o
[34/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/app-helpers/generated-src/jni/com/ezored/helpers/EZRHelpersTodoHelper.cpp.o
[35/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/support-lib/jni/djinni_support.cpp.o
[36/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/string-helper/cpp/ezored/helpers/StringHelper.cpp.o
[37/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/logger/generated-src/jni/com/ezored/util/EZRLogger.cpp.o
[38/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/http-client/generated-src/jni/com/ezored/net/http/EZRHttpClientLogger.cpp.o
[39/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/http-client/generated-src/jni/com/ezored/net/http/EZRHttpClientPlatformService.cpp.o
[40/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/logger/generated-src/jni/com/ezored/util/EZRLoggerPlatformService.cpp.o
[41/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/http-client/generated-src/jni/com/ezored/net/http/EZRHttpHeader.cpp.o
[42/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/http-client/generated-src/jni/com/ezored/net/http/EZRHttpClient.cpp.o
[43/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/http-client/generated-src/jni/com/ezored/net/http/EZRHttpRequestParam.cpp.o
[44/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/http-client/generated-src/jni/com/ezored/net/http/EZRHttpRequest.cpp.o
[45/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/http-client/generated-src/jni/com/ezored/net/http/EZRHttpResponse.cpp.o
[46/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/shared-data/generated-src/jni/com/ezored/data/EZRSharedDataPlatformService.cpp.o
[47/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/shared-data/generated-src/jni/com/ezored/data/EZRSharedData.cpp.o
[48/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/datetime/generated-src/jni/com/ezored/time/EZRDateTime.cpp.o
[49/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/file-helper/generated-src/jni/com/ezored/io/EZRFileHelperPlatformService.cpp.o
[50/51] Building CXX object CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/file-helper/generated-src/jni/com/ezored/io/EZRFileHelper.cpp.o
[51/51] Linking CXX shared library lib/libezored.so
FAILED: lib/libezored.so
: && /Users/paulo/Library/Android/sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=armv7-none-linux-androideabi16 --gcc-toolchain=/Users/paulo/Library/Android/sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/darwin-x86_64 --sysroot=/Users/paulo/Library/Android/sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security -std=c++11 -Wall -stdlib=libc++ -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security -std=c++11 -Wall -stdlib=libc++ -O0 -g -O0 -fno-limit-debug-info -Wl,--exclude-libs,libgcc_real.a -Wl,--exclude-libs,libatomic.a -static-libstdc++ -Wl,--build-id -Wl,--fatal-warnings -Wl,--exclude-libs,libunwind.a -Wl,--no-undefined -Qunused-arguments -shared -Wl,-soname,libezored.so -o lib/libezored.so CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-core/cpp/ezored/core/ApplicationCoreImpl.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-system-services/cpp/ezored/systemservices/CustomerSystemService.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-helpers/cpp/ezored/helpers/DatabaseHelper.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-helpers/cpp/ezored/helpers/EZRCustomerHelper.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-helpers/cpp/ezored/helpers/EnvironmentHelper.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-helpers/cpp/ezored/helpers/MapHelper.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-helpers/cpp/ezored/helpers/ResponseHelper.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-helpers/cpp/ezored/helpers/SecurityHelper.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-helpers/cpp/ezored/helpers/SharedDataHelper.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-helpers/cpp/ezored/helpers/SimpleStringHelper.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-helpers/cpp/ezored/helpers/TodoHelper.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/http-client/cpp/ezored/net/http/HttpClientImpl.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/http-client/cpp/ezored/net/http/HttpClientLoggerImpl.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/logger/cpp/ezored/util/LoggerImpl.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/datetime/cpp/ezored/time/DateTime.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/string-helper/cpp/ezored/helpers/StringHelper.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/file-helper/cpp/ezored/io/FileHelperImpl.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/src/shared-data/cpp/ezored/data/SharedDataImpl.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/support-lib/jni/main-ext/djinni_main_ext.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/support-lib/jni/djinni_support.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/app-domain/generated-src/jni/com/ezored/domain/EZRDomainCustomer.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/app-domain/generated-src/jni/com/ezored/domain/EZRDomainDeviceData.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/app-domain/generated-src/jni/com/ezored/domain/EZRDomainInitializationData.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/app-domain/generated-src/jni/com/ezored/domain/EZRDomainResponse.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/app-domain/generated-src/jni/com/ezored/domain/EZRDomainResponseError.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/app-domain/generated-src/jni/com/ezored/domain/EZRDomainTodo.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/app-core/generated-src/jni/com/ezored/core/EZRCoreApplicationCore.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/app-data-services/generated-src/jni/com/ezored/dataservices/EZRDataServicesTodoDataService.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/app-system-services/generated-src/jni/com/ezored/systemservices/EZRSystemServicesCustomerSystemService.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/app-system-services/generated-src/jni/com/ezored/systemservices/EZRSystemServicesCustomerSystemServiceLoginData.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/app-helpers/generated-src/jni/com/ezored/helpers/EZRHelpersCustomerHelper.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/app-helpers/generated-src/jni/com/ezored/helpers/EZRHelpersEnvironmentHelper.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/app-helpers/generated-src/jni/com/ezored/helpers/EZRHelpersSecurityHelper.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/app-helpers/generated-src/jni/com/ezored/helpers/EZRHelpersSharedDataHelper.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/app-helpers/generated-src/jni/com/ezored/helpers/EZRHelpersTodoHelper.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/logger/generated-src/jni/com/ezored/util/EZRLogger.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/logger/generated-src/jni/com/ezored/util/EZRLoggerPlatformService.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/http-client/generated-src/jni/com/ezored/net/http/EZRHttpClient.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/http-client/generated-src/jni/com/ezored/net/http/EZRHttpClientLogger.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/http-client/generated-src/jni/com/ezored/net/http/EZRHttpClientPlatformService.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/http-client/generated-src/jni/com/ezored/net/http/EZRHttpHeader.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/http-client/generated-src/jni/com/ezored/net/http/EZRHttpRequest.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/http-client/generated-src/jni/com/ezored/net/http/EZRHttpRequestParam.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/http-client/generated-src/jni/com/ezored/net/http/EZRHttpResponse.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/file-helper/generated-src/jni/com/ezored/io/EZRFileHelper.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/file-helper/generated-src/jni/com/ezored/io/EZRFileHelperPlatformService.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/shared-data/generated-src/jni/com/ezored/data/EZRSharedData.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/shared-data/generated-src/jni/com/ezored/data/EZRSharedDataPlatformService.cpp.o CMakeFiles/ezored.dir/Users/paulo/Developer/workspaces/cpp/ezored/files/gluecode/datetime/generated-src/jni/com/ezored/time/EZRDateTime.cpp.o -L/Users/paulo/.conan/data/openssl/1.1.1i/_/_/package/97e28b7a5bf0a94fc3ff839b97f43b3c5be057c9/lib -L/Users/paulo/.conan/data/sqlitecpp/2.5.0/_/_/package/a0f87dba86db79ba4853ed37d7ffc81d8599ac53/lib -L/Users/paulo/.conan/data/sqlite3/3.34.0/_/_/package/698da4255aec0098905cc4c41ded32a253fbf311/lib -lssl -lcrypto -lSQLiteCpp -lsqlite3 -latomic -lm && :
/Users/paulo/Library/Android/sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: warning: skipping incompatible /Users/paulo/.conan/data/openssl/1.1.1i/_/_/package/97e28b7a5bf0a94fc3ff839b97f43b3c5be057c9/lib/libcrypto.a while searching for crypto
/Users/paulo/Library/Android/sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lcrypto
/Users/paulo/Library/Android/sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: warning: skipping incompatible /Users/paulo/.conan/data/sqlitecpp/2.5.0/_/_/package/a0f87dba86db79ba4853ed37d7ffc81d8599ac53/lib/libSQLiteCpp.a while searching for SQLiteCpp
/Users/paulo/Library/Android/sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lSQLiteCpp
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:25: error: undefined reference to 'SQLite::Statement::getColumn(char const*)'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:25: error: undefined reference to 'SQLite::Column::getInt64() const'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:25: error: undefined reference to 'SQLite::Column::~Column()'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:26: error: undefined reference to 'SQLite::Statement::getColumn(char const*)'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:26: error: undefined reference to 'SQLite::Column::getString() const'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:26: error: undefined reference to 'SQLite::Column::~Column()'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:27: error: undefined reference to 'SQLite::Statement::getColumn(char const*)'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:27: error: undefined reference to 'SQLite::Column::getString() const'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:27: error: undefined reference to 'SQLite::Column::~Column()'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:28: error: undefined reference to 'SQLite::Statement::getColumn(char const*)'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:28: error: undefined reference to 'SQLite::Column::~Column()'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:29: error: undefined reference to 'SQLite::Column::getString() const'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:30: error: undefined reference to 'SQLite::Column::getString() const'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:32: error: undefined reference to 'SQLite::Column::getInt() const'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:51: error: undefined reference to 'SQLite::Statement::Statement(SQLite::Database&, char const*)'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:53: error: undefined reference to 'SQLite::Statement::exec()'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:54: error: undefined reference to 'SQLite::Statement::~Statement()'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:54: error: undefined reference to 'SQLite::Statement::~Statement()'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:65: error: undefined reference to 'SQLite::Statement::Statement(SQLite::Database&, char const*)'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:67: error: undefined reference to 'SQLite::Statement::bind(char const*, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:68: error: undefined reference to 'SQLite::Statement::bind(char const*, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:69: error: undefined reference to 'SQLite::Statement::bind(char const*, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:70: error: undefined reference to 'SQLite::Statement::bind(char const*, int)'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:71: error: undefined reference to 'SQLite::Statement::bind(char const*, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:73: error: undefined reference to 'SQLite::Statement::exec()'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:75: error: undefined reference to 'SQLite::Database::getLastInsertRowid() const'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:76: error: undefined reference to 'SQLite::Statement::~Statement()'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:76: error: undefined reference to 'SQLite::Statement::~Statement()'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:92: error: undefined reference to 'SQLite::Statement::Statement(SQLite::Database&, char const*)'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:94: error: undefined reference to 'SQLite::Statement::bind(char const*, long long)'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:98: error: undefined reference to 'SQLite::Statement::bind(char const*, int)'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:100: error: undefined reference to 'SQLite::Statement::exec()'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:207: error: undefined reference to 'SQLite::Statement::Statement(SQLite::Database&, char const*)'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:209: error: undefined reference to 'SQLite::Statement::bind(char const*, long long)'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:211: error: undefined reference to 'SQLite::Statement::executeStep()'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:127: error: undefined reference to 'SQLite::Statement::bind(char const*, long long)'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:128: error: undefined reference to 'SQLite::Statement::exec()'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:142: error: undefined reference to 'SQLite::Statement::executeStep()'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:168: error: undefined reference to 'SQLite::Statement::Statement(SQLite::Database&, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:177: error: undefined reference to 'SQLite::Statement::executeStep()'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:195: error: undefined reference to 'SQLite::Statement::bind(char const*, long long)'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-data-services/cpp/ezored/dataservices/EZRTodoDataService.cpp:196: error: undefined reference to 'SQLite::Statement::bind(char const*, int)'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-helpers/cpp/ezored/helpers/DatabaseHelper.cpp:20: error: undefined reference to 'SQLite::getLibVersion()'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-helpers/cpp/ezored/helpers/DatabaseHelper.cpp:0: error: undefined reference to 'SQLite::OPEN_READWRITE'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-helpers/cpp/ezored/helpers/DatabaseHelper.cpp:0: error: undefined reference to 'SQLite::OPEN_CREATE'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-helpers/cpp/ezored/helpers/DatabaseHelper.cpp:37: error: undefined reference to 'SQLite::Database::execAndGet(char const*)'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-helpers/cpp/ezored/helpers/DatabaseHelper.cpp:65: error: undefined reference to 'SQLite::Database::exec(char const*)'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-helpers/cpp/ezored/helpers/DatabaseHelper.cpp:66: error: undefined reference to 'SQLite::Database::exec(char const*)'
/Users/paulo/.conan/data/sqlitecpp/2.5.0/_/_/package/a0f87dba86db79ba4853ed37d7ffc81d8599ac53/include/SQLiteCpp/Column.h:193: error: undefined reference to 'SQLite::Column::getInt() const'
/Users/paulo/.conan/data/sqlitecpp/2.5.0/_/_/package/a0f87dba86db79ba4853ed37d7ffc81d8599ac53/include/SQLiteCpp/Database.h:227: error: undefined reference to 'SQLite::Database::exec(char const*)'
/Users/paulo/Library/Android/sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/memory:3581: error: undefined reference to 'SQLite::Database::~Database()'
/Users/paulo/Library/Android/sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/memory:2155: error: undefined reference to 'SQLite::Database::Database(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, int, int, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)'
/Users/paulo/Library/Android/sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/memory:2133: error: undefined reference to 'SQLite::Database::~Database()'
/Users/paulo/Developer/workspaces/cpp/ezored/files/src/app-helpers/cpp/ezored/helpers/SecurityHelper.cpp:34: error: undefined reference to 'RAND_bytes'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
> Task :externalNativeBuildDebug FAILED
The main problem is number 2. The problem of number 1 is "acceptable", but will be better if we can use only one NDK.
Anyone have a solution?
Another approach, but without success:
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
defaultConfig {
minSdkVersion 16
targetSdkVersion 30
versionCode {VERSION_CODE}
versionName '{VERSION}'
}
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
externalNativeBuild {
cmake {
path "../../../../../files/targets/android_aar/cmake/CMakeLists.txt"
}
}
ndkPath "/Users/paulo/.conan/data/android-ndk/r21d/_/_/package/46f53f156846659bf39ad6675fa0ee8156e859fe"
}
The ndkPath i put manually only to know if it will build, but the same error happen.
More one think to understand: There is any way to pass "ndkPath" from conan "android-ndk" recipe to gradle?
Hi,
I found the bug, but not understand how to solve.
When i run search i get the ID for package armv8, but im building for armv7:
conan search sqlite3/3.34.0@ -q arch=armv8
Existing packages for recipe sqlite3/3.34.0:
Package_ID: 698da4255aec0098905cc4c41ded32a253fbf311
The arch armv7 use other folder, see:
conan search sqlite3/3.34.0@ -q arch=armv7
Existing packages for recipe sqlite3/3.34.0:
Package_ID: 4c5aede56c4ae0ad132ef40fd7ecc8c7eb804b52
[options]
And the armv7 packages are not used, only armv8.
Something is pointing wrong.
All conan files are generated with wrong arch:
grep -R "PROJECT_CONFIG_ARCH" build/android_aar/Debug
build/android_aar/Debug/aar/library/.cxx/cmake/debug/armeabi-v7a/CMakeCache.txt:PROJECT_CONFIG_ARCH:STRING=armv8
build/android_aar/Debug/aar/library/.cxx/cmake/debug/x86/CMakeCache.txt:PROJECT_CONFIG_ARCH:STRING=armv8
build/android_aar/Debug/aar/library/.cxx/cmake/debug/arm64-v8a/CMakeCache.txt:PROJECT_CONFIG_ARCH:STRING=armv8
build/android_aar/Debug/aar/library/.cxx/cmake/debug/x86_64/CMakeCache.txt:PROJECT_CONFIG_ARCH:STRING=armv8
I found the problem.
The "gradle" don't pass variables like "PROJECT_CONFIG_ARCH" (and others) to CMakeLists.txt and it keep the default values.
And you cannot pass it as fixed argument in build.gradle, because each ABI need be one ARCH.
I think that we will need something more complex in build.gradle when it be copied to build folder. We can make something predefined from config files (like name, version and arch), replace on final build.gradle and after build.
I don't know if we can change a gradle task/options to pass different arguments by ABI.
Anyone knows how to do it?
Gradle pass ANDROID_ABI to your CMake.
But I do not understand what you want to achieve. :-) I for example build all third party c++ deps with Conan outside of AS and my C++ SDK with AS.
PS: update AS ndkVersion "21.3.6528147"
build the required packages outside of android studio and have it then on your machine, or upload the to a remote from within cmake of your project, you just download the dependencies for the 1 root c++ project
you can use https://github.com/conan-io/cmake-conan, there is even an awesome PR that let you use lockfiles, https://github.com/conan-io/cmake-conan/pull/294, somthing I highly recommend.
the problem with automatic building is, if it takes long , and it does, users do not know what is going on if you just install dependencies packages, you will also not need the nsdk download, since build dependencies are not required anymore, but you should/need to check that the ndk version is the same
I have a question about the usage of the new two-profile (build/host) approach - as @dmn-star suggests - in existing projects: is it guaranteed that everything works as before with older recipes when I change? Because if one recipe like the android-ndk
forces me to update, but other recipes doesn't work anymore, I' in a deadlock. This feature is still marked as experimental
in the docs, is it stable enough to rely on it in production?
2 recipes are the future, and I hope and think conan will not change/break them (at least for the version 1)
I did not have any problems when I switched to 2 profiles, about 6 month ago, everything just worked way better and more logical. Once you play it through, and get it , you will not want to change back anymore.
Thanks @a4z, so I will try this first, change my whole project to the new approach :smiley:
Hm, I have trouble with android_ndk_installer/r20@bincrafters/stable
with this approach. Looks like the recipe doesn't take the build
settings into account?
conan install android_ndk_installer/r20@bincrafters/stable --profile:build linux_profile --profile:host android_profile
Configuration (profile_host):
[settings]
arch=armv8
compiler=clang
compiler.libcxx=libc++
compiler.version=8
os=Android
os.api_level=21
[options]
[build_requires]
*: android_ndk_installer/r20@bincrafters/stable
[env]
Configuration (profile_build):
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++11
compiler.version=9
os=Linux
os_build=Linux
[options]
[build_requires]
[env]
ERROR: android_ndk_installer/r20@bincrafters/stable: 'settings.arch_build' value not defined
When I add this values (using -s
or -s:h
) to the command it works:
conan install android_ndk_installer/r20@bincrafters/stable --profile:build linux_profile --profile:host android_profile
-s:h arch_build=x86_64 -s:h os_build=Linux
The bincrafter ndk is not made to work with 2 profiles, the new on in the cci is https://conan.io/center/android-ndk
PS: you will have to update your profile, either to compiler verion 9, with r21d or 11 with r22
PS: you will have to update your profile, either to compiler verion 9, with r21d or 11 with r22
Thanks for pointing this out, i have to change this.
When I try the new one I get a different error:
conan install android-ndk/r21d@_/_ --profile:build linux_profile --profile:host android_profile
Configuration (profile_host):
[settings]
arch=armv8
compiler=clang
compiler.libcxx=libc++
compiler.version=9
os=Android
os.api_level=21
[options]
[build_requires]
*: android-ndk/r21d
[env]
Configuration (profile_build):
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++11
compiler.version=9
os=Linux
os_build=Linux
[options]
[build_requires]
[env]
ERROR: The recipe is contraining settings. Invalid setting 'Android' is not a valid 'settings.os' value.
Possible values are ['Linux', 'Macos', 'Windows']
Read "http://docs.conan.io/en/latest/faq/troubleshooting.html#error-invalid-setting"
I think the more I try to understand cross-compiling, the less I understand :confused:. I have another issue open with a more general problem, no answer yet, if someone has some idea for me, very appreciated!
@andioz you don't need to install android-ndk/r21d@/ it happens automatically.
see your profile [build_requires] *: android-ndk/r21d
Build the lib that you need ( here libxml2 see https://github.com/conan-io/conan-center-index/issues/4220#issuecomment-758486060)
conan install libxml2/2.9.10@ --build missing --profile:host ./conan/profiles/android --profile:build ./conan/profiles/Mac
Now Conan builds libxml2/2.9.10 for Android.
PS: I see you are on Linux to build libxml2 for Android
conan install libxml2/2.9.10@ --build missing --profile:build linux_profile --profile:host android_profile
You can install android-ndk manually but keep in mind you need it on your Mac not on Android device.
On your terminal run only
conan install android-ndk/r21d@/
The android profile will always run in the context of the build profile, as all build requirements, that is the beauty
you need to run
conan install android-ndk/r21d@ --profile linux_profile
yes. My /conan/profiles/Mac profile = the default profile, so I can run only >conan install android-ndk/r21d@
I'll try this! I don't dare to explain why I need this command, it's so dirty... But: I use it with --json
option, read the JSON file and get the package directory. This way I can determine the CMake toolchain file path and use it with cmake command line. Very ugly hack, but I'm searching a better solution.
Hi @andioz
Check here for an example: https://github.com/ezored/ezored/blob/master/files/targets/android_aar/verbs/prepare.py#L54-L71 and https://github.com/ezored/ezored/blob/master/files/targets/android_aar/conan/profile/ezored_android_aar_profile
Thanks, I will check later!
The android profile will always run in the context of the build profile, as all build requirements, that is the beauty
you need to run
conan install android-ndk/r21d@ --profile linux_profile
Yes this is it, looks good!
Do you need to build your own lib, which can already be built with CMake, for Android? Can you describe your problem in more detail, please?
Hi,
There is any problem in keep android-ank requirements in android profile?
[build_requires]
*: android-ndk/r21d
It is working here.
There is any problem?
No there are no problems. It is the way to go.
Do you need to build your own lib, which can already be built with CMake, for Android? Can you describe your problem in more detail, please?
@dmn-star If you want to spend some minutes to see my very simple problem example, please have a look here: https://github.com/andioz/conan-cmake-multiplatform, I try to explain in this issue: https://github.com/conan-io/conan-center-index/issues/4224. Many thanks!
I'll have a look
Hi @andioz,
What your specific problem?
Why are you defining the toolchain for android?
You only need simple things:
cd [build-dir]
conan install conanfile.py -pr:b [your-system-profile] -pr:h [android-profile] --build=missing --update
conan build conanfile.py --source-folder [cmakelists-folder] --build-folder [build-target-folder] --install-folder [conan-generated-folder-from-previous-step]
I have to explain more. I cannot use conan build
, because I am using CLion for development, which works directly with CMakeLists.txt. And I use a script too for CI. And as a next next step, I want to include the conan calls into the CMakeLists.txt too, which would give me a single script to use for all steps.
My simple example is a first step for to understand different alternatives without conan build
.
Hi,
I don't know how clion works, but i use QtCreator that use direct CMakeLists.txt too and build without problem.
In QtCreator i can pass the -D definitions:
You can compile from CLion normally?
Or, lets say I want to use https://github.com/conan-io/cmake-conan for all build types (Linux, MacOS, Android, iOS).
You can compile from CLion normally?
Currently I'm using a script to prepare the build directories, after that I can use CLion, yes. I can add -D options too, yes. But I have to know e.g. toolchain file location in advance, which may vary on changing android-ndk versions.
Hi,
Humm...i want this feature too 👍
In my case i need it for build.gradle
to change NDK version to the same of conan data folder to prevent it download other. The problem is get the absolute folder of the conan data recipe.
Maybe we will need a python script for this that capture it from .conan/data folder.
I make an example:
get-ndk-path.py
import os
home_dir = os.path.expanduser("~")
conan_dir = os.path.join(home_dir, ".conan", "data", "android-ndk", "r21d", "_", "_", "package")
ndk_dir_list = list_subfolders_with_paths = [f.path for f in os.scandir(conan_dir) if f.is_dir()]
print(ndk_dir_list[0])
and now you can append to your shell script:
ls -lah "$(python get-ndk-path.py)"
Link to download: https://www.dropbox.com/s/5w9vs1tunuh0hjj/test-ndk.zip?dl=1
This will solve for you and maybe for me :)
My simple example is a first step for to understand different alternatives without
conan build
.
The alternative without conan install
is VCPKG. :-)
I have to explain more. I cannot use
conan build
, because I am using CLion for development, which works directly with CMakeLists.txt. And I use a script too for CI. And as a next next step, I want to include the conan calls into the CMakeLists.txt too, which would give me a single script to use for all steps.
I wouldn't recommend that, you should build your C++ code separate from the dependencies.
conan install ./dependcies/conanfile.txt --build --profile:build linux_profile --profile:host android_profile
https://docs.conan.io/en/latest/uploading_packages/artifactory_ce.html
Install the dependencies from Artifactory on your workstation try transparent CMake integration https://blog.conan.io/2018/06/11/Transparent-CMake-Integration.html
Build your lib/sdk with Android Studio.
I have now tried the following
conanfile.txt [requires] cmake/3.19.2 ninja/1.10.1 android-ndk/r22
[generators] virtualenv
conan install . source activate.sh
Now you could theoretically access all env vars defined in the android-ndk recipe. This works fine for ninja and CMake but not yet for android-ndk .
As a workaround
where ndk-build /Users/dmn-star/.conan/data/android-ndk/r22///package/46f53f156846659bf39ad6675fa0ee8156e859fe/ndk-build
to be continued...
the package folder is exportet so ndk-buid is in the path, why this is not enough for the virtualenv generator .... but ndk-build allone might not be enough anyway
but there are many ways to build with the ndk, for cmake you need the toolchain file, other recipes need some adoptions to work, see openssl for example, some just work, see curl the best way I think to consume it is cmake, and getting the toolchain file
I have a tool that simple detects the folder in the cache and gives me the path to the toolchain , and this is passed to standard cmake, works nicely . Building from Android dStudio , you should get the toolchain settings for free
why this is not enough for the virtualenv generator ....
because of :-)
if not self.settings_target.os == "Android":
return
self.output.info('Creating NDK_ROOT environment variable: %s' % self._ndk_root)
self.env_info.NDK_ROOT = self._ndk_root
self.output.info('Creating ANDROID_NDK_HOME environment variable: %s' % self.package_folder)
self.env_info.ANDROID_NDK_HOME = self.package_folder
but ndk-build allone might not be enough anyway
is only a workaround to get the NDK root (cut ndk-build)
ANDROID_NDKHOME = /Users/dmn/.conan/data/androidndk/r22//_/package/46f53f156846659bf39ad6675fa0ee8156e859fe/
And now add /cmake/android.toolchain.cmake to locate the cmake toolchain.
but the the folder is added to PATH before the return ....
do you think it would help to put this self.env_info.ANDROID_NDK_HOME = self.package_folder
above the return, would that arrive in the virtualenv?
Wow, many ideas (including using VCPKG :smiley:; but thanks I want to use conan install
, but not conan build
). Too much for this evening now, I have to sleep over it, it's late here. Will continue tomorrow, thank you guys.
My resumee for today: no easy, obvious solution...
but the the folder is added to PATH before the return ....
do you think it would help to put this
self.env_info.ANDROID_NDK_HOME = self.package_folder
above the return, would that arrive in the virtualenv?
Yes, I think so. I will change the ndk recipe locally tomorrow and try to build the example only with virt. dev and CMake.
cmake ...
cmake -H./ndk-samples/hello-jni/app/src/main/cpp -B./ndk-samples/hello-jni/app/.cxx/cmake/arm8-debug/arm64-v8a -GNinja -DANDROID_ABI=arm64-v8a -DANDROID_NDK=${ANDROID_NDK_ROOT} -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_ROOT}/build/cmake/android.toolchain.cmake -DANDROID_NATIVE_API_LEVEL=23 -DANDROID_TOOLCHAIN=clang
-- The C compiler identification is Clang 11.0.5 -- The CXX compiler identification is Clang 11.0.5 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /Users/dmn-star/.conan/data/android-ndk/r22///package/46f53f156846659bf39ad6675fa0ee8156e859fe/toolchains/llvm/prebuilt/darwin-x8664/bin/clang - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /Users/dmn-star/.conan/data/android-ndk/r22//_/package/46f53f156846659bf39ad6675fa0ee8156e859fe/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done -- Generating done -- Build files have been written to: /Users/dmn-star/dev/temp/conan_virtualenv/ndk-samples/hello-jni/app/.cxx/cmake/arm8-debug/arm64-v8a
cmake --build ./ndk-samples/hello-jni/app/.cxx/cmake/arm8-debug/arm64-v8a
[2/2] Linking C shared library libhello-jni.so
there is one-liner to get NDK path:
conan info --paths android-ndk/r22@ | grep "package_folder" | cut -c 21-
I would prefer to use virt env gen #4253
I'm just playing with this, looks good so far: using virtualenv
generator, in CMakeLists.t.xt
BEFORE project()
line, I read the environment.sh.env
file and set all environment variables manually. Looks like everything is found then, no need to add any -D
option for CMake...
cmake_minimum_required(VERSION 3.18)
# Set conan environment variables
if(EXISTS "${CMAKE_BINARY_DIR}/environment.sh.env")
FILE(READ "${CMAKE_BINARY_DIR}/environment.sh.env" _contents)
STRING(REGEX REPLACE "\n" ";" _contents "${_contents}")
foreach(_line ${_contents})
string(REGEX MATCH "([^=]+)=\"(.*)\"" _match ${_line})
if(NOT "${_match}" STREQUAL "")
set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}")
endif()
endforeach()
unset(_contents)
unset(_line)
unset(_match)
endif()
project(hello-world-2 CXX)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)
add_executable(${PROJECT_NAME} src/main.cpp)
target_link_libraries(${PROJECT_NAME} CONAN_PKG::gtest)
Maybe some kind of "workaround" or "hack", but should work, what's your opinion?
There is one problem to solve, I have to simulate the "alternative value" feature with this variable settings:
PATH="/path/to/.conan/data/android-ndk/r21d/_/_/package/4db1be536558d833e52e862fd84d64d75c2b3656"${PATH+:$PATH}
DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH+:$DYLD_LIBRARY_PATH}
LD_LIBRARY_PATH=${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}
I just used CMake in my terminal to build the ndk example on CLI.
Hi,
Im breaking my head now about how can i build something for Android since package https://github.com/bincrafters/conan-android_ndk_installer is obsolete.
Now i see a android-ndk recipe.
But how can i use it to build my packages?
There isn't any tutorial or something like this.
Can anyone help me?
Today im using profile: https://github.com/ezored/ezored/blob/master/files/targets/android_aar/conan/profile/ezored_android_aar_profile
And on each target i pass arch, api_level and others: https://github.com/ezored/ezored/blob/master/files/targets/android_aar/verbs/prepare.py#L53-L60
How i can pass it to recipe now?
Thanks.