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