Open deepakrokz opened 6 years ago
Getting this, please check
CMake Error at CMakeLists.txt:7 (add_subdirectory):
Try git submodule update --init --recursive Libunwind requires lzma library which is added as a submodule, i suspect you didn't fetch it.
I am adding complete source code of this https://github.com/ivanarh/libunwind-ndk/tree/58d2371c86789c2cc591be116348147bcca34cf1 in this location
src/main/cpp/external/libunwind/
why do I need to run this command when it's not synced with Github link, so not able to run the command
You should either clone libunwind-ndk repository as a submodule or manually clone https://android.googlesource.com/platform/external/lzma repository to lzma folder in libunwind-ndk root.
I did the manual clone of Lzma and added in the root of libunwind-ndk root but still getting this
CMake Error at CMakeLists.txt:7 (add_subdirectory):
Please add CMAKE_VERBOSE_MAKEFILE argument to your build.gradle, it should be something like this:
android {
...
defaultConfig {
...
externalNativeBuild {
cmake {
arguments "-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON"
}
}
After that run build from console:
./gradlew assembleDebug
And attach a full build output.
I tried as you suggested but no luck, earlier I was trying with this argument
arguments '-DANDROID_PLATFORM=android-15', '-DANDROID_ARM_MODE=arm', '-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON', '-DANDROID_TOOLCHAIN=clang', '-DANDROID_STL=gnustl_static'
Hi @ivanarh ,
can you please help me out of this, please.
I can't help you without a full build log. If you can't build an app from console you can attach a following file:
D:/MyWorkspace/hello-libs/app/.externalNativeBuild/cmake/release/armeabi-v7a/CMakeFiles/CMakeOutput.log
I hope it would help.
Thanks for your time and reply, CMakeOutput.log here is the file you are asking for:
Hi @ivanarh , Have you found anything?
Hi @ivanarh , I am trying to add libunwind-ndk in my project with the help of https://github.com/ivanarh/nativecrashes. Getting this error can your please help.
Here is my build.gradle configuration for ndk:
defaultConfig { applicationId = 'com.example.hellolibs' minSdkVersion 14 targetSdkVersion 25 versionCode = 1 versionName = '1.0' externalNativeBuild { cmake { arguments "-DANDROID_PLATFORM=android-15", '-DANDROID_TOOLCHAIN=clang', '-DANDROID_STL=gnustl_static', "-DANDROID_ARM_MODE=arm", "-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON" } } ndk { abiFilters "x86", "armeabi", "armeabi-v7a" } } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } sourceSets { main { // let gradle pack the shared library into apk jniLibs.srcDirs = ['../distribution/gperf/lib'] } } externalNativeBuild { cmake { path 'src/main/cpp/CMakeLists.txt' } }
and CMakeLists.txt is `cmake_minimum_required(VERSION 3.4.1)
libunwind start
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fno-optimize-sibling-calls -fno-inline") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-optimize-sibling-calls -fno-inline")
add_subdirectory(src/main/cpp/external/libunwind/cmake) include_directories(src/main/cpp/external/libunwind/include)
find_library(log-lib log)
libunwind end
set(distribution_DIR ${CMAKE_SOURCE_DIR}/../../../../distribution)
add_library(lib_gmath STATIC IMPORTED) set_target_properties(lib_gmath PROPERTIES IMPORTED_LOCATION ${distribution_DIR}/gmath/lib/${ANDROID_ABI}/libgmath.a)
add_library(lib_gperf SHARED IMPORTED) set_target_properties(lib_gperf PROPERTIES IMPORTED_LOCATION ${distribution_DIR}/gperf/lib/${ANDROID_ABI}/libgperf.so)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
add_library(test1 SHARED test1.cpp Demo.cpp native-lib.c )
target_include_directories(test1 PRIVATE ${distribution_DIR}/gmath/include ${distribution_DIR}/gperf/include)
target_link_libraries(test1 ${log-lib} unwind android lib_gmath lib_gperf log) `
Please suggest, I am stuck from several days. Thanks in advance!