Nowadays file-size is not a issue usually. But there are situations when size of library matters e.g. on devices with limited resources (e.g. phones).
Somebody could try to play with compiler optimisation options, but you should be expect additional problem (e.g. unexpended crash or decrease OCR accuracy in case of tesseract)
Another approach could be to skip not needed functionality or symbols. Here are ‘./configure’ options provided directly in tesseract-ocr. All test was done on linux (openSUSE 13.2 64bit).
This option disable ScrollView support. ScrollView is used to display tesseract internal state, so that you can view its segmentation and recognition. It is usefull only for advance tesseract desktop user, so it make sense to disable it if you are compiling tesseract library for usage in external application. Some issues with this option were fixed after 3.04.00 release, so make sure that you use the latest code or apply patch that will fix it.
This feature hides most of the ELF symbols which would have previously (and unnecessarily) been public. Detailed description is in gcc wiki (it is applied by default in Visual Studio build).
This option disable cube engine in tesseract. Cube engine is available only for few languages and it not documented for training. This option was implemented after 3.04.00 release, so you can use it only when you use current code from tesseract-ocr repository.
strip is not ‘./configure’ option, but a linux program that discards symbols from object files. You can use like this:
I tried to compare also size of library if the compiler makes difference. I did not find it interesting: size of gcc compiled library was 3765643 while clang compiled library was 3750108.
|configure option||size without stip||size after stip|