Can I use x264 with Opencv in Python on Linux - python-3.x

I am using python 3.6 and opencv 3.4.1 to capture video from a Logitech C920 webcam. I am used to Windows, where I would write my own DirectShow filters to get access to frames and control the camera. I am finding myself out of my depth on Linux.
I know it can run 24fps at least by using GTK UVC video viewer, but I'm only getting 5fps. I suspect that this is due to the format - to get higher rates I need something like x264. It may be that this is impossible for opencv because it means that it can no longer grab a single frame.
I have tried setting the video codec, but I am told that
cap.set(cv2.CAP_PROP_FORMAT, cv2.VideoWriter_fourcc(...
VIDEOIO ERROR: V4L2: setting property #8 is not supported
Other people have asked similar questions, but I haven't been able to see a convincing answer:
(no answer)
Capturing H264 stream with OpenCV
(blames drivers)
http://answers.opencv.org/question/30185/frame-capture-is-needlessly-slow/
(sets camera format in c++)
OpenCV VideoCapture with H264 CODEC
(also done in c++ and OpenCV 2.4)
Capturing 1080p at 30fps from logitech c920 with openCV 2.4.3
I found a link claiming that x264 etc doesn't support frame grabbing, therefore it can't be done, but now I can't find it - this would seem to be contradicted by the answers in c++ and the fact that we can work with x264 file formats.
Any clarity would be appreciated.
EDIT:
As requested, here are the outputs of cv2.getBuildInformation():
General configuration for OpenCV 3.4.1 =====================================
Version control: 3.4.1
Platform:
Timestamp: 2018-05-19T13:51:11Z
Host: Linux 4.4.0-101-generic x86_64
CMake: 3.9.0
CMake generator: Unix Makefiles
CMake build tool: /usr/bin/gmake
Configuration: Release
CPU/HW features:
Baseline: SSE SSE2 SSE3
requested: SSE3
Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX AVX2
requested: SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
SSE4_1 (3 files): + SSSE3 SSE4_1
SSE4_2 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2
FP16 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
AVX (5 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
AVX2 (9 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
C/C++:
Built as dynamic libs?: NO
C++ Compiler: /opt/rh/devtoolset-2/root/usr/bin/c++ (ver 4.8.2)
C++ flags (Release): -Wl,-strip-all -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
C++ flags (Debug): -Wl,-strip-all -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
C Compiler: /opt/rh/devtoolset-2/root/usr/bin/cc
C flags (Release): -Wl,-strip-all -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
C flags (Debug): -Wl,-strip-all -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
Linker flags (Release): -L/root/ffmpeg_build/lib
Linker flags (Debug): -L/root/ffmpeg_build/lib
ccache: NO
Precompiled headers: NO
Extra dependencies: /opt/Qt4.8.7/lib/libQtGui.so /opt/Qt4.8.7/lib/libQtTest.so /opt/Qt4.8.7/lib/libQtCore.so /lib64/libz.so /opt/libjpeg-turbo/lib64/libjpeg.a avcodec avformat avutil swscale dl m pthread rt
3rdparty dependencies: ittnotify libprotobuf libwebp libpng libtiff libjasper IlmImf
OpenCV modules:
To be built: calib3d core dnn features2d flann highgui imgcodecs imgproc java_bindings_generator ml objdetect photo python3 python_bindings_generator shape stitching superres video videoio videostab
Disabled: js world
Disabled by dependency: -
Unavailable: cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java python2ts viz
Applications: -
Documentation: NO
Non-free algorithms: NO
GUI:
QT: YES (ver 4.8.7 EDITION = OpenSource)
QT OpenGL support: NO
GTK+: NO
VTK support: NO
Media I/O:
ZLib: /lib64/libz.so (ver 1.2.3)
JPEG: /opt/libjpeg-turbo/lib64/libjpeg.a (ver )
WEBP: build (ver encoder: 0x020e)
PNG: build (ver 1.6.34)
TIFF: build (ver 42 - 4.0.9)
JPEG 2000: build (ver 1.900.1)
OpenEXR: build (ver 1.7.1)
Video I/O:
DC1394: NO
FFMPEG: YES
avcodec: YES (ver 58.19.100)
avformat: YES (ver 58.13.100)
avutil: YES (ver 56.18.100)
swscale: YES (ver 5.2.100)
avresample: NO
GStreamer: NO
libv4l/libv4l2: NO
v4l/v4l2: linux/videodev.h linux/videodev2.h
gPhoto2: NO
Parallel framework: pthreads
Trace: YES (with Intel ITT)
Other third-party libraries:
Lapack: NO
Eigen: NO
Custom HAL: NO
Protobuf: build (3.5.1)
NVIDIA CUDA: NO
OpenCL: YES (no extra features)
Include path: /io/opencv/3rdparty/include/opencl/1.2
Link libraries: Dynamic load
Python 3:
Interpreter: /opt/python/cp36-cp36m/bin/python (ver 3.6.5)
Libraries: libpython3.6m.a (ver 3.6.5)
numpy: /opt/python/cp36-cp36m/lib/python3.6/site-packages/numpy/core/include (ver 1.11.3)
packages path: lib/python3.6/site-packages
Python (for build): /opt/python/cp36-cp36m/bin/python
Java:
ant: NO
JNI: NO
Java wrappers: NO
Java tests: NO
Matlab: NO
Install to: /io/_skbuild/cmake-install
-----------------------------------------------------------------

So as zindarod correctly pointed out, the solution is to:
run cv2.getBuildInformation()
Check if libv4l/libv4l2 has NO/NO as the value (if it doesn't you have some other problem)
Compile OpenCV from source.
Compiling OpenCV is tricky, but manageable, even for someone like me who was raised on Windows.
https://docs.opencv.org/3.2.0/d7/d9f/tutorial_linux_install.html
https://docs.opencv.org/3.0-beta/doc/tutorials/introduction/linux_eclipse/linux_eclipse.html
Although those are a little out of date. In eclipse you'll need references to
opencv_videoio
opencv_core
opencv_highgui
opencv_videoio
#include "opencv2/opencv.hpp"
#include "opencv2/videoio.hpp"
using namespace cv;
int main(int, char**)
{
VideoCapture cap(0); // open the default camera
if(!cap.isOpened()) // check if we succeeded
return -1;
cap.set(CV_CAP_PROP_FRAME_WIDTH,1920);
cap.set(CV_CAP_PROP_FRAME_HEIGHT,1080);
Mat edges;
namedWindow("camera",1);
for(;;)
{
Mat frame;
cap >> frame; // get a new frame from camera
imshow("camera", frame);
if(waitKey(30) >= 0) break;
}
return 0;
}

Related

How to build OpenCV from source with python binding?

I need to build OpenCV from source and I have limited space, so, I have to build OpenCV on a module basis (https://docs.opencv.org/4.x/db/d05/tutorial_config_reference.html - Build limited set of modules). OK, cmake and make work fine.
Would be easier to use these OpenCV modules from python so I add cmake -D BUILD_opencv_python3=ON but make install does not create the prefix/lib/pythonX.Y/site-packages directory I expected. There is no python related option but only a CMake option as far as I understand the doc.
How to get python(3) binding for OpenCV when building it on a module basis ?
Once installed, how to set up environnement to get python -c "import cv2" to work with my custom-built OpenCV ?
UPDATE
Running ubuntu L4T on jetson. CMake outputs :
-- Python 3:
-- Interpreter: /usr/bin/python3 (ver 3.6.9)
-- Libraries: NO
-- numpy: /home/me/.local/lib/python3.6/site-packages/numpy/core/include (ver 1.19.5)
-- install path: -
So I guess empty install path hides a problem behind... But grep -ni OPENCV_PYTHON3_INSTALL_PATH CMakeCache.txt returns nothing.
At this point, I tried to add cmake -DOPENCV_PYTHON3_INSTALL_PATH=~/Programs/opencv/local/lib/python3.6/site-packages/, still nothing in cmake output (blank install path) but
grep -ni OPENCV_PYTHON3_INSTALL_PATH CMakeCache.txt
1076:OPENCV_PYTHON3_INSTALL_PATH:UNINITIALIZED=~/Programs/opencv/local/lib/python3.6/site-packages/
And after make install (without sudo - I don't have root privilege and need local install), I have no python binding in the local install.
... Any clue would be appreciated !
Note: compiling opencv-4.5.4 on L4T ubuntu
I wanted to add to CYL answer, I use that GitHub Gist and it works, but I have to drop all my junk cmake flags.
Here is what I ultimately end up with.
cmake \
-D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=$(python3 -c "import sys; print(sys.prefix)") \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D INSTALL_C_EXAMPLES=ON \
-D WITH_TBB=ON \
-D WITH_CUDA=OFF \
-D BUILD_opencv_cudacodec=OFF \
-D ENABLE_FAST_MATH=1 \
-D CUDA_FAST_MATH=1 \
-D WITH_CUBLAS=1 \
-D WITH_V4L=ON \
-D WITH_QT=OFF \
-D WITH_OPENGL=ON \
-D WITH_GSTREAMER=ON \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D OPENCV_PC_FILE_NAME=opencv.pc \
-D OPENCV_ENABLE_NONFREE=ON \
-D OPENCV_PYTHON3_INSTALL_PATH=$(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") \
-D OPENCV_EXTRA_MODULES_PATH=/tmp/opencv_contrib/modules \
-D PYTHON_EXECUTABLE=$(which python3) \
-D BUILD_EXAMPLES=ON ..
and this is the General Config output
-- General configuration for OpenCV 4.5.5 =====================================
-- Version control: 4.5.5
--
-- Extra modules:
-- Location (extra): /tmp/opencv_contrib/modules
-- Version control (extra): 4.5.5
--
-- Platform:
-- Timestamp: 2022-01-23T08:47:55Z
-- Host: Linux 5.11.0-41-generic x86_64
-- CMake: 3.18.2
-- CMake generator: Unix Makefiles
-- CMake build tool: /usr/bin/make
-- Configuration: RELEASE
--
-- CPU/HW features:
-- Baseline: SSE SSE2 SSE3
-- requested: SSE3
-- Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
-- requested: SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
-- SSE4_1 (18 files): + SSSE3 SSE4_1
-- SSE4_2 (2 files): + SSSE3 SSE4_1 POPCNT SSE4_2
-- FP16 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
-- AVX (5 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
-- AVX2 (33 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
-- AVX512_SKX (8 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX
--
-- C/C++:
-- Built as dynamic libs?: YES
-- C++ standard: 11
-- C++ Compiler: /usr/bin/c++ (ver 9.3.0)
-- C++ flags (Release): -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
-- C++ flags (Debug): -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
-- C Compiler: /usr/bin/cc
-- C flags (Release): -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
-- C flags (Debug): -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
-- Linker flags (Release): -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a -Wl,--gc-sections -Wl,--as-needed
-- Linker flags (Debug): -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a -Wl,--gc-sections -Wl,--as-needed
-- ccache: NO
-- Precompiled headers: NO
-- Extra dependencies: dl m pthread rt
-- 3rdparty dependencies:
--
-- OpenCV modules:
-- To be built: aruco barcode bgsegm bioinspired calib3d ccalib core datasets dnn dnn_objdetect dnn_superres dpm face features2d flann fuzzy gapi hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor mcc ml objdetect optflow phase_unwrapping photo plot python3 quality rapid reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab wechat_qrcode xfeatures2d ximgproc xobjdetect xphoto
-- Disabled: world
-- Disabled by dependency: -
-- Unavailable: alphamat cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv freetype hdf java julia matlab ovis python2 sfm viz
-- Applications: tests perf_tests examples apps
-- Documentation: NO
-- Non-free algorithms: YES
--
-- GUI: NONE
-- GTK+: NO
-- OpenGL support: NO
-- VTK support: NO
--
-- Media I/O:
-- ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.11)
-- JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (ver 80)
-- WEBP: build (ver encoder: 0x020f)
-- PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.6.37)
-- TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 / 4.1.0)
-- JPEG 2000: build (ver 2.4.0)
-- OpenEXR: build (ver 2.3.0)
-- HDR: YES
-- SUNRASTER: YES
-- PXM: YES
-- PFM: YES
--
-- Video I/O:
-- DC1394: NO
-- FFMPEG: YES
-- avcodec: YES (58.54.100)
-- avformat: YES (58.29.100)
-- avutil: YES (56.31.100)
-- swscale: YES (5.5.100)
-- avresample: YES (4.0.0)
-- GStreamer: YES (1.16.2)
-- v4l/v4l2: YES (linux/videodev2.h)
--
-- Parallel framework: TBB (ver 2020.1 interface 11101)
--
-- Trace: YES (with Intel ITT)
--
-- Other third-party libraries:
-- Intel IPP: 2020.0.0 Gold [2020.0.0]
-- at: /tmp/opencv/build/3rdparty/ippicv/ippicv_lnx/icv
-- Intel IPP IW: sources (2020.0.0)
-- at: /tmp/opencv/build/3rdparty/ippicv/ippicv_lnx/iw
-- VA: NO
-- Lapack: NO
-- Eigen: NO
-- Custom HAL: NO
-- Protobuf: build (3.19.1)
--
-- OpenCL: YES (no extra features)
-- Include path: /tmp/opencv/3rdparty/include/opencl/1.2
-- Link libraries: Dynamic load
--
-- Python 3:
-- Interpreter: /home/user/miniconda3/bin/python3 (ver 3.9.5)
-- Libraries: /home/user/miniconda3/lib/libpython3.9.so (ver 3.9.5)
-- numpy: /home/user/miniconda3/lib/python3.9/site-packages/numpy/core/include (ver 1.21.2)
-- install path: /home/user/miniconda3/lib/python3.9/site-packages/cv2/python-3.9
--
-- Python (for build): /home/user/miniconda3/bin/python3
--
-- Java:
-- ant: NO
-- JNI: NO
-- Java wrappers: NO
-- Java tests: NO
--
-- Install to: /home/user/miniconda3
-- -----------------------------------------------------------------
--
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/opencv/build
Just for documentation, this is what I install on the ubuntu 20.04.
apt-get update && apt-get install git openssh-client curl wget sudo \
build-essential pkg-config libboost-system-dev libboost-thread-dev libboost-program-options-dev libboost-test-dev \
libgl1-mesa-glx libglib2.0-0 \
libjpeg-dev libpng-dev libtiff-dev \
libavcodec-dev libavformat-dev libswscale-dev libavresample-dev \
libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
libxvidcore-dev x264 libx264-dev libfaac-dev libmp3lame-dev libtheora-dev \
libfaac-dev libmp3lame-dev libvorbis-dev \
libtbb-dev libatlas-base-dev gfortran -y
To have py binding, make sure the cmake config output near the end has the Python 3 section i.e.
Python 3:
Interpreter: /home/user/anaconda3/envs/cv451/bin/python3 (ver 3.8.12)
Libraries: /home/user/anaconda3/envs/cv451/lib/libpython3.8.so (ver 3.8.12)
numpy: /home/user/anaconda3/envs/cv451/lib/python3.8/site-packages/numpy/core/include (ver 1.21.2)
install path: /home/user/anaconda3/envs/cv451/lib/python3.8/site-packages/cv2/python-3.8
For me that section was missing at first. My problem was python version mismatch between the lib (found from system) and the interpreter (from conda env).
Thus in my case the fix was:
Have cmake find the conda env's python instead of the system's python:
CMAKE_LIBRARY_PATH=/home/user/anaconda3/envs/cv451/lib cmake /path/to/opencv/arc
By default the binding is installed to system's python. To specify the python binding install path, use the cmake flag OPENCV_PYTHON3_INSTALL_PATH i.e.
-D OPENCV_PYTHON3_INSTALL_PATH=/home/user/anaconda3/envs/cv451/lib/python3.8/site-packages/
Remember to install after the compile
sudo make install
Ref:
https://gist.github.com/raulqf/f42c718a658cddc16f9df07ecc627be7
https://qengineering.eu/install-opencv-4.5-on-jetson-nano.html
cmake -DBUILD_LIST=python3 .. solved the problem: getting clean install directory including python site-packages directory.

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.

Accessing neon intrinsics with Beagleboard GCC

I'm using arm-linux-gnueabihf as my cross compiler under a VmBox Debian 8.1 on Windows 7 to compile for my Beagleboard. I've found much info on NEON/SIMD intrinsics but my compiler doesn't recognize the NEON intrinsics (i.e. uint8x8t). I've seen refernces to arm_neon.h and neon.h but those are not in my tools. Is there a library I need to install?
My compiler command is arm-linux-gnueabihf-g++
with options -O3 -pg -march=arm7-a -mtune=cortex-a8 -mfloat-abi=hard -mfpu=neon -ffast-math -g3 -Wall -c -fmessage-length=0

GraphicsMagick "gm identify" takes a long time for PDF

I am trying to convert a PDF to a JPG preview, but certain PDF files are taking a really long time to process on our RH Linux server (+- 35 seconds). The same file & command on my Windows 8 development machine takes only 3 seconds. I am using GraphicsMagick 1.3.18 & GhostScript 8.70-19. I get the same results using ImageMagick. Unfortunately I can't share the PDF file in question, but here are its properties (it is only 399KB compressed & 1.1MB uncompressed):
I tested using a compressed & uncompressed version, and the results are similar. I found that both the gm convert file.pdf output.jpg and gm identify file.pdf commands take a long time.
This is the output of gm identify -version on the Linux server:
GraphicsMagick 1.3.18 2013-03-10 Q8 http://www.GraphicsMagick.org/
Copyright (C) 2002-2013 GraphicsMagick Group.
Additional copyrights and licenses apply to this software.
See http://www.GraphicsMagick.org/www/Copyright.html for details.
Feature Support:
Thread Safe yes
Large Files (> 32 bit) yes
Large Memory (> 32 bit) yes
BZIP yes
DPS no
FlashPix no
FreeType yes
Ghostscript (Library) no
JBIG no
JPEG-2000 yes
JPEG yes
Little CMS yes
Loadable Modules yes
OpenMP yes (200805)
PNG yes
TIFF yes
TRIO no
UMEM no
WMF yes
X11 yes
XML yes
ZLIB yes
Host type: x86_64-redhat-linux-gnu
Configured using the command:
./configure '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--target=x86_64-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--enable-shared' '--disable-static' '--with-lcms' '--with-magick_plus_plus' '--with-modules' '--with-perl' '--with-perl-options=INSTALLDIRS=vendor ' '--with-threads' '--with-wmf' '--with-x' '--with-xml' '--without-dps' '--without-gslib' '--with-gs-font-dir=/usr/share/fonts/default/Type1' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'target_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' 'CXXFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=
Final Build Parameters:
CC = gcc -std=gnu99
CFLAGS = -fopenmp -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Wall -pthread
CPPFLAGS = -I/usr/include/freetype2 -I/usr/include/libxml2
CXX = g++
CXXFLAGS = -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -pthread
LDFLAGS = -L/usr/lib -L/usr/lib
LIBS = -llcms -lfreetype -lXext -lSM -lICE -lX11 -lbz2 -lz -lltdl -lm -lgomp -lpthread
I only have this problem for some PDF files, most are processed using the same command quite quickly.
Any ideas regarding what might make this take so long?

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