Bug #831
openBuilding from source under Linux results in huge package because of included debug information
0%
Description
This seems to affect builds under the OpenJDKs from the official repositories of some Linux distributions, at least Debian (https://files.ecsec.de/index.php/s/2jDmibFgacwMtQc, see #829#note-8) and openSUSE (my own tests). The modules under $JAVA_HOME/jmods include shared libraries that contain debug information, which is not stripped when following the build instructions https://github.com/ecsec/open-ecard#build-instructions. The biggest contribution to the bloat comes from the module java.base.jmod. The resulting file packager/richclient-packager/target/open-ecard/lib/server/libjvm.so is with about 400 MB twenty time bigger than libjvm.so from https://jdk.java.net/ or https://adoptopenjdk.net/. There is a simple fix that can be applied after the package has been built. Executing
$ cd packager/richclient-packager/target/open-ecard $ strip lib/*.so lib/server/*.so
results in a size comparable to the package built under Oracle's or AdoptOpenJDK's JDK, or the RPM package from https://www.openecard.org/download/pc/, which also happens to be built under openSUSE's JDK:
$ /opt/open-ecard-app/lib/runtime/bin/java -version openjdk version "16.0.1" 2021-04-20 OpenJDK Runtime Environment (build 16.0.1+9-suse-1.2-x8664) OpenJDK 64-Bit Server VM (build 16.0.1+9-suse-1.2-x8664, mixed mode)
I would assume that the build process can be configured to automatically remove debug information. If this is the case, then the build instructions in README.md should provide the necessary information.