Built library is twice as large as the distributed one

asked 2017-02-10 04:44:38 -0500

riless gravatar image

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 ?

edit retag flag offensive close merge delete