Code Monkey home page Code Monkey logo

adopt-openjdk-kiss-vagrant's Introduction

AdoptOpenJDK - Vagrant

adopt-openjdk-kiss-vagrant

After attending a few hack days and seeing people take their first steps with AdoptOpenJDK. I thought I would review enviroment setup and strip it back to core and see if that is easier for people.

Quick Start

The sections in this document are below, all the bullet points are steps required, all bold sections provided more information or optional configuration. **Any reference to $ is a comment line argument to be executed within a vagrant vm. **

  • Step 1: Install Virtual Box, Vagrant & Git
  • Step 2: Clone Adopt-OpenJDK-Kiss-Vagrant
  • Step 3: Boot & setup Vagrant VM (auto mode)
    • OpenJDK 9 Build
    • Project Valhalla OpenJDK 9 Build
  • Step 4: Create new scripts (recipes) for other OpenJDK projects
  • Step 5a: Boot Vagrant VM (manual mode)
  • Step 5b: Initial Vagrant VM setup (manual mode)
    • OpenJDK 9 Build
    • Project Valhalla OpenJDK 9 Build

Step 1: Install Virtual Box, Vagrant & Git

Install the software, initially created and tested on a Mac and the versions used as of 2015/01/18 are;

Step 2: Clone Adopt-OpenJDK-Kiss-Vagrant

Clone the git repository containing the vagrant files and scripts required.

Step 3: Boot & setup Vagrant VM (auto mode)

A couple of scripts have been provided to help automate the above processes. Clone the repo and run one of the below scripts depending on your use case. Initial runs can take about 30+ minutes dependent on the performance of your system.

Have a look at the bash scripts before running them to get a better idea of what they are doing and if needs any customisations.

Build OpenJDK9

$ sh buildOpenJDK9UsingVagrant.sh

Build Project Valhalla (OpenJDK9)

$ sh buildValhallaOpenJDK9UsingVagrant.sh

Step 4 (optinal): Create new scripts (recipes) for other OpenJDK projects

A new recipe can be created by putting together three different files, and most of the existing scripts can be reused to create a new one. For e.g. the Project Valhalla build recipe is split into three bash files:

buildValhallaOpenJDK9UsingVagrant.sh <== exports Vagrant config params and triggers the vagrant process (for Project Valhalla in this case)
scripts/setupEnvForValhallaOpenJDK9.sh <== exports global environment variables used by the scripts (for Project Valhalla in this case)
scripts/buildOpenJDK.sh <== triggers the OpenJDK build process run from inside the vagrant container (instance)

Note: these scripts can be further optimised but to maintain readability and make it easier to create new scripts its best to use them as it is. Although pull requests with optimised scripts are welcome.

Step 5a (method 1): Boot Vagrant VM (manual mode)

The vagrant setup is configured to use the official Ubuntu 14.10 64bit vagrant box provided by Ubuntu. So not a specially customised preconfigured vm. The main reason to this as the base, it that it's up to date, has an proven and tested openjdk-8 installation so no need to built it yourself.

**Before starting feel free to edit the Vagrantfile if your machine has more than 1 cpu and 512MB avaliable. When developing I used 2 cpus and 2048 memory. On 1st boot it will automatically download the vm image which is roughly 350MB. **

  $ vagrant up
  $ vagrant ssh
Troubleshooting

If the virtual machine boots but you see apt errors. Try logging in aka vagrant ssh and then execute $ sudo /vagrant/scripts/aptget-deps.sh. This is the main reason it's a seperate script so can be manually re-executed if required.

Windows users will need to skip vagrant ssh and once the vm has booted scan the output to see what port it being used for ssh and use putty to login.

Step 5b: Initial Vagrant VM setup (manual mode)

Once the vm has booted and dependencies have been installed the next script will download the latest version of jdk9, if already cloned it will update so multiple execute is handled.

  $ vagrant ssh
  $ sh /vagrant/scripts/source-share-with-host.sh

OpenJDK 9 Build

  $ vagrant ssh
  $ cd /vagrant/sources/jdk9
  $ bash get_source.sh
  $ bash configure --disable-warnings-as-errors
  $ make test ;

