Size of executable when static

asked 2017-09-26 08:22:39 -0500

carton99 gravatar image

updated 2017-09-26 08:47:52 -0500

Hi,

I use openCV without extra modules in static mode install. I compile my own application with cmake and -03 option.

My program work but the size of my executable is very hight > 60Mo.

I analysed process of compilation and do step by step compilation program and I see than when I add a filter such as "Blur" and "medianBlur" my programme take 40Mo of size.

What is the way to reduce size of program ?

EDIT: See my option compilation:

OpenCV modules:
--     To be built:                 core flann imgproc ml objdetect photo video imgcodecs shape videoio highgui superres ts features2d calib3d stitching videostab
--     Disabled:                    java world
--     Disabled by dependency:      -
--     Unavailable:                 cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev python2 python3 viz
edit retag flag offensive close merge delete

Comments

i',m gettin more like 6.6 mb on ubuntu

berak gravatar imageberak ( 2017-09-26 08:55:46 -0500 )edit

On Windows I got ~7,5MB for a typical, small terminal application with static build until OpenCV 3.2. Since OpenCV 3.3 it is about twice the size ~19MB. I was wondering what causes this increase.

@carton99: Is this a release build? Did you play around with optimization fllags?

matman gravatar imagematman ( 2017-09-26 12:17:15 -0500 )edit

Yes I try with -DCMAKE_BUILD_TYPE=Release option and -Os and -03 optimization option

carton99 gravatar imagecarton99 ( 2017-09-26 12:31:22 -0500 )edit