How to Setup JNI Include Path for Android Studio - android-studio

I am incoperating a JNI fuction in my Android Project however it can not resolve the header which is located at /usr/local/include/opencv2.How to direct Android Studio to look for header file over there?
It's Android studio 3 under CentOS 7.
Build command failed.
Error while executing process /home/<username>/Android/Sdk/cmake/3.6.4111459/bin/cmake with arguments {--build /home/<username>/AndroidStudioProjects/<project_name>/app/.externalNativeBuild/cmake/debug/armeabi-v7a --target removebackground}
[1/2] Building CXX object CMakeFiles/removebackground.dir/src/main/cpp/removebackground.cpp.o
FAILED: /home/<username>/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=armv7-none-linux-androideabi --gcc-toolchain=/home/<username>/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 --sysroot=/home/<username>/Android/Sdk/ndk-bundle/sysroot -Dremovebackground_EXPORTS -I/home/<username>/opencv-android-sdk/sdk/native/jni/include -isystem /home/<username>/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem /home/<username>/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -isystem /home/<username>/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/backward -isystem /home/<username>/Android/Sdk/ndk-bundle/sysroot/usr/include/arm-linux-androideabi -D__ANDROID_API__=16 -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fno-integrated-as -mthumb -Wa,--noexecstack -Wformat -Werror=format-security -frtti -fexceptions -O0 -fno-limit-debug-info -fPIC -MD -MT CMakeFiles/removebackground.dir/src/main/cpp/removebackground.cpp.o -MF CMakeFiles/removebackground.dir/src/main/cpp/removebackground.cpp.o.d -o CMakeFiles/removebackground.dir/src/main/cpp/removebackground.cpp.o -c /home/<username>/AndroidStudioProjects/<project_name>/app/src/main/cpp/removebackground.cpp
/home/<username>/AndroidStudioProjects/<project_name>/app/src/main/cpp/removebackground.cpp:4:10: fatal error: 'opencv2/imgcodecs.hpp' file not found
#include <opencv2/imgcodecs.hpp>
^~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
ninja: build stopped: subcommand failed.

In the /app/CMakeLists.txt add
include_directories(/usr/local/include)
and that's all you gota do。
Y(^_^)Y find solution to my own question all the time.

Related

Package "boost_atomic" NOT FOUND when running CMake

