Skip to content

Commit 051382a

Browse files
committed
Espresso: Add jvm-ce-llvm on Darwin section to hacking.md
1 parent 67b0b2b commit 051382a

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

espresso/docs/hacking.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ $ cd ../vm
8282
$ mx --dy /espresso,/sulong maven-deploy --tags=public --all-suites --all-distribution-types --version-suite=sdk --suppress-javadoc
8383
```
8484

85-
You can now depend on the jars using a version like `24.2.0-SNAPSHOT`.
85+
You can now depend on the jars using a version like `24.2.1-SNAPSHOT`.
8686

8787
## `mx espresso-embedded ...`
8888

@@ -113,12 +113,43 @@ $ mx espresso --java.JavaHome=/path/to/java/11/home -version
113113

114114
## Limitations
115115

116+
### Linux
117+
116118
Espresso relies on glibc's [dlmopen](https://man7.org/linux/man-pages/man3/dlopen.3.html) to run on HotSpot, but this approach has limitations that lead to crashes e.g. `libnio.so: undefined symbol: fstatat64` . Some of these limitations can be by avoided by defining `LD_DEBUG=unused` e.g.
117119

118120
```bash
119121
$ LD_DEBUG=unused mx espresso -cp mxbuild/dists/jdk1.8/espresso-playground.jar com.oracle.truffle.espresso.playground.Tetris
120122
```
121123

124+
### macOS
125+
126+
On macOS there is nothing like `dlmopen` available, therefore `jvm-ce` does not work. However, there is another mode available where libraries can be executed via Sulong (internally called `nfi-llvm`). This requires the OpenJDK libraries to be compiled with the Sulong toolchain, such builds are available through `mx fetch-jdk` with a `-llvm` suffix. Unfortunately this mode is only supported on `darwin-amd64`, so on an Apple Silicon machine the `x86_64` emulator Rosetta 2 must be used:
127+
128+
```bash
129+
$ arch -arch x86_64 zsh
130+
131+
$ export MX_PYTHON=`xcode-select -p`/usr/bin/python3
132+
$ file $MX_PTYHON
133+
/Applications/Xcode16.2.app/Contents/Developer/usr/bin/python3: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64:Mach-O 64-bit executable arm64]
134+
/Applications/Xcode16.2.app/Contents/Developer/usr/bin/python3 (for architecture x86_64): Mach-O 64-bit executable x86_64
135+
/Applications/Xcode16.2.app/Contents/Developer/usr/bin/python3 (for architecture arm64): Mach-O 64-bit executable arm64
136+
137+
$ # the important part above is that there is also a Mach-O included for x86_64
138+
139+
$ cd $graal/espresso
140+
$ mx fetch-jdk # fetch JDK latest, 21 and 21-llvm
141+
142+
$ export ESPRESSO_JAVA_HOME=<JDK21 path for amd64>
143+
$ export LLVM_JAVA_HOME=<JDK21-llvm path for amd64>
144+
$ export JAVA_HOME=<JDK-latest path for amd64>
145+
146+
$ # Note: ESPRESSO_JAVA_HOME and LLVM_JAVA_HOME must match regarding version.
147+
148+
$ mx --env jvm-ce-llvm build
149+
150+
```
151+
152+
122153
## _Espressoⁿ_ Java-ception
123154

124155
Espresso can run itself. **Self-hosting requires a Linux distribution with an up-to-date glibc.**

0 commit comments

Comments
 (0)