ivanarh / ndcrash

A powerful crash reporting library for Android NDK. Don't forget to run git submodule update --init --recursive after checking out.
Apache License 2.0
111 stars 21 forks source link

fatal error:android/log.h:no such file or directory. #2

Open zhouchuanping opened 6 years ago

zhouchuanping commented 6 years ago

When I build ndcrash a static library by cmake,It report a error:ndcrash_log.h:3:25 fatal error:android/log.h:no such file or directory.How can i solve it? My Cmake Version is 2.8.12.2,my SDK version is r16.

ivanarh commented 6 years ago

It seems like you tried to build it for desktop operating system without a proper Android toolchain. Please try something like that:

mkdir build
cd build
${ANDROID_HOME}/cmake/3.6.4111459/bin/cmake \
-Wno-dev \
-DCMAKE_SYSTEM_NAME=Android \
-DANDROID_PLATFORM=android-14 \
-DANDROID_ABI=armeabi-v7a \
-DANDROID_NDK=${ANDROID_NDK_ROOT} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_ROOT}/build/cmake/android.toolchain.cmake \
-DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DENABLE_LIBCORKSCREW=ON \
-DENABLE_LIBUNWIND=ON \
-DENABLE_LIBUNWINDSTACK=ON \
-DENABLE_CXXABI=ON \
-DENABLE_STACKSCAN=ON \
-DENABLE_INPROCESS=ON \
-DENABLE_OUTOFPROCESS=ON \
..
make

ANDROID_HOME variable should point to Android SDK location. ANDROID_NDK_ROOT variable should point to Android NDK location.