I'm trying to install RStudio Desktop using these instructions. This requires boost >= v1.69. I'm running Ubuntu 18.10 in a Windows subsystem (WSL), and there is no repository for this version of boost. Consequently, I installed boost v1.70 from source using these instructions.
However, when I run the cmake command in the RStudio install instructions, I get this:
(base) balter#spectre3:~$ cmake .. -DRSTUDIO_TARGET=Desktop -DRSTUDIO_PACKAGE_BUILD=1
CMake Error: The source directory "/home" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
(base) balter#spectre3:~$ cd rstudio/build/
(base) balter#spectre3:~/rstudio/build$ cmake .. -DRSTUDIO_TARGET=Desktop -DRSTUDIO_PACKAGE_BUILD=1
-- CMake build type not set; defaulting to debug build
-- Found Boost 1.70.0 at /usr/lib/cmake/Boost-1.70.0
-- Requested configuration: QUIET REQUIRED
-- Found boost_headers 1.70.0 at /usr/lib/cmake/boost_headers-1.70.0
-- Boost 1.69.0 found.
-- Found Boost 1.70.0 at /usr/lib/cmake/Boost-1.70.0
-- Requested configuration: QUIET REQUIRED COMPONENTS atomic;chrono;date_time;filesystem;iostreams;program_options;random;regex;system;thread
-- Found boost_atomic 1.70.0 at /usr/lib/cmake/boost_atomic-1.70.0
-- No suitable boost_atomic variant has been identified!
-- libboost_atomic.so.1.70.0 (shared, Boost_USE_STATIC_LIBS=ON)
CMake Error at /usr/lib/cmake/Boost-1.70.0/BoostConfig.cmake:95 (find_package):
Found package configuration file:
/usr/lib/cmake/boost_atomic-1.70.0/boost_atomic-config.cmake
but it set boost_atomic_FOUND to FALSE so package "boost_atomic" is
considered to be NOT FOUND. Reason given by package:
No suitable build variant has been found.
Call Stack (most recent call first):
/usr/lib/cmake/Boost-1.70.0/BoostConfig.cmake:124 (boost_find_dependency)
/usr/share/cmake-3.12/Modules/FindBoost.cmake:261 (find_package)
src/cpp/CMakeLists.txt:235 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/balter/rstudio/build/CMakeFiles/CMakeOutput.log".
See also "/home/balter/rstudio/build/CMakeFiles/CMakeError.log".
The last bits of the log files are:
CMakeOutput.log
~~~~~~~~~~~~~~~~~~~~~~~~
Determining if the function inotify_init1 exists passed with the following output:
Change Dir: /home/balter/rstudio/build/CMakeFiles/CMakeTmp
Run Build Command:"/home/balter/conda/bin/make" "cmTC_bd56e/fast"
/home/balter/conda/bin/make -f CMakeFiles/cmTC_bd56e.dir/build.make CMakeFiles/cmTC_bd56e.dir/build
make[1]: Entering directory '/home/balter/rstudio/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_bd56e.dir/CheckFunctionExists.c.o
/home/balter/conda/bin/x86_64-conda_cos6-linux-gnu-cc -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -DCHECK_FUNCTION_EXISTS=inotify_init1 -fPIE -o CMakeFiles/cmTC_bd56e.dir/CheckFunctionExists.c.o -c /usr/share/cmake-3.12/Modules/CheckFunctionExists.c
Linking C executable cmTC_bd56e
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_bd56e.dir/link.txt --verbose=1
/home/balter/conda/bin/x86_64-conda_cos6-linux-gnu-cc -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -DCHECK_FUNCTION_EXISTS=inotify_init1 -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -pie -Wl,-z,relro,-z,now CMakeFiles/cmTC_bd56e.dir/CheckFunctionExists.c.o -o cmTC_bd56e
make[1]: Leaving directory '/home/balter/rstudio/build/CMakeFiles/CMakeTmp'
Determining if the function setresuid exists passed with the following output:
Change Dir: /home/balter/rstudio/build/CMakeFiles/CMakeTmp
Run Build Command:"/home/balter/conda/bin/make" "cmTC_af28b/fast"
/home/balter/conda/bin/make -f CMakeFiles/cmTC_af28b.dir/build.make CMakeFiles/cmTC_af28b.dir/build
make[1]: Entering directory '/home/balter/rstudio/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_af28b.dir/CheckFunctionExists.c.o
/home/balter/conda/bin/x86_64-conda_cos6-linux-gnu-cc -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -DCHECK_FUNCTION_EXISTS=setresuid -fPIE -o CMakeFiles/cmTC_af28b.dir/CheckFunctionExists.c.o -c /usr/share/cmake-3.12/Modules/CheckFunctionExists.c
Linking C executable cmTC_af28b
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_af28b.dir/link.txt --verbose=1
/home/balter/conda/bin/x86_64-conda_cos6-linux-gnu-cc -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -DCHECK_FUNCTION_EXISTS=setresuid -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -pie -Wl,-z,relro,-z,now CMakeFiles/cmTC_af28b.dir/CheckFunctionExists.c.o -o cmTC_af28b
make[1]: Leaving directory '/home/balter/rstudio/build/CMakeFiles/CMakeTmp'
CMakeOutput.log
Determining if the pthread_create exist failed with the following output:
Change Dir: /home/balter/rstudio/build/CMakeFiles/CMakeTmp
Run Build Command:"/home/balter/conda/bin/make" "cmTC_6613e/fast"
/home/balter/conda/bin/make -f CMakeFiles/cmTC_6613e.dir/build.make CMakeFiles/cmTC_6613e.dir/build
make[1]: Entering directory '/home/balter/rstudio/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_6613e.dir/CheckSymbolExists.c.o
/home/balter/conda/bin/x86_64-conda_cos6-linux-gnu-cc -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -fPIE -o CMakeFiles/cmTC_6613e.dir/CheckSymbolExists.c.o -c /home/balter/rstudio/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
Linking C executable cmTC_6613e
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_6613e.dir/link.txt --verbose=1
/home/balter/conda/bin/x86_64-conda_cos6-linux-gnu-cc -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -pie -Wl,-z,relro,-z,now CMakeFiles/cmTC_6613e.dir/CheckSymbolExists.c.o -o cmTC_6613e
/home/balter/conda/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: CMakeFiles/cmTC_6613e.dir/CheckSymbolExists.c.o: in function `main':
CheckSymbolExists.c:(.text.startup+0x3): undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_6613e.dir/build.make:87: cmTC_6613e] Error 1
make[1]: Leaving directory '/home/balter/rstudio/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_6613e/fast] Error 2
File /home/balter/rstudio/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <pthread.h>
int main(int argc, char** argv)
{
(void)argv;
#ifndef pthread_create
return ((int*)(&pthread_create))[argc];
#else
(void)argc;
return 0;
#endif
}
Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /home/balter/rstudio/build/CMakeFiles/CMakeTmp
Run Build Command:"/home/balter/conda/bin/make" "cmTC_c8506/fast"
/home/balter/conda/bin/make -f CMakeFiles/cmTC_c8506.dir/build.make CMakeFiles/cmTC_c8506.dir/build
make[1]: Entering directory '/home/balter/rstudio/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_c8506.dir/CheckFunctionExists.c.o
/home/balter/conda/bin/x86_64-conda_cos6-linux-gnu-cc -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -DCHECK_FUNCTION_EXISTS=pthread_create -fPIE -o CMakeFiles/cmTC_c8506.dir/CheckFunctionExists.c.o -c /usr/share/cmake-3.12/Modules/CheckFunctionExists.c
Linking C executable cmTC_c8506
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_c8506.dir/link.txt --verbose=1
/home/balter/conda/bin/x86_64-conda_cos6-linux-gnu-cc -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -DCHECK_FUNCTION_EXISTS=pthread_create -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -pie -Wl,-z,relro,-z,now CMakeFiles/cmTC_c8506.dir/CheckFunctionExists.c.o -o cmTC_c8506 -lpthreads
/home/balter/conda/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_c8506.dir/build.make:87: cmTC_c8506] Error 1
make[1]: Leaving directory '/home/balter/rstudio/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_c8506/fast] Error 2
Determining if the function getpeereid exists failed with the following output:
Change Dir: /home/balter/rstudio/build/CMakeFiles/CMakeTmp
Run Build Command:"/home/balter/conda/bin/make" "cmTC_b9b1c/fast"
/home/balter/conda/bin/make -f CMakeFiles/cmTC_b9b1c.dir/build.make CMakeFiles/cmTC_b9b1c.dir/build
make[1]: Entering directory '/home/balter/rstudio/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_b9b1c.dir/CheckFunctionExists.c.o
/home/balter/conda/bin/x86_64-conda_cos6-linux-gnu-cc -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -DCHECK_FUNCTION_EXISTS=getpeereid -fPIE -o CMakeFiles/cmTC_b9b1c.dir/CheckFunctionExists.c.o -c /usr/share/cmake-3.12/Modules/CheckFunctionExists.c
Linking C executable cmTC_b9b1c
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_b9b1c.dir/link.txt --verbose=1
/home/balter/conda/bin/x86_64-conda_cos6-linux-gnu-cc -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -DCHECK_FUNCTION_EXISTS=getpeereid -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -pie -Wl,-z,relro,-z,now CMakeFiles/cmTC_b9b1c.dir/CheckFunctionExists.c.o -o cmTC_b9b1c
/home/balter/conda/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: CMakeFiles/cmTC_b9b1c.dir/CheckFunctionExists.c.o: in function `main':
CheckFunctionExists.c:(.text.startup+0xd): undefined reference to `getpeereid'
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_b9b1c.dir/build.make:87: cmTC_b9b1c] Error 1
make[1]: Leaving directory '/home/balter/rstudio/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_b9b1c/fast] Error 2

Cannot build rgdal package on amazon linux AMI

I am unable to build rgdal (see output in code chunk below) on my AWS server. I understand from the discussion here, and here that this has something to do with missing libraries for geos and gdal, but none of the solutions suggested appears to work. If I run sudo yum install libgdal1 libgdal1-dev libgeos libgeos-dev I get the following output:
Loaded plugins: priorities, update-motd, upgrade-helper amzn-main
| 2.1 kB 00:00:00 amzn-updates
| 2.5 kB 00:00:00 1045 packages excluded due to repository
priority protections No package libgdal1 available. No package
libgdal1-dev available. Package geos-3.4.2-1.4.amzn1.x86_64 already
installed and latest version No package libgeos-dev available. Nothing
to do
I have already enabled EPEL, but it does not solve the problem.
Unfortunately I'm not very experienced with Linux, and have no idea how to move forward...
R output after attempting to install rgdal:
> install.packages("rgdal", type="source")
Installing package into ‘/home/andrea/R/x86_64-redhat-linux-gnu-library’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/rgdal_1.3-2.tar.gz'
Content type 'application/x-gzip' length 1667049 bytes (1.6 MB)
==================================================
downloaded 1.6 MB
* installing *source* package ‘rgdal’ ...
** package ‘rgdal’ successfully unpacked and MD5 sums checked
configure: CC: gcc -m64 -std=gnu99
configure: CXX: g++ -m64
configure: rgdal: 1.3-2
checking for /usr/bin/svnversion... no
configure: svn revision: 755
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ -m64 accepts -g... yes
checking whether g++ -m64 supports C++11 features by default... no
checking whether g++ -m64 supports C++11 features with -std=gnu++11... yes
configure: C++11 support available
checking for gdal-config... /usr/local/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 2.0.0
checking GDAL version >= 1.11.4... yes
checking gdal: linking with --libs only... yes
checking GDAL: /usr/local/share/gdal/pcs.csv readable... yes
checking proj_api.h presence and usability... yes
./configure: line 3395: test: =: unary operator expected
checking PROJ version >= 4.8.0... yes
checking projects.h presence and usability... yes
/tmp/ccV0TCuc.o: In function `main':
/tmp/Rtmp52ge38/R.INSTALL4e4e42b08a4a/rgdal/proj_conf_test2.c:14: undefined reference to `pj_get_default_ctx'
/tmp/Rtmp52ge38/R.INSTALL4e4e42b08a4a/rgdal/proj_conf_test2.c:20: undefined reference to `pj_ctx_fclose'
collect2: error: ld returned 1 exit status
./configure: line 3511: ./proj_conf_test2: No such file or directory
checking PROJ.4: epsg found and readable... yes
/tmp/cczdLgSd.o: In function `main':
/tmp/Rtmp52ge38/R.INSTALL4e4e42b08a4a/rgdal/proj_conf_test3.c:14: undefined reference to `pj_get_default_ctx'
/tmp/Rtmp52ge38/R.INSTALL4e4e42b08a4a/rgdal/proj_conf_test3.c:20: undefined reference to `pj_ctx_fclose'
collect2: error: ld returned 1 exit status
./configure: line 3570: ./proj_conf_test3: No such file or directory
checking PROJ.4: conus found and readable... yes
configure: Package CPP flags: -I/usr/local/include
configure: Package LIBS: -L/usr/local/lib -lgdal -lproj
configure: creating ./config.status
config.status: creating src/Makevars
** libs
g++ -m64 -std=gnu++11 -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/home/andrea/R/x86_64-redhat-linux-gnu-library/sp/include" -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c OGR_write.cpp -o OGR_write.o
g++ -m64 -std=gnu++11 -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/home/andrea/R/x86_64-redhat-linux-gnu-library/sp/include" -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c gdal-bindings.cpp -o gdal-bindings.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/home/andrea/R/x86_64-redhat-linux-gnu-library/sp/include" -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c init.c -o init.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/home/andrea/R/x86_64-redhat-linux-gnu-library/sp/include" -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c inverser.c -o inverser.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/home/andrea/R/x86_64-redhat-linux-gnu-library/sp/include" -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c local_stubs.c -o local_stubs.o
g++ -m64 -std=gnu++11 -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/home/andrea/R/x86_64-redhat-linux-gnu-library/sp/include" -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c ogr_geom.cpp -o ogr_geom.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/home/andrea/R/x86_64-redhat-linux-gnu-library/sp/include" -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c ogr_polygons.c -o ogr_polygons.o
g++ -m64 -std=gnu++11 -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/home/andrea/R/x86_64-redhat-linux-gnu-library/sp/include" -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c ogr_proj.cpp -o ogr_proj.o
g++ -m64 -std=gnu++11 -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/home/andrea/R/x86_64-redhat-linux-gnu-library/sp/include" -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c ogrdrivers.cpp -o ogrdrivers.o
g++ -m64 -std=gnu++11 -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/home/andrea/R/x86_64-redhat-linux-gnu-library/sp/include" -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c ogrsource.cpp -o ogrsource.o
g++ -m64 -std=gnu++11 -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/home/andrea/R/x86_64-redhat-linux-gnu-library/sp/include" -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c projectit.cpp -o projectit.o
g++ -m64 -std=gnu++11 -shared -L/usr/lib64/R/lib -L/usr/local/lib64 -o rgdal.so OGR_write.o gdal-bindings.o init.o inverser.o local_stubs.o ogr_geom.o ogr_polygons.o ogr_proj.o ogrdrivers.o ogrsource.o projectit.o -L/usr/local/lib -lgdal -lproj -L/usr/lib64/R/lib -lR
installing to /home/andrea/R/x86_64-redhat-linux-gnu-library/rgdal/libs
** R
** data
** inst
** preparing package for lazy loading
** help
*** installing help indices
converting help for package ‘rgdal’
finding HTML links ... done
CRS-class html
GDALDataset-class html
GDALDriver-class html
GDALMajorObject-class html
GDALRasterBand-class html
GDALReadOnlyDataset-class html
GDALReadOnlyDataset-methods html
GDALTransientDataset-class html
GridsDatums html
RGB2PCT html
SGDF2PCT html
SpatialGDAL-class html
closeDataset-methods html
displayDataset html
llgrid html
Rd warning: /tmp/Rtmp52ge38/R.INSTALL4e4e42b08a4a/rgdal/man/llgrid.Rd:11: missing file link ‘Spatial’
Rd warning: /tmp/Rtmp52ge38/R.INSTALL4e4e42b08a4a/rgdal/man/llgrid.Rd:16: missing file link ‘gridat’
Rd warning: /tmp/Rtmp52ge38/R.INSTALL4e4e42b08a4a/rgdal/man/llgrid.Rd:17: missing file link ‘gridat’
make_EPSG html
nor2k html
projInfo html
project html
readGDAL html
Rd warning: /tmp/Rtmp52ge38/R.INSTALL4e4e42b08a4a/rgdal/man/readGDAL.Rd:136: missing file link ‘flipVertical’
readOGR html
showWKT html
spTransform-methods html
wrappers html
writeOGR html
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error: package or namespace load failed for ‘rgdal’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/home/andrea/R/x86_64-redhat-linux-gnu-library/rgdal/libs/rgdal.so':
libgdal.so.20: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/andrea/R/x86_64-redhat-linux-gnu-library/rgdal’
Warning in install.packages :
installation of package ‘rgdal’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpnAqQL2/downloaded_packages’
The issue is that, while GDAL is correctly built, rgdal cannot find its libraries. This is because the AWS ec2 AMI does not include /usr/local/lib in the default search path for libraries. The solution is provided in an answer to this question.
In brief:
edit /etc/ld.so.conf using sudo vi /etc/ld.so.conf to make it contain: include /etc/ld.so.conf.d/*.conf.
Edit / create a file /etc/ld.so.conf.d/libc.conf so that it contains: /usr/local/lib
Run sudo ldconfig to save changes
This makes the libraries searchable when building rgdal.
Upgrade gcc version to 5.x.x, and then run the followings (depending on the gcc version, you may have a different file of libstdc++.so.6.0.25):
cp /usr/local/lib64/libstdc++.so.6.0.25 /lib64
cd /lib64
rm -rf libstdc++.so.6
ln -s libstdc++.so.6.0.25 libstdc++.so.6

How to override python's distutils gcc linker with icc?

I was able to successfully build cython on Ubuntu 14.04 from source as explained in this SE question/answer Compiling cython From source with icc and I downloaded the source code from here - Cython source code download.
The command to compile cython is
CC=icc LINKCC=icc python3.4 setup.py build
I am enclosing the build log. It is STILL using gcc for linking. Here is a sample of build log.
It appears CC=icc LINKCC=icc does NOT seem to change the linker to icc. It is still using x86_64-linux-gnu-gcc. When I set the environmental variable LDFLAGS = -lirc the environmental variable is being passed to gcc and not to icc.
Also when I put print statements in BuildExecutable.py they are not getting called.
icc -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.4m -c /home/aswin/libPython/Cython-0.24/Cython/Plex/Scanners.c -o build/temp.linux-x86_64-3.4/home/aswin/libPython/Cython-0.24/Cython/Plex/Scanners.o
icc: command line warning #10006: ignoring unknown option '-fwrapv'
creating build/lib.linux-x86_64-3.4
creating build/lib.linux-x86_64-3.4/Cython
creating build/lib.linux-x86_64-3.4/Cython/Plex
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -lirc -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.4/home/aswin/libPython/Cython-0.24/Cython/Plex/Scanners.o -o build/lib.linux-x86_64-3.4/Cython/Plex/Scanners.cpython-34m.so
How do I fix it ?
You need to override the linker
by setting export LDSHARED="icc -shared". That generates the icc linker. Here is an example of the build log by typing
CC=icc python3.4 setup.py build_ext
Alternatively you can also do the same by typing
LDSHARED="icc -shared" CC=icc python3.4 setup.py build_ex
icc -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.4m -c /home/a/libPython/Cython-0.24/Cython/Plex/Scanners.c -o build/temp.linux-x86_64-3.4/home/a/libPython/Cython-0.24/Cython/Plex/Scanners.o
icc: command line warning #10006: ignoring unknown option '-fwrapv'
creating build/lib.linux-x86_64-3.4
creating build/lib.linux-x86_64-3.4/Cython
creating build/lib.linux-x86_64-3.4/Cython/Plex
icc -shared -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.4/home/a/libPython/Cython-0.24/Cython/Plex/Scanners.o -o build/lib.linux-x86_64-3.4/Cython/Plex/Scanners.cpython-34m.so
cythoning /home/a/libPython/Cython-0.24/Cython/Plex/Actions.py to /home/a/libPython/Cython-0.24/Cython/Plex/Actions.c
You could try to add -static-intel to link options so that all Intel specific functions will be static-linked.

Why would certain deprecated classes NOT generate a warning while compiling with g++?

I noticed today that one of my header files was still using an auto_ptr<> template.
I am using -std=c++11 to make sure to compile in C++11 and -pedantic and -Werror to detect deprecated usage. So I would imagine that I should have had an error while compiling that header since auto_ptr is marked as deprecated, what do you think?
There is part of the class with the offensive definition:
class server
{
[...snip...]
private:
std::auto_ptr<snap_listen_thread> f_listen_runner;
std::auto_ptr<snap_thread> f_listen_thread;
[...snip...]
};
The following lists all the command line options. I am using g++ version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) and as we can see I have -pedantic and -Werror in the list:
cd /home/snapwebsites/BUILD/snapwebsites/lib && /usr/bin/c++ -DCONTROLLED_VARS_DEBUG -DDEBUG -DQT_CORE_LIB -DQT_DEBUG -DQT_XMLPATTERNS_LIB -DQT_XML_LIB -D_DEBUG -Dsnapwebsites_EXPORTS -std=c++11 -Werror -Wall -Wextra -pedantic -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Winit-self -Wlogical-op -Wmissing-include-dirs -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=4 -Wundef -Wno-unused -Wunused-variable -Wno-variadic-macros -Wno-parentheses -Wno-unknown-pragmas -Wwrite-strings -Wswitch -fdiagnostics-show-option -fPIC -Wunused-parameter -Wfloat-equal -Wold-style-cast -Wnoexcept -g -g -O0 -fPIC -I/home/snapwebsites/snapwebsites -I/home/snapwebsites/snapwebsites/lib -I/home/snapwebsites/BUILD/snapwebsites -I/home/snapwebsites/BUILD/snapwebsites/lib -I/home/snapwebsites/BUILD/dist/include -I/home/snapwebsites/BUILD/dist/include/advgetopt -I/home/snapwebsites/BUILD/dist/include/QtSerialization -isystem /usr/include/qt4 -isystem /usr/include/qt4/QtXmlPatterns -isystem /usr/include/qt4/QtXml -isystem /usr/include/qt4/QtCore -isystem /usr/include/qt4/QtDesigner -isystem /usr/include/qt4/QtDeclarative -isystem /usr/include/qt4/QtScriptTools -isystem /usr/include/qt4/QtDBus -isystem /usr/include/qt4/QtSql -isystem /usr/include/qt4/QtOpenGL -isystem /usr/include/qt4/QtNetwork -isystem /usr/include/qt4/QtWebKit -isystem /usr/include/qt4/QtHelp -isystem /usr/include/qt4/QtUiTools -isystem /usr/include/qt4/QtTest -isystem /usr/include/qt4/QtScript -isystem /usr/include/qt4/QtSvg -isystem /usr/include/qt4/Qt3Support -isystem /usr/include/qt4/QtGui -isystem /usr/share/qt4/mkspecs/default -isystem /usr/include/proc -o CMakeFiles/snapwebsites.dir/snap_initialize_website.cpp.o -c /home/snapwebsites/snapwebsites/lib/snap_initialize_website.cpp
Could there be a bug in g++ that it would not yet detect such deprecated templates once in a while?
As mentioned in one of my comments, with the help of some other people, I found out that the -isystem command line option is the culprit.
g++ marks everything with a do not warn about this flag and this when referencing anything from those libraries and whatever they included has the flag set... Unfortunately many of the libraries (a bit Qt and especially log4cplus) do not compile without warnings.

Why won't this Android.mk build copy headers?

I have a simple Android.mk file for building libpng that I took from AOSP and modified slightly to build a shared lib instead of a static one.
LOCAL_PATH:= $(call my-dir)
LOCAL_CFLAGS :=
LOCAL_COPY_HEADERS_TO := libs/include
LOCAL_COPY_HEADERS := \
png.h \
pngconf.h \
pngusr.h
LOCAL_SRC_FILES := \
png.c \
pngerror.c \
pnggccrd.c \
pngget.c \
pngmem.c \
pngpread.c \
pngread.c \
pngrio.c \
pngrtran.c \
pngrutil.c \
pngset.c \
pngtrans.c \
pngvcrd.c \
pngwio.c \
pngwrite.c \
pngwtran.c \
pngwutil.c
LOCAL_LDLIBS := -lz
LOCAL_MODULE := png
LOCAL_MODULE_FILENAME := libpng
include $(BUILD_SHARED_LIBRARY)
The LOCAL_COPY_HEADERS_TO and LOCAL_COPY_HEADERS options seem like they should copy the specified headers to the libs/include directory... but they don't do anything. The library itself seems to build correctly. I'm using verbose output for ndk-build and there are no errors. Here's the command I use (I just added escapes so the command would be easier to read):
ndk-build \
NDK_PROJECT_PATH=. \
APP_BUILD_SCRIPT=Android.mk \
TARGET_ARCH_ABI=armeabi-v7a \
TARGET_PLATFORM=android-9 \
V=1 NDK_LOG=1 -B
And here's the build output. Note that at the end install is only called on the lib binaries.
HOST_OS=linux
HOST_ARCH=x86_64
HOST_TAG=linux-x86_64
GNUMAKE=/home/preet/Dev/env/sys/android-ndk-r8e/prebuilt/linux-x86_64/bin/make (NDK prebuilt)
Android NDK: NDK installation path auto-detected: '/home/preet/Dev/env/sys/android-ndk-r8e'
Android NDK: GNU Make version 3.81 detected
Android NDK: Host OS was auto-detected: linux
Android NDK: Host operating system detected: linux
Android NDK: Host CPU was auto-detected: x86
Android NDK: HOST_TAG set to linux-x86
Android NDK: Host tools prebuilt directory: /home/preet/Dev/env/sys/android-ndk-r8e/prebuilt/linux-x86_64/bin
Android NDK: Host 'echo' tool: echo
Android NDK: Host 'echo -n' tool: printf %s
Android NDK: Host 'cmp' tool: cmp
Android NDK: Host 'awk' tool: /home/preet/Dev/env/sys/android-ndk-r8e/prebuilt/linux-x86_64/bin/awk
Android NDK: Host 'awk' test returned: Pass
Android NDK: Found platform root directory: /home/preet/Dev/env/sys/android-ndk-r8e/platforms
Android NDK: Found supported platforms: android-14 android-3 android-4 android-5 android-8 android-9
Android NDK: PLATFORM android-14 supports: arm mips x86
Android NDK: ABI arm sysroot is: /home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-14/arch-arm
Android NDK: ABI mips sysroot is: /home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-14/arch-mips
Android NDK: ABI x86 sysroot is: /home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-14/arch-x86
Android NDK: PLATFORM android-3 supports: arm
Android NDK: ABI arm sysroot is: /home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-3/arch-arm
Android NDK: PLATFORM android-4 supports: arm
Android NDK: ABI arm sysroot is: /home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-4/arch-arm
Android NDK: PLATFORM android-5 supports: arm
Android NDK: ABI arm sysroot is: /home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-5/arch-arm
Android NDK: PLATFORM android-8 supports: arm
Android NDK: ABI arm sysroot is: /home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-8/arch-arm
Android NDK: PLATFORM android-9 supports: arm mips x86
Android NDK: ABI arm sysroot is: /home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm
Android NDK: ABI mips sysroot is: /home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-mips
Android NDK: ABI x86 sysroot is: /home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-x86
Android NDK: Found stable platform levels: 14 3 4 5 8 9
Android NDK: Found max platform level: 14
Android NDK: This NDK supports the following target architectures and ABIS:
Android NDK: arm: armeabi armeabi-v7a
Android NDK: mips: mips
Android NDK: x86: x86
Android NDK: This NDK supports the following toolchains and target ABIs:
Android NDK: arm-linux-androideabi-4.4.3: armeabi armeabi-v7a
Android NDK: arm-linux-androideabi-4.6: armeabi armeabi-v7a
Android NDK: arm-linux-androideabi-4.7: armeabi armeabi-v7a
Android NDK: arm-linux-androideabi-clang3.1: armeabi armeabi-v7a
Android NDK: arm-linux-androideabi-clang3.2: armeabi armeabi-v7a
Android NDK: mipsel-linux-android-4.4.3: mips
Android NDK: mipsel-linux-android-4.6: mips
Android NDK: mipsel-linux-android-4.7: mips
Android NDK: mipsel-linux-android-clang3.1: mips
Android NDK: mipsel-linux-android-clang3.2: mips
Android NDK: x86-4.4.3: x86
Android NDK: x86-4.6: x86
Android NDK: x86-4.7: x86
Android NDK: x86-clang3.1: x86
Android NDK: x86-clang3.2: x86
Android NDK: Found project path: .
Android NDK: Ouput path: ./obj
Android NDK: Parsing /home/preet/Dev/env/sys/android-ndk-r8e/build/core/default-application.mk
Android NDK: Defaulted to APP_PLATFORM=android-3
Android NDK: APP_PIE is
Android NDK: Using build script Android.mk
Android NDK: Application 'local' is not debuggable
Android NDK: Selecting release optimization mode (app is not debuggable)
Android NDK: Adding import directory: /home/preet/Dev/env/sys/android-ndk-r8e/sources
Android NDK: Building application 'local' for ABI 'armeabi-v7a'
Android NDK: Using target toolchain 'arm-linux-androideabi-4.6' for 'armeabi-v7a' ABI
Android NDK: Looking for imported module with tag 'cxx-stl/system'
Android NDK: Probing /home/preet/Dev/env/sys/android-ndk-r8e/sources/cxx-stl/system/Android.mk
Android NDK: Found in /home/preet/Dev/env/sys/android-ndk-r8e/sources/cxx-stl/system
rm -f ./libs/armeabi/lib*.so ./libs/armeabi-v7a/lib*.so ./libs/mips/lib*.so ./libs/x86/lib*.so
rm -f ./libs/armeabi/gdbserver ./libs/armeabi-v7a/gdbserver ./libs/mips/gdbserver ./libs/x86/gdbserver
rm -f ./libs/armeabi/gdb.setup ./libs/armeabi-v7a/gdb.setup ./libs/mips/gdb.setup ./libs/x86/gdb.setup
Compile thumb : png <= png.c
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi-v7a/objs/png/png.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I. -DANDROID -Wa,--noexecstack -I/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm/usr/include -c ./png.c -o ./obj/local/armeabi-v7a/objs/png/png.o
Compile thumb : png <= pngerror.c
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi-v7a/objs/png/pngerror.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I. -DANDROID -Wa,--noexecstack -I/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm/usr/include -c ./pngerror.c -o ./obj/local/armeabi-v7a/objs/png/pngerror.o
Compile thumb : png <= pnggccrd.c
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi-v7a/objs/png/pnggccrd.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I. -DANDROID -Wa,--noexecstack -I/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm/usr/include -c ./pnggccrd.c -o ./obj/local/armeabi-v7a/objs/png/pnggccrd.o
Compile thumb : png <= pngget.c
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi-v7a/objs/png/pngget.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I. -DANDROID -Wa,--noexecstack -I/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm/usr/include -c ./pngget.c -o ./obj/local/armeabi-v7a/objs/png/pngget.o
Compile thumb : png <= pngmem.c
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi-v7a/objs/png/pngmem.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I. -DANDROID -Wa,--noexecstack -I/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm/usr/include -c ./pngmem.c -o ./obj/local/armeabi-v7a/objs/png/pngmem.o
Compile thumb : png <= pngpread.c
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi-v7a/objs/png/pngpread.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I. -DANDROID -Wa,--noexecstack -I/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm/usr/include -c ./pngpread.c -o ./obj/local/armeabi-v7a/objs/png/pngpread.o
Compile thumb : png <= pngread.c
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi-v7a/objs/png/pngread.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I. -DANDROID -Wa,--noexecstack -I/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm/usr/include -c ./pngread.c -o ./obj/local/armeabi-v7a/objs/png/pngread.o
Compile thumb : png <= pngrio.c
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi-v7a/objs/png/pngrio.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I. -DANDROID -Wa,--noexecstack -I/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm/usr/include -c ./pngrio.c -o ./obj/local/armeabi-v7a/objs/png/pngrio.o
Compile thumb : png <= pngrtran.c
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi-v7a/objs/png/pngrtran.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I. -DANDROID -Wa,--noexecstack -I/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm/usr/include -c ./pngrtran.c -o ./obj/local/armeabi-v7a/objs/png/pngrtran.o
Compile thumb : png <= pngrutil.c
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi-v7a/objs/png/pngrutil.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I. -DANDROID -Wa,--noexecstack -I/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm/usr/include -c ./pngrutil.c -o ./obj/local/armeabi-v7a/objs/png/pngrutil.o
Compile thumb : png <= pngset.c
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi-v7a/objs/png/pngset.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I. -DANDROID -Wa,--noexecstack -I/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm/usr/include -c ./pngset.c -o ./obj/local/armeabi-v7a/objs/png/pngset.o
Compile thumb : png <= pngtrans.c
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi-v7a/objs/png/pngtrans.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I. -DANDROID -Wa,--noexecstack -I/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm/usr/include -c ./pngtrans.c -o ./obj/local/armeabi-v7a/objs/png/pngtrans.o
Compile thumb : png <= pngvcrd.c
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi-v7a/objs/png/pngvcrd.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I. -DANDROID -Wa,--noexecstack -I/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm/usr/include -c ./pngvcrd.c -o ./obj/local/armeabi-v7a/objs/png/pngvcrd.o
Compile thumb : png <= pngwio.c
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi-v7a/objs/png/pngwio.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I. -DANDROID -Wa,--noexecstack -I/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm/usr/include -c ./pngwio.c -o ./obj/local/armeabi-v7a/objs/png/pngwio.o
Compile thumb : png <= pngwrite.c
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi-v7a/objs/png/pngwrite.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I. -DANDROID -Wa,--noexecstack -I/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm/usr/include -c ./pngwrite.c -o ./obj/local/armeabi-v7a/objs/png/pngwrite.o
Compile thumb : png <= pngwtran.c
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi-v7a/objs/png/pngwtran.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I. -DANDROID -Wa,--noexecstack -I/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm/usr/include -c ./pngwtran.c -o ./obj/local/armeabi-v7a/objs/png/pngwtran.o
Compile thumb : png <= pngwutil.c
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi-v7a/objs/png/pngwutil.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I. -DANDROID -Wa,--noexecstack -I/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm/usr/include -c ./pngwutil.c -o ./obj/local/armeabi-v7a/objs/png/pngwutil.o
SharedLibrary : libpng.so
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -Wl,-soname,libpng.so -shared --sysroot=/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm ./obj/local/armeabi-v7a/objs/png/png.o ./obj/local/armeabi-v7a/objs/png/pngerror.o ./obj/local/armeabi-v7a/objs/png/pnggccrd.o ./obj/local/armeabi-v7a/objs/png/pngget.o ./obj/local/armeabi-v7a/objs/png/pngmem.o ./obj/local/armeabi-v7a/objs/png/pngpread.o ./obj/local/armeabi-v7a/objs/png/pngread.o ./obj/local/armeabi-v7a/objs/png/pngrio.o ./obj/local/armeabi-v7a/objs/png/pngrtran.o ./obj/local/armeabi-v7a/objs/png/pngrutil.o ./obj/local/armeabi-v7a/objs/png/pngset.o ./obj/local/armeabi-v7a/objs/png/pngtrans.o ./obj/local/armeabi-v7a/objs/png/pngvcrd.o ./obj/local/armeabi-v7a/objs/png/pngwio.o ./obj/local/armeabi-v7a/objs/png/pngwrite.o ./obj/local/armeabi-v7a/objs/png/pngwtran.o ./obj/local/armeabi-v7a/objs/png/pngwutil.o -lgcc -no-canonical-prefixes -march=armv7-a -Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -L/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm/usr/lib -lz -lc -lm -o ./obj/local/armeabi-v7a/libpng.so
Install : libpng.so => libs/armeabi-v7a/libpng.so
install -p ./obj/local/armeabi-v7a/libpng.so ./libs/armeabi-v7a/libpng.so
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-strip --strip-unneeded ./libs/armeabi-v7a/libpng.so
You messed up your order. You should have:
LOCAL_COPY_HEADERS := \
png.h \
pngconf.h \
pngusr.h
followed by:
LOCAL_COPY_HEADERS_TO := libs/include
(You must dictate your headers, then tell the system where to copy them to.) It could also have been deprecated on your current sdk too.

Resources