Skip to content

Build Error #3

@deepakrokz

Description

@deepakrokz

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.

Build command failed.
Error while executing process E:\Softwares\AndroidStudio\Sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {-HD:\MyWorkspace\test\app\src\main\cpp -BD:\MyWorkspace\test\app.externalNativeBuild\cmake\debug\armeabi-v7a -GAndroid Gradle - Ninja -DANDROID_ABI=armeabi-v7a -DANDROID_NDK=E:\Softwares\AndroidStudio\Sdk\ndk-bundle -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=D:\MyWorkspace\test\app\build\intermediates\cmake\debug\obj\armeabi-v7a -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=E:\Softwares\AndroidStudio\Sdk\cmake\3.6.4111459\bin\ninja.exe -DCMAKE_TOOLCHAIN_FILE=E:\Softwares\AndroidStudio\Sdk\ndk-bundle\build\cmake\android.toolchain.cmake -DANDROID_PLATFORM=android-14 -DANDROID_PLATFORM=android-15 -DANDROID_TOOLCHAIN=clang -DANDROID_STL=gnustl_static -DANDROID_ARM_MODE=arm -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON}
(include) CMakeLists.txt
-- Check for working C compiler: E:/Softwares/AndroidStudio/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe
-- Check for working C compiler: E:/Softwares/AndroidStudio/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: E:/Softwares/AndroidStudio/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe
-- Check for working CXX compiler: E:/Softwares/AndroidStudio/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:7 (add_subdirectory):
-- Configuring incomplete, errors occurred!
See also "D:/MyWorkspace/test/app/.externalNativeBuild/cmake/debug/armeabi-v7a/CMakeFiles/CMakeOutput.log".
Build command failed.
Error while executing process E:\Softwares\AndroidStudio\Sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {-HD:\MyWorkspace\test\app\src\main\cpp -BD:\MyWorkspace\test\app.externalNativeBuild\cmake\release\armeabi-v7a -GAndroid Gradle - Ninja -DANDROID_ABI=armeabi-v7a -DANDROID_NDK=E:\Softwares\AndroidStudio\Sdk\ndk-bundle -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=D:\MyWorkspace\test\app\build\intermediates\cmake\release\obj\armeabi-v7a -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM=E:\Softwares\AndroidStudio\Sdk\cmake\3.6.4111459\bin\ninja.exe -DCMAKE_TOOLCHAIN_FILE=E:\Softwares\AndroidStudio\Sdk\ndk-bundle\build\cmake\android.toolchain.cmake -DANDROID_PLATFORM=android-14 -DANDROID_PLATFORM=android-15 -DANDROID_TOOLCHAIN=clang -DANDROID_STL=gnustl_static -DANDROID_ARM_MODE=arm -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON}
(include) CMakeLists.txt
-- Check for working C compiler: E:/Softwares/AndroidStudio/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe
-- Check for working C compiler: E:/Softwares/AndroidStudio/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: E:/Softwares/AndroidStudio/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe
-- Check for working CXX compiler: E:/Softwares/AndroidStudio/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:7 (add_subdirectory):
-- Configuring incomplete, errors occurred!
See also "D:/MyWorkspace/test/app/.externalNativeBuild/cmake/release/armeabi-v7a/CMakeFiles/CMakeOutput.log".

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions