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