Project

General

Profile

Actions

Bug #831

open

Building from source under Linux results in huge package because of included debug information

Added by Theo Wollenleben almost 3 years ago. Updated almost 3 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
07/12/2021
Due date:
% Done:

0%

Estimated time:
Reviewer:
Build Version:

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.

Actions #1

Updated by Theo Wollenleben almost 3 years ago

On a related note, is there a way to build the package without including the runtime environment altogether for users who have a compatible JRE installed and want to save disk space?

Actions

Also available in: Atom PDF