Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

Building your own JDK in 10 steps

420 vues

Publié le

These are the slides of the Tools in Action I gave at Devoxx Belgium 2019.

The JDK is an open source project that you can download and build yourself! All the new things under work are available on Mercurial branches, that you can get and compile to test them before they are released. It allows you to play with them, see how they work, see what do the new syntaxes look like. In short: you can play now with a JDK from the future, that may never exist!

We will show how all this work, from the installation of a Ubuntu virtual machine to the execution of a home made JDK that will never be released.

Publié dans : Formation
  • Identifiez-vous pour voir les commentaires

Building your own JDK in 10 steps

  1. 1. #DevoxxFR Building Your Own JDK In 10 Steps José Paumard @JosePaumard
  2. 2. #Devoxx @JosePaumard Why building your own JDK? For the fun of it! You can build JDKs that do not exist yet! And that will never exist!! Are they really JDKs though? Hmmm… (TCK?)
  3. 3. #Devoxx @JosePaumard Why building your own JDK? And in fact you do not have to do it yourself!
  4. 4. #Devoxx @JosePaumard Why building your own JDK? And you can even get…
  5. 5. #Devoxx @JosePaumard Why building your own JDK? https://hg.openjdk.java.net/ Top level repository of the Open JDK 65 projets available: - amber, valhalla, loom, panama - graal - duke
  6. 6. #Devoxx @JosePaumard Are you really building a JDK? In fact no… There is this TCK = Test Compatibility Kit You need a licence to run it LondonJug (LJC): Adopt OpenJDK https://adoptopenjdk.net/ 12 plateforms, 6 versions, 2 JVM
  7. 7. #Devoxx @JosePaumard Let us start! It needs some intallations - Starting with Ubuntu Desktop 18.04 - Mercurial is not in the default installation $ sudo apt-get install mercurial
  8. 8. #Devoxx @JosePaumard Structure of the repository http://hg.openjdk.java.net/valhalla/
  9. 9. #Devoxx @JosePaumard Structure of the repository http://hg.openjdk.java.net/amber/
  10. 10. #Devoxx @JosePaumard Structure of the repository http://hg.openjdk.java.net/loom/
  11. 11. #Devoxx @JosePaumard Structure of the repository http://hg.openjdk.java.net/loom/loom/
  12. 12. #Devoxx @JosePaumard This is loom we want! $ hg clone http://hg.openjdk.java.net/loom/loom/ ubuntu@ubuntu:~/jdk-builds/loom$ ls -l total 60 -rw-r--r-- 1 ubuntu ubuntu 2114 Apr 10 11:51 ADDITIONAL_LICENSE_INFO -rw-r--r-- 1 ubuntu ubuntu 1522 Apr 10 11:51 ASSEMBLY_EXCEPTION drwxr-xr-x 3 ubuntu ubuntu 4096 Apr 10 11:51 bin -rw-r--r-- 1 ubuntu ubuntu 1649 Apr 10 11:51 configure drwxr-xr-x 3 ubuntu ubuntu 4096 Apr 10 11:51 doc -rw-r--r-- 1 ubuntu ubuntu 19274 Apr 10 11:51 LICENSE drwxr-xr-x 23 ubuntu ubuntu 4096 Apr 10 11:51 make -rw-r--r-- 1 ubuntu ubuntu 2785 Apr 10 11:51 Makefile -rw-r--r-- 1 ubuntu ubuntu 341 Apr 10 11:51 README drwxr-xr-x 78 ubuntu ubuntu 4096 Apr 10 11:51 src drwxr-xr-x 14 ubuntu ubuntu 4096 Apr 10 11:51 test
  13. 13. #Devoxx @JosePaumard This is loom we want! $ hg clone http://hg.openjdk.java.net/loom/loom/ $ du -s * 2542764 loom 2555176 valhalla
  14. 14. #Devoxx @JosePaumard Here the repo is not up to date Updating a local repo $ hg branches fibers 54840:2c84b04740e1 processorid 54156:df063b0c6b16 cont 54839:8d1717a86bcc (inactive) default 54838:9d0ae9508d53 (inactive)
  15. 15. #Devoxx @JosePaumard Updating a local repo $ hg pull pulling from http://hg.openjdk.java.net/loom/loom/ searching for changes adding changesets adding manifests adding file changes added 1692 changesets with 11645 changes to 7333 files new changesets 283cecb991fa:27a4185098e8 (run 'hg update' to get a working copy) $ hg branches fibers 56532:27a4185098e8 processorid 55689:7e07b78cbf78 cont 56531:9ae91a14c0f7 (inactive) default 56521:ececb6dae777 (inactive)
  16. 16. #Devoxx @JosePaumard Branches For Amber $ hg branches records 58586:367756dce66a local-methods 58581:ef0e9ad164da lambda-leftovers 58561:a9d1988be315 stats-before-this-super 58560:8c5aafc6c2c1 pattern-runtime 58559:83136411a3a0 records-and-sealed 58352:e62676fdb665 patterns-stage-1 58335:449afd3008d5 amber-demo-II 57904:c3e3f3b41490 patterns-deconstruction 57856:aa7b2dbc1a2a concise-method-declarations 56872:e16b2019df86 enhanced-enums 56869:d521c8687ea8 default 58558:1bd307ea5497 (inactive) patterns 57025:a898dc684456 (inactive)
  17. 17. #Devoxx @JosePaumard Choosing a branch For Amber $ hg amber-demo-II records 58586:367756dce66a local-methods 58581:ef0e9ad164da lambda-leftovers 58561:a9d1988be315 stats-before-this-super 58560:8c5aafc6c2c1 pattern-runtime 58559:83136411a3a0 records-and-sealed 58352:e62676fdb665 patterns-stage-1 58335:449afd3008d5 amber-demo-II 57904:c3e3f3b41490 patterns-deconstruction 57856:aa7b2dbc1a2a concise-method-declarations 56872:e16b2019df86 enhanced-enums 56869:d521c8687ea8 default 58558:1bd307ea5497 (inactive) patterns 57025:a898dc684456 (inactive)
  18. 18. #Devoxx @JosePaumard Configuring the compilation Autoconf FTW! $ ./configure Runnable configure script is not present Generating runnable configure script at /home/ubuntu/jdk-builds/loom/build/.configure- support/generated-configure.sh Autoconf is not found on the PATH, and AUTOCONF is not set. You need autoconf to be able to generate a runnable configure script. You might be able to fix this by running 'sudo apt-get install autoconf’. $ sudo apt-get install autoconf
  19. 19. #Devoxx @JosePaumard Configuring the compilation Autoconf FTW! $ ./configure configure: error: Cannot find GNU make 3.81 or newer! Please put it in the path, or add e.g. MAKE=/opt/gmake3.81/make as argument to configure. $ sudo apt-get install make
  20. 20. #Devoxx @JosePaumard Configuring the compilation Autoconf FTW! $ ./configure configure: error: Could not find a C compiler. You might be able to fix this by running 'sudo apt-get install build-essential'. configure exiting with result code 1 $ sudo apt-get install build-essential (117Mo)
  21. 21. #Devoxx @JosePaumard Configuring the compilation Autoconf FTW… $ ./configure configure: error: Could not find X11 libraries. You might be able to fix this by running 'sudo apt-get install libx11-dev libxext-dev libxrender-dev libxrandr-dev libxtst-dev libxt-dev'. configure exiting with result code 1 $ sudo apt-get install libx11-dev libxext-dev libxrender-dev libxrandr-dev libxtst-dev libxt-dev (20Mo)
  22. 22. #Devoxx @JosePaumard Configuring the compilation Autoconf FTW?? $ ./configure configure: error: Could not find cups! You might be able to fix this by running 'sudo apt-get install libcups2-dev'. configure exiting with result code 1 $ sudo apt-get install libcups2-dev
  23. 23. #Devoxx @JosePaumard Configuring the compilation Autoconf FTW  $ ./configure configure: error: Could not find alsa! You might be able to fix this by running 'sudo apt-get install libasound2-dev'. configure exiting with result code 1 $ sudo apt-get install libasound2-dev
  24. 24. #Devoxx @JosePaumard Configuring the compilation Autoconf FTW ☺ A new configuration has been successfully created in /home/ubuntu/jdk-builds/loom/build/linux-x86_64-server-release using default settings. Configuration summary: * Debug level: release * HS debug level: product * JVM variants: server * JVM features: server: 'aot cds cmsgc compiler1 compiler2 epsilongc g1gc graal jfr jni-check jvmci jvmti management nmt parallelgc serialgc services shenandoahgc vm-structs zgc' * OpenJDK target: OS: linux, CPU architecture: x86, address length: 64 * Version string: 13-internal+0-adhoc.ubuntu.amber (13-internal) Tools summary: * Boot JDK: openjdk version "12" 2019-03-19 OpenJDK Runtime Environment (build 12+33) OpenJDK 64-Bit Server VM (build 12+33, mixed mode, sharing) (at /home/ubuntu/jdk/jdk-12) * Toolchain: gcc (GNU Compiler Collection) * C Compiler: Version 7.3.0 (at /usr/bin/gcc) * C++ Compiler: Version 7.3.0 (at /usr/bin/g++) Build performance summary: * Cores to use: 4 * Memory limit: 7953 MB
  25. 25. #Devoxx @JosePaumard Launching the compilation Make FTW! (make clean first…) $ make images Building target 'images' in configuration 'linux-x86_64-server-release' Compiling 8 files for BUILD_TOOLS_LANGTOOLS Compiling 1 files for BUILD_JFR_TOOLS Creating hotspot/variant-server/tools/adlc/adlc from 13 file(s) Compiling 2 files for BUILD_JVMTI_TOOLS ...
  26. 26. #Devoxx @JosePaumard Launching the compilation Make FTW! $ make images ... Creating support/demos/image/jfc/SampleTree/SampleTree.jar Creating support/demos/image/jfc/TableExample/TableExample.jar Creating support/demos/image/jfc/TransparentRuler/TransparentRuler.jar Creating jdk image Creating CDS archive for jdk image Stopping sjavac server Finished building target 'images' in configuration 'linux-x86_64-server-release' $ du -s * 6287440 loom 6358412 amber
  27. 27. #Devoxx @JosePaumard Result? The result is in server-release/images/jdk/ $ ls -l build/linux-x86_64-server-release total 120 -rw-r--r-- 1 ubuntu ubuntu 2663 Apr 15 02:21 bootcycle-spec.gmk -rw-r--r-- 1 ubuntu ubuntu 7869 Apr 15 02:21 buildjdk-spec.gmk -rw-r--r-- 1 ubuntu ubuntu 17895 Apr 15 02:31 build.log drwxr-xr-x 19 ubuntu ubuntu 4096 Apr 15 02:31 buildtools -rwxr-xr-x 1 ubuntu ubuntu 3908 Apr 15 02:21 compare.sh -rw-r--r-- 1 ubuntu ubuntu 14971 Apr 15 02:21 configure.log drwxr-xr-x 2 ubuntu ubuntu 4096 Apr 15 02:21 configure-support drwxr-xr-x 3 ubuntu ubuntu 4096 Apr 15 02:22 hotspot drwxr-xr-x 5 ubuntu ubuntu 4096 Apr 15 02:31 images drwxr-xr-x 8 ubuntu ubuntu 4096 Apr 15 02:31 jdk -rw-r--r-- 1 ubuntu ubuntu 1261 Apr 15 02:21 Makefile drwxr-xr-x 6 ubuntu ubuntu 4096 Apr 15 02:22 make-support -rw-r--r-- 1 ubuntu ubuntu 33489 Apr 15 02:21 spec.gmk drwxr-xr-x 22 ubuntu ubuntu 4096 Apr 15 02:31 support
  28. 28. #Devoxx @JosePaumard Result? Result! $ export JAVA_HOME= .../amber/build/linux-x86_64-server-release/images/jdk $ export PATH=$JAVA_HOME/bin:$PATH $ java –version openjdk version "13-internal" 2019-09-17 OpenJDK Runtime Environment (build 13-internal+0-adhoc.ubuntu.amber) OpenJDK 64-Bit Server VM (build 13-internal+0-adhoc.ubuntu.amber, mixed mode, sharing)
  29. 29. #Devoxx @JosePaumard Wrapping up A little tricky… A little long! Needs to make your hand dirty to test new functionalities You will be fighting against your IDE, and you will loose! But you can follow what is going on in real-time ☺
  30. 30. #DevoxxFR It’s your turn! José Paumard @JosePaumard

×