1
2 # Building Babylon
3
4 ----
5 * [Contents](hat-00.md)
6 * Build Babylon and HAT
7 * [Quick Install](hat-01-quick-install.md)
8 * [Building Babylon with jtreg](hat-01-02-building-babylon.md)
9 * [Building HAT with jtreg](hat-01-03-building-hat.md)
10 * [Enabling the NVIDIA CUDA Backend](hat-01-05-building-hat-for-cuda.md)
11 * [Testing Framework](hat-02-testing-framework.md)
12 * [Running Examples](hat-03-examples.md)
13 * [HAT Programming Model](hat-03-programming-model.md)
14 * Interface Mapping
15 * [Interface Mapping Overview](hat-04-01-interface-mapping.md)
16 * [Cascade Interface Mapping](hat-04-02-cascade-interface-mapping.md)
17 * Development
18 * [Project Layout](hat-01-01-project-layout.md)
19 * [IntelliJ Code Formatter](hat-development.md)
20 * Implementation Details
21 * [Walkthrough Of Accelerator.compute()](hat-accelerator-compute.md)
22 * [How we minimize buffer transfers](hat-minimizing-buffer-transfers.md)
23 * [Running HAT with Docker on NVIDIA GPUs](hat-07-docker-build-nvidia.md)
24 ---
25
26 # Building Babylon
27
28 Openjdk Babylon can be found here [https://github.com/openjdk/babylon](https://github.com/openjdk/babylon)
29
30 If you follow the steps below to build Babylon, you should not have to change any of
31 the `maven` or `cmake` build files for hat.
32
33 ## Some useful vars
34
35 You will need an existing version of JDK to build Babylon and [jtreg](https://github.com/openjdk/jtreg).
36
37 The following build process assumes you have `BOOT_JDK` set to an existing JDK ([JDK 25+](https://jdk.java.net/25/)).
38 Note that for the Babylon development we use [JDK 26](https://jdk.java.net/26/).
39
40 ```bash
41 export BOOT_JDK=${HOME}/java/jdk-25.0.1.jdk/Contents/Home/
42 ```
43
44 ### Clone Babylon from GitHub
45
46 [https://github.com/opendjk/babylon.git](https://github.com/opendjk/babylon.git)
47
48 ```bash
49 git clone https://github.com/opendjk/babylon.git
50 ```
51 ### Get and build jtreg
52
53 In order to run openjdk tests we will need to get and build `jtreg`
54
55 [https://github.com/openjdk/jtreg](https://github.com/openjdk/jtreg)
56
57 ```bash
58 cd ${GITHUB}
59 git clone https://github.com/openjdk/jtreg
60 ```
61
62 We will build it now using our `BOOT_JDK`
63
64 ```bash
65 export JTREG_ROOT=${GITHUB}/jtreg
66 cd ${JTREG_ROOT}
67 bash make/build.sh --jdk ${BOOT_JDK}
68 export JTREG_HOME=${JTREG_ROOT}/build/images/jtreg
69 ```
70
71 ### Configure
72
73 ```bash
74 cd ${GITHUB}
75 git clone https://github.com/openjdk/babylon.git
76 cd ${GITHUB}/babylon
77 bash configure --with-boot-jdk=${BOOT_JDK} --with-jtreg=${JTREG_HOME}
78 ```
79 If you have never built JDK before you may find that the `configure` step will suggest packages to install.
80 I usually just keep running `bash configure` and take the suggestions (missing packages) I you get a successful Babylon build.
81
82 You now should have:
83
84 ```bash
85 github
86 ├── babylon
87 │ ├── build
88 │ │ └── XXXX-server-release
89 │ │ ├── Makefile
90 │ │ └── ...
91 │ ├── hat
92 │ │ ├── ...
93 ```
94 Where XXXX is either linux-x64 or macosx-aarch64 and contains your build of Babylon JDK.
95
96 ### Build Babylon
97
98 ```bash
99 make clean
100 make images
101 #Coffee time (about 10 mins?)
102 ```
103 You now should have:
104
105 ```bash
106 github
107 ├── babylon
108 │ ├── build
109 │ │ └── XXXX-server-release
110 │ │ ├── Makefile
111 │ │ └── jdk
112 │ │ └── images
113 │ │ └── hotspot
114 │ │ └── ...
115 │ ├── hat
116 │ │ ├── ...
117
118 ```
119 ### Run JTREG Tests
120
121 If we included `jtreg` above we can run the `babylon` code reflection tests using
122
123 ```bash
124 cd ${GITHUB}/babylon
125 make test TEST=jdk_lang_reflect_code
126 ```
127
128 This works because we added:
129
130 ```bash
131 8<-
132 jdk_lang_reflect_code = \
133 java/lang/reflect/code
134 ->8
135 ```
136 To the file `${GITHUB}/babylon/test/jdk/TEST.groups`
137
138 The tests themselves can be found in this directory
139
140 ```bash
141 tree {GITHUB}/babylon}/test/jdk/java/lang/reflect/code
142 ```
143
144 [Next Building HAT](hat-01-03-building-hat.md)