Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Built library is twice as large as the distributed one

When I use cmake to build libopencv_java3.so in release mode with default configuration I got a library of 17MB

I can reduce that to 10MB by adding some flags and disabling some modules.

cmake   -DBUILD_opencv_videostab=OFF \
        -DBUILD_ANDROID_EXAMPLES=OFF \
        -DBUILD_opencv_stitching=OFF \
        -DBUILD_opencv_tracking=OFF \
        -DBUILD_opencv_datasets=OFF \
        -DBUILD_opencv_nonfree=OFF \
        -DBUILD_opencv_contrib=OFF \
        -DBUILD_opencv_legacy=OFF \
        -DBUILD_opencv_world=OFF \
        -DBUILD_opencv_photo=OFF \
        -DBUILD_opencv_apps=OFF \
        -DBUILD_opencv_ts=OFF \
        -DBUILD_EXAMPLES=OFF \
        -DBUILD_SAMPLES=OFF \
        -DWITH_CUDA=OFF \
        ...
        -DCMAKE_C_FLAGS_RELEASE="-Os -DNDEBUG -fvisibility=hidden -ffunction-sections -fstack-protector-all" \
        -DCMAKE_CXX_FLAGS_RELEASE="-Os -DNDEBUG -fvisibility=hidden -ffunction-sections -fstack-protector-all -        fvisibility-inlines-hidden" \
        -DBUILD_WITH_DEBUG_INFO=OFF \
        ...

But the distributed library available in opencv-3.2.0-android-sdk.zip is 8.6MB large !

How can I get a library of that size ?