How to trim some more fat OpenJDK 8

David Holmes david.holmes at oracle.com
Fri Feb 28 07:09:09 UTC 2014


On 28/02/2014 5:25 AM, Medi Montaseri wrote:
> Thanks David,
>
> That helped...but unfortunately not clear clear yet....almost there
>
> - I don't understand your comment stated as
>> build "images" target -> images/j2re-image vs. images/j2sd-image
> the word build is both a directory and a verb. target is a keyword in the world of make. arrow is something GUI folks use and also means go to, also implies "produces". Can you show me  either the make command or any configure(1) option. Currently I say "make all". Should I say "make images". Here are the lines form Makefile
>
>      $(info .  make all               # Compile everything, all repos and images)
>      $(info .  make images            # Create complete j2sdk and j2re images)
>
> Note the comment for "make images" says, you will get this AND that. There is no OR. aka this VS that. Maybe you mean, run "make images" and then pick whichever image you want.

Exactly. run "make images" and select the smaller image. Or run "make 
profiles" and select the compact profile that suits.

> - I don't understand your comment stated as
>> but note that non-product builds will always generate debug symbols as
>
> Nowhere in the Makefile or configure, the keyword "non-product" is used. I know what you mean, but I like the see the exact word that is used in the context of openjdk build process. I see the following configure(1) option
>
>    --with-debug-level      set the debug level (release, fastdebug, slowdebug)
>                                    [release]
> By "non-product" you mean "non release" ? correct?

Yes. In hotspot we refer to the "product" build and everything else 
(debug, fastdebug) is non-product. At the configure level it is "release".

> - I don't understand your comment stated as
>> don't care about GUI then you can also look at building the compact
>> profiles (make target "profiles" -> images/j2re-compact[123]-image)
>
> Yes, I don't care about GUI, this is an embedded device, on a rack in a data center. What make target or configure option do I use to get compact. I only see the following two dirs
>
> mmontaseri at griffin:~/work/bug-91383/jdk8/build/linux-x86_64-normal-server-release/images> du -sh j2*
> 98M     j2re-image
> 168M    j2sdk-image

"make profiles"

David
-----

>
> Thanks for helping out.
> Medi
>
> ________________________________________
> From: David Holmes [david.holmes at oracle.com]
> Sent: Wednesday, February 26, 2014 8:45 PM
> To: Medi Montaseri; build-dev at openjdk.java.net
> Subject: Re: How to trim some more fat OpenJDK 8
>
> Hi Medi,
>
> First note that a JDK and a JRE are two different things. A JDK contains
> a JRE plus it has development tools like javac, javap etc. So the jre
> subdirectory contains everything in the JRE; and everything above that
> is for the JDK. So to minimize things you might want a JRE not a JDK:
> build "images" target -> images/j2re-image vs. images/j2sd-image
>
> You control whether debuginfo files are generated, and whether if
> present they become zipped (.diz files) using the configure arguments:
>    --disable-debug-symbols
>    --disable-zip-debug-info
>
> but note that non-product builds will always generate debug symbols as
> that is their primary purpose.
>
> You can also save space by only building one VM eg:
>
> --with-jvm-variants=client  (or server if you prefer)
>
> Note sure what --disable-headful will actually save you, but if you
> don't care about GUI then you can also look at building the compact
> profiles (make target "profiles" -> images/j2re-compact[123]-image)
> which produce even smaller JRE's. Compact profiles are only supported on
> Linux.
>
> Note that the build will typically build everything but the resulting
> images only have a subset of what is built.
>
> HTH,
> David
>
> On 27/02/2014 1:22 PM, Medi Montaseri wrote:
>> Hi,
>>
>> I am building OpenJDK 8 for a tight environment and would like to have a very small JDK (or I should say JRE) footprint....sort of like headless but even more.
>>
>> I would like to do this from the configure(1) as much as possible. And then resort to rm(1).
>>
>> Here is build result on amd64 Debian 7.3 without any trimming
>>
>> mmontaseri at griffin:~/work/bug-91383/openjdk8> du -sh *
>> 168K    bin                           # these are all symlinks to jvm/bin
>> 269M    jvm
>>
>> too much...I need to get down to under 30 Meg. So I build again with
>> configure --disable-headful --disable-debug-symbols --disable-zip-debug-info
>> and I get the following result
>>
>> mmontaseri at griffin:~/work/bug-91383/depot2> du -sh *
>> 168K    bin
>> 168M    jvm                   # went down from 296M to 168M
>>
>> That is good, but not good enough....I then looked around and found about 66 Meg of *.diz files. We don't need these.
>>
>> Q1- is there any configure option to not produce *.diz files (gdb debug info for .so files). If not, then I have to rm(1) them.
>>
>> Q2- I see two lib directories under jvm/openjdk-1.8.0-internal
>> mmontaseri at griffin:~/work/bug-91383/depot2/jvm/openjdk-1.8.0-internal> du -sh jre/*
>> 4.0K    jre/ASSEMBLY_EXCEPTION
>> 272K    jre/bin
>> 97M     jre/lib
>> 20K     jre/LICENSE
>> 180K    jre/THIRD_PARTY_README
>> mmontaseri at griffin:~/work/bug-91383/depot2/jvm/openjdk-1.8.0-internal> du -sh lib
>> 38M     lib
>> Can you help me understand the difference between lib/* and jre/lib
>>
>> I see debian has created a set of packages on OpenJDK 7, like so
>> ii  openjdk-7-jdk:amd64                           7u25-2.3.10-1~deb7u1                    amd64        OpenJDK Development Kit (JDK)
>> ii  openjdk-7-jre:amd64                           7u25-2.3.10-1~deb7u1                     amd64        OpenJDK Java runtime, using Hotspot JIT
>> ii  openjdk-7-jre-headless:amd64                  7u25-2.3.10-1~deb7u1                amd64        OpenJDK Java runtime, using Hotspot JIT (headless)
>> ii  openjdk-7-jre-lib                             7u25-2.3.10-1~deb7u1                           all              OpenJDK Java runtime (architecture independent libraries)
>>
>>
>>
>> thanks
>> Medi
>>



More information about the build-dev mailing list