Package: openjdk-11
Version: 11.0.1+13-3

I'm not sure whether this should be considered a bug -- it might well be
exactly what's intended, but I thought I'd bring it up because it does
cause Debian to produce much larger (~10x) jlink images (and presumably
images, containers, etc.) than expected.

As an example, this "motivation" suggests the tool should produce an
~37MB image, but on Debian it currently produces one that's 400+MB:
https://github.com/sunng87/lein-jlink#motivation

It looks like this is because the Debian libjvm.so that jlink copies
into the tree has a very large contingent of debugging symbols.  Of
course, as long as it's possible to intervene at the right point in the
process, you could always just strip the shared libraries manually.  So
I'd expect that in most cases there's a workaround, but depending on the
tool, it might be variously awkward.

If it helps, here's a trivial way to demonstrate the issue:

  rm -rf standalone
  jlink --add-modules java.base \
    --output standalone \
    --strip-debug \
    --no-man-pages \
    --no-header-files \
    --compress=2
  du -sh standalone
  find standalone -name "*.so" -exec ls -lh {} \;
  find standalone -name "*.so" -exec strip --strip-unneeded {} \;
  find standalone -name "*.so" -exec ls -lh {} \;
  du -sh standalone

which here produces:

  $ rm -rf standalone
  $ jlink --add-modules java.base \
    --output standalone \
    --strip-debug \
    --no-man-pages \
    --no-header-files \
    --compress=2
  $ du -sh standalone
  435M    standalone
  $ find standalone -name "*.so" -exec ls -lh {} \;
  -rw-r----- 1 rlb rlb 343K Jan 26 11:28 standalone/lib/jli/libjli.so
  -rw-r----- 1 rlb rlb 1.4M Jan 26 11:28 standalone/lib/libjava.so
  -rw-r----- 1 rlb rlb 263K Jan 26 11:28 standalone/lib/libverify.so
  -rw-r----- 1 rlb rlb 611K Jan 26 11:28 standalone/lib/libnio.so
  -rw-r----- 1 rlb rlb 421M Jan 26 11:28 standalone/lib/server/libjvm.so
  -rw-r----- 1 rlb rlb 25K Jan 26 11:28 standalone/lib/server/libjsig.so
  -rw-r----- 1 rlb rlb 215K Jan 26 11:28 standalone/lib/libjimage.so
  -rw-r----- 1 rlb rlb 737K Jan 26 11:28 standalone/lib/libnet.so
  -rw-r----- 1 rlb rlb 25K Jan 26 11:28 standalone/lib/libjsig.so
  -rw-r----- 1 rlb rlb 199K Jan 26 11:28 standalone/lib/libzip.so
  $ find standalone -name "*.so" -exec strip --strip-unneeded {} \;
  $ find standalone -name "*.so" -exec ls -lh {} \;
  -rw-r----- 1 rlb rlb 67K Jan 26 11:28 standalone/lib/jli/libjli.so
  -rw-r----- 1 rlb rlb 180K Jan 26 11:28 standalone/lib/libjava.so
  -rw-r----- 1 rlb rlb 63K Jan 26 11:28 standalone/lib/libverify.so
  -rw-r----- 1 rlb rlb 71K Jan 26 11:28 standalone/lib/libnio.so
  -rw-r----- 1 rlb rlb 18M Jan 26 11:28 standalone/lib/server/libjvm.so
  -rw-r----- 1 rlb rlb 15K Jan 26 11:28 standalone/lib/server/libjsig.so
  -rw-r----- 1 rlb rlb 31K Jan 26 11:28 standalone/lib/libjimage.so
  -rw-r----- 1 rlb rlb 95K Jan 26 11:28 standalone/lib/libnet.so
  -rw-r----- 1 rlb rlb 15K Jan 26 11:28 standalone/lib/libjsig.so
  -rw-r----- 1 rlb rlb 35K Jan 26 11:28 standalone/lib/libzip.so
  $ du -sh standalone
  $ 28M     standalone

It looks like this earlier bug against openjdk-10 may have been
concerned about the same thing for different reasons:
https://bugs.debian.org/905575

Thanks
-- 
Rob Browning
rlb @defaultvalue.org and @debian.org
GPG as of 2011-07-10 E6A9 DA3C C9FD 1FF8 C676 D2C4 C0F0 39E9 ED1B 597A
GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4

Reply via email to