I'm using Android Studio to create a JNI module, here's my CMakeList.txt:
cmake_minimum_required(VERSION 3.5.1)
SET(CMAKE_CXX_FLAGS "-fPIC -std=c++11")
# include deps headers
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_LIST_DIR}/src
${CMAKE_CURRENT_LIST_DIR}/src/3rdparty/re2
/usr/include)
# JNI Support
INCLUDE_DIRECTORIES(/jdk1.8.0_111/include
/jdk1.8.0_111/include/linux)
file(GLOB_RECURSE MY_SRC "src/mypackage/*.cpp")
ADD_LIBRARY(my_target SHARED api.cpp ${MY_SRC})
/usr/include
The first clue is, this program can't find system headers itself, I need to include /usr/include
with INCLUDE_DIRECTORIES
. e.g. it can't find boost/version.hpp
unless I include /usr/include
.
Problem
This program turns out a fatal error : Error:(391, 10) fatal error: 'gnu/stubs.h' file not found
. It's so wired, I never uses stubs.h
.
Then I found there is a stub.h
in /usr/include/x86_64-linux-gnu
, so I include it as well, but then there's a Error:(7, 11) fatal error: 'gnu/stubs-32.h' file not found
and I don't have it in my system. How can I deal with these kind of problem, and I never uses stubs-32.h
in my program, shouldn't it be packaged into boost library (if it is required by boost)?