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