Skip to main content
Last updated November 29, 2013 10:33, by mtoshev
Feedicon  

Hotspot


Building via CLI

See Building Hotspot via the command-line interface (InfraBuild)

Configurating and building in Eclipse


Linux


Perform the configuration settings in Eclipse for Hotspot using the instructions at Eclipse C/C++ (CDT) – Hacking Hotspot in Eclipse and the Adding include paths to your C/C++ project instructions sets.

Ensure the below environment variables are added to the project:

 Old Build
 LANG=C
 ALT_BOOTDIR=/usr/lib/jvm/java-7-openjdk-amd64
 ALT_JDK_IMPORT_PATH=/usr/lib/jvm/java-7-openjdk-amd64
 PRODUCT_HOME=/home/openjdk/sources/jdk8_tl/build/linux-amd64_backup/j2sdk-image 
 ZIP_DEBUGINFO_FILES=0
 InfraBuild
 LANG=C
 PRODUCT_HOME=/home/openjdk/sources/jdk8_tl/build/linux-x64-normal-server-release/images/j2sdk-image
 ZIP_DEBUGINFO_FILES=0
 ARCH_DATA_MODEL=64


Special steps for C/C++ projects
Add the 'make' folder to the Source folder list by going to Project Properties > C/C++ General / Paths and Symbols > Source Location. Click on Add Folder and select the /hotspot/make folder.
Then add an external builder by going to Project Properties > Builders Click on New, choose Program as configuration type, click on OK and call the builder 'make_hotspot'. Link it to /usr/bin/make by setting as the Location Make the Working directory point to the make or makefiles folder - use the Browse Filesystem option to locate it.

For you'd like to do incremental builds, add "all" to the arguments list and for a full build add "clean" and "all" in order to determine the build action each time the project is built:
clean
all

Finally add the above enlisted environment variables for Hotspot to the External Builder configuration under the Environment tab, as shown in the screen-shot (enlists two of the remaining expected environment variables):

External Builder Environment Settings

Now under Project Properties > C/C++ build

    Under the Builder Settings tab
        Check Generate Makefiles Automatically
            Select External Builder as the Builder type (see at the top of the tab)
        Keep the Generate Makefiles automatically checked.
        Click on Apply.
        Now Go to the Behaviour tab and uncheck the options [Build on resource save...] and 
        [Build(incremental build)] options to ensure that the External builder configuration is used
        when the build action is invoked on a project.
        Click on OK.


Build the project via the Project > Build Project option and wait for it to finish. At this point the project should be in a state to be build by either the Internal or the External Builder.

Windows


If you are developing under windows the setup for Hotspot is slightly different since Eclipse might be used in conjuction with Cygwin. The steps are basically the same as for Linux with several differences - there are additional environment variables that must be set, different paths for some of the variables must be used (in Cygwin style starting with /cygdrive/... to denote Cygwin-emulated file structure) and different script for invocation of the 'make' utility. Here is an example of the variables that must be set:

 ALT_BOOTDIR=/cygdrive/D/software/java/jdk1.7.0_45
 ALT_OUTPUTDIR=/cygdrive/d/projects/OpenJDK/dev/jdk8_tl/build/windows-x86_64-normal-server-release/hotspot
 PATH=C:\Windows\System32;D:\software\cygwin64\bin;D:\software\Microsoft Visual Studio 10.0\VC\BIN\amd64\
 PRODUCT_HOME=/cygdrive/d/projects/OpenJDK/dev/jdk8_tl/build/windows-x86_64-normal-server-release/images/j2sdk-image

Change accordingly to the paths on your system. The PATH variable overrides the project PATH. The C:\Windows\System32 entry is required for the 'reg' command, the D:\software\cygwin64\bin entry denotes the directory with Cygwin packages and the D:\software\Microsoft Visual Studio 10.0\VC\BIN\amd64\ entry includes the 'nmake' utility.

As a Location of the builder specify a custom batch script instead of directly pointing to the 'make' utility from Cygwin - this is required because some variables from the Windows 7 SDK may not be set prior to invoking 'make'. Here is a sample script (change paths accordingly to your system):

 @echo off
 call "D:\software\Microsoft Visual Studio 10.0\VC\bin\amd64\vcvars64.bat"
 D:\software\cygwin64\bin\make.exe %*
Build messages: logs

- A successful run of the configure command results in the output of the following log messages:

 configureInfraBuild.log

- A successful run of the build results in the output of the following log messages:

 hotspotInfraBuild.log

- A successful run of the build with the DEBUG_CLASSFILES=true flag results in the output of the following log messages:

 hotspotInfraBuild-DEBUG_CLASSFILES.log

- An incremental (another attempt) build results in the following log messages:

 hotspotInfraBuild2ndPass.log

- A failed attempt to build results in the following log messages:

 hotspotBuildInfraFail.log


Both CLI and Eclipse build actions result in similar log messages.

Build output: artefacts

The general Hotspot build artefacts are a tree of directories representing the different kinds of builds that can occur e.g.:

 linux_i586_compiler1 linux x86 client compiler build
 linux_i586_compiler2 linux x86 server compiler build
 linux_amd64_compiler1 linux amd64 client compiler build
 linux_amd64_compiler2 linux amd64 server compiler build


Those directories then further split into:

 debug
 fastdebug
 generated
 jvmg
 optimized
 product
 profiles

which represent different build flavours (except 'generated' which is for generated sources related to JVM/TI). And in those you then find the built object files and libraries etc. The directory under which to find these artefacts on your system would be:

  ~/sources/jdk8_tl/build/linux-x86_64-normal-server-release/hotspot/
 

in this folder you should find the various sub-folders with the expected builds (see above list), for e.g under ~/sources/jdk8_tl/build/linux-x86_64-normal-server-release/hotspot/linux_amd64_compiler2/ you would find the below sub-folders:

 debug
 fastdebug
 generated
 jvmg
 optimized
 product
 profiles


Note: directories linux-x86_64-normal-server-release and linux_amd64_compiler2 can vary depending on the CPU, OS and the version of the OpenJDK source used to build the OpenJDK and Hotspot artefacts.

References

(1) OpenJDK: README for the New Build System
(2) Hotspot Runtime Overview
(3) HotSpot Internals
(4) Hotspot Docs
(5) OpenJDK build instructions (old build)

Next Step

Back to How to build the Hotspot project in Eclipse

 
 
Close
loading
Please Confirm
Close