0

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)?

2
  • Hi. Did you look here? stackoverflow.com/questions/7412548/…. It talks about installing some libs that might be missing. Commented Dec 22, 2016 at 15:07
  • Be careful with the include directories you are using. You are including a path to the system includes, but they could not be compatible with the libraries you are adding to android application. This could be a problem if you are using different versions (of the boost library for example) in your linux machine and in your android app. Commented Dec 23, 2016 at 20:07

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.