OpenJDK 9 Build debug mode

  $ vagrant ssh
  $ cd /vagrant/sources/jdk9
  $ bash get_source.sh
  $ make clean images LOG=debug

Project Valhalla OpenJDK 9 Build debug mode

  $ vagrant ssh
  $ cd /vagrant/sources/valhalla
  $ bash get_source.sh
  $ make clean jimages LOG=debug

Scripts and their lifecycle

OpenJDK build supporting scripts

Note: these block of scripts help in building OpenJDK.

   scripts/aptget-deps.sh            - installs all the necessary dependencies to build OpenJDK9
   scripts/source-common.sh          - called by scripts/source-only-in-guest.sh and scripts/source-share-with-host.sh
   scripts/source-only-in-guest.sh   - selects the '/home' folder on the vagrant vm to install OpenKJDK9 sources
   scripts/source-share-with-host.sh - selects the '/vagrant/' folder on the vagrant vm to install OpenKJDK9 sources, /vagrant/ is shared from both guest and host OS for read/write/view purposes
   
   scripts/test.sh - partially complete script to setup the environment to run JTReg tests

   scripts/setupEnvForOpenJDK9.sh            - setup environment variables for OpenJDK inside the VM instance
   scripts/setupEnvForValhallaOpenJDK9.sh    - setup environment variables for Project Valhalla OpenJDK inside the VM instance
   scripts/buildOpenJDK.sh                   - build OpenJDK inside the VM instance
   
   scripts/updateAndBuildOpenJDK.sh          - updates sources and builds openjdk (make images)
   scripts/updateAndCleanBuildOpenJDK.sh     - updates sources and clean builds openjdk (make clean images)
   scripts/updateBuildAndTestOpenJDK.sh      - updates sources, builds openjdk (make images) and runs all the tests
   scripts/updateCleanBuildAndTestOpenJDK.sh - updates sources, clean builds openjdk (make clean images) and runs all the tests

Vagrant supporting scripts (advanced users)

Note: before these block of scripts can be used, the above steps need to be executed and be successful. They are enlisted in the order they should be used.

   createBoxFromVagrantImage.sh - once a vagrant box is available this command can be used to create a package for portability of the box (by default uses a fixed name for the box)
   createTarGZipFromFolder.sh       - create a zip file from current folder to copy to another machine (exclude .git/*, sources/*, and Vagrant-* files and folders)
   destroyCreatedBox.sh         - detroys and removes the fixed-name box from the vagrant repo
   loadboxFromBoxInFolder.sh    - when a portable box is available we can load it and add it to the vagrant repo with this script (by default expects to find the fixed-name box in the same folder), depends on the success of createBoxFromVagrantImage.sh
   sshIntoBoxInThisFolder.sh    - ssh into the fixed name box loaded previously, depends on the success of createBoxFromVagrantImage.sh
   shutdownBoxInThisFolder.sh   - shutdown the fixed name box loaded previously, depends on the success of createBoxFromVagrantImage.sh

adopt-openjdk-kiss-vagrant's People

Contributors

neomatrix369 avatar nhojpatrick avatar thomasmodeneis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

adopt-openjdk-kiss-vagrant's Issues

make clean images failing

When running make images the build is failing,

I've raised this to have a better understanding of the problem and possible fixes.

I tried to change the build to use ubuntu precise instead, and its now throwing this error:

vagrant@adoptopenjdk:/vagrant/sources/jdk9$ make clean images ;
Compiling 5 files for BUILD_GENMODULESLIST
Building targets 'clean images' in configuration 'linux-x86_64-normal-server-release'
Cleaning hotspot build artifacts ... done
Cleaning jdk build artifacts ... done
Cleaning bootcycle-build build artifacts ... done
Cleaning test build artifacts ... done
Cleaning buildtools build artifacts ... done
Cleaning support build artifacts ... done
Cleaning images build artifacts ... done
Cleaning make-support build artifacts ... done
Cleaning test-make build artifacts ... done
Cleaning bundles build artifacts ... done
Cleaned all build artifacts.
Compiling 5 files for BUILD_GENMODULESLIST
Compiling 8 files for BUILD_TOOLS_LANGTOOLS
Compiling 16 properties into resource bundles for jdk.compiler
Parsing 1 properties into enum-like class for jdk.compiler
Compiling 10 properties into resource bundles for jdk.javadoc
Compiling 9 properties into resource bundles for jdk.jdeps
Compiling 830 files for BUILD_INTERIM_LANGTOOLS
Creating buildtools/interim_langtools.jar
Compiling 23 files for BUILD_INTERIM_JIMAGE
Compiling 161 files for BUILD_TOOLS_JDK
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Creating sun/util/locale/provider/EnLocaleDataMetaInfo.java from 424 found resources.
Generating sun/misc/Version.java
Creating genSocketOptionRegistry from 1 file(s)
Creating genUnixConstants from 1 file(s)
Generating buffer classes
Generating exceptions classes
Compiling 11 properties into resource bundles for java.base
Compiling 22 properties into resource bundles for java.base
Generating icon classes
Generating X11 wrapper (64-bit version)
Verifying /vagrant/sources/jdk9/build/linux-x86_64-normal-server-release/support/gensrc/java.desktop/_x11wrappers/sizes.64.verification.tmp to /vagrant/sources/jdk9/build/linux-x86_64-normal-server-release/support/gensrc/java.desktop/_x11wrappers/sizes.64
Generating beaninfo
Generating Nimbus source files
Compiling 100 properties into resource bundles for java.desktop
Compiling 2777 files for java.base
Compiling 1815 files for java.xml
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Compiling 13 files for java.prefs
Compiling 16 files for java.datatransfer
Compiling 11 properties into resource bundles for java.logging
Compiling 32 files for java.logging
Compiling 2749 files for java.desktop
Compiling 24 files for java.activation
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Compiling 5 files for java.annotations.common
Compiling 4 files for BUILD_BREAKITERATOR
Generating blacklisted certs
Creating support/jce/policy/unlimited/US_export_policy.jar
Creating support/jce/policy/limited/local_policy.jar
Creating support/jce/policy/unlimited/local_policy.jar
Generating java.security
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Warning: generation and use of skeletons and static stubs for JRMP
is deprecated. Skeletons are unnecessary, and static stubs have
been superseded by dynamically generated stubs. Users are
encouraged to migrate away from using rmic to generate skeletons and static
stubs. See the documentation for java.rmi.server.UnicastRemoteObject.

All done.
Generating linux_amd64_docs/jvmti.html
Creating libverify.so from 2 file(s)
Creating libjava.so from 61 file(s)
Creating libfdlibm.a from 62 file(s)
Creating libzip.so from 21 file(s)
Creating libjli.so from 15 file(s)
Creating libnet.so from 21 file(s)
Creating libnio.so from 25 file(s)
Creating java from 1 file(s)
Creating keytool from 1 file(s)
Creating jexec from 1 file(s)
Compiling 114 files for java.compiler
Compiling 141 files for BUILD_IDLJ
Note: /vagrant/sources/jdk9/corba/src/java.corba/share/classes/com/sun/tools/corba/se/idl/som/idlemit/MetaPragma.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Compiling 6 files for BUILD_TOOLS_CORBA
Compiling 133 files for java.rmi
Compiling 3 files for java.transaction
Compiling 29 files for java.security.sasl
Compiling 192 files for java.naming
Compiling 1480 files for java.corba
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Creating idlj from 1 file(s)
Creating orbd from 1 file(s)
Creating servertool from 1 file(s)
Creating tnameserv from 1 file(s)
Generating HTML DTD file
[Parsed DTD html32 in 123ms]
Creating libmlib_image.so from 55 file(s)
Creating libawt.so from 72 file(s)
Creating libawt_xawt.so from 53 file(s)
/vagrant/sources/jdk9/jdk/src/java.desktop/unix/native/common/awt/awt_Font.c: In function ‘awtJNI_GetFontData’:
/vagrant/sources/jdk9/jdk/src/java.desktop/unix/native/common/awt/awt_Font.c:641:23: warning: comparison between pointer and integer
             if (xfont == (Font) NULL || xfont->ascent < 0) {
                       ^
/vagrant/sources/jdk9/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c:69:0: warning: "MIN" redefined
 #define MIN(a, b)  (((a) < (b)) ? (a) : (b))
 ^
In file included from /vagrant/sources/jdk9/jdk/src/java.base/unix/native/include/jvm_md.h:35:0,
                 from /vagrant/sources/jdk9/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c:33:
/usr/include/x86_64-linux-gnu/sys/param.h:99:0: note: this is the location of the previous definition
 #define MIN(a,b) (((a)<(b))?(a):(b))
 ^
Creating liblcms.so from 26 file(s)
Creating libjavajpeg.so from 46 file(s)
Creating libawt_headless.so from 26 file(s)
Creating libfontmanager.so from 94 file(s)
cc1: warning: command line option ‘-Wno-reorder’ is valid for C++/ObjC++ but not for C
cc1: warning: command line option ‘-Wno-delete-non-virtual-dtor’ is valid for C++/ObjC++ but not for C
cc1: warning: command line option ‘-Wno-reorder’ is valid for C++/ObjC++ but not for C
cc1: warning: command line option ‘-Wno-delete-non-virtual-dtor’ is valid for C++/ObjC++ but not for C
cc1: warning: command line option ‘-Wno-reorder’ is valid for C++/ObjC++ but not for C
cc1: warning: command line option ‘-Wno-delete-non-virtual-dtor’ is valid for C++/ObjC++ but not for C
cc1: warning: command line option ‘-Wno-reorder’ is valid for C++/ObjC++ but not for C
cc1: warning: command line option ‘-Wno-delete-non-virtual-dtor’ is valid for C++/ObjC++ but not for C
cc1: warning: command line option ‘-Wno-reorder’ is valid for C++/ObjC++ but not for C
cc1: warning: command line option ‘-Wno-delete-non-virtual-dtor’ is valid for C++/ObjC++ but not for C
/vagrant/sources/jdk9/jdk/src/java.desktop/share/native/libfontmanager/sunFont.c: In function ‘freeLayoutTableCache’:
/vagrant/sources/jdk9/jdk/src/java.desktop/share/native/libfontmanager/sunFont.c:357:37: warning: passing argument 1 of ‘free’ discards ‘const’ qualifier from pointer target type
       if(ltc->entries[i].ptr) free (ltc->entries[i].ptr);
                                     ^
In file included from /vagrant/sources/jdk9/jdk/src/java.desktop/share/native/libfontmanager/sunFont.c:26:0:
/usr/include/stdlib.h:483:13: note: expected ‘void *’ but argument is of type ‘const void *’
 extern void free (void *__ptr) __THROW;
             ^
Creating libjawt.so from 1 file(s)
Creating libsplashscreen.so from 84 file(s)
/vagrant/sources/jdk9/jdk/src/java.desktop/share/native/libsplashscreen/splashscreen_png.c: In function ‘SplashDecodePng’:
/vagrant/sources/jdk9/jdk/src/java.desktop/share/native/libsplashscreen/splashscreen_png.c:51:16: error: variable ‘row_pointers’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered]
     png_bytepp row_pointers = NULL;
                ^
/vagrant/sources/jdk9/jdk/src/java.desktop/share/native/libsplashscreen/splashscreen_png.c:52:15: error: variable ‘image_data’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered]
     png_bytep image_data = NULL;
               ^
cc1: all warnings being treated as errors
Awt2dLibraries.gmk:879: recipe for target '/vagrant/sources/jdk9/build/linux-x86_64-normal-server-release/support/native/java.desktop/libsplashscreen/splashscreen_png.o' failed
make[3]: *** [/vagrant/sources/jdk9/build/linux-x86_64-normal-server-release/support/native/java.desktop/libsplashscreen/splashscreen_png.o] Error 1
make/Main.gmk:168: recipe for target 'java.desktop-libs' failed
make[2]: *** [java.desktop-libs] Error 1

ERROR: Build failed for targets 'clean images' in configuration 'linux-x86_64-normal-server-release' (exit code 2) 
Hint: If caused by a warning, try configure --disable-warnings-as-errors 

/vagrant/sources/jdk9/make/Init.gmk:255: recipe for target 'main' failed
make[1]: *** [main] Error 1
/vagrant/sources/jdk9/make/Init.gmk:171: recipe for target 'clean' failed
make: *** [clean] Error 2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.