Sign in Sign up
kretrod/lodestone-cpp Public
Branches
main
PreviewCode52 lines (41 loc) · 1.7 KB Raw
# Building

The output is `build/lodestone_client.dll` (the client, injected into Minecraft)
and `build/lodestone-inject.exe` (the loader). Both are 64-bit Windows binaries,
built with the **mingw-w64 g++** toolchain. You need three things whichever OS
you build on:

1. **mingw-w64 g++** (provides `x86_64-w64-mingw32-g++` and `…-gcc`)
2. **GNU make**
3. **A JDK's `include` directory** — for `jni.h`. Any JDK 17+ works; the client
   targets Minecraft 26.2's JDK 25.

Then point `JAVA_INC` at that JDK include directory and run `make`.

## Windows

Do **not** run `make` from `cmd.exe` with a bare `mkdir`/`rm` — this Makefile
now handles cmd, but the simplest path is one of:

### MSYS2 (recommended)
```
pacman -S mingw-w64-x86_64-toolchain make
```
Open the **MINGW64** shell and, from the project directory:
```
make CXX=g++ CC=gcc OBJDUMP=objdump \
     JAVA_INC="/c/Program Files/Java/jdk-25/include"
```
(In the MINGW64 environment the compiler is simply `g++`.)

### WinLibs + a standalone make, from cmd.exe
Put WinLibs' `bin` on your `PATH` (it ships `x86_64-w64-mingw32-g++.exe`), then:
```
make JAVA_INC="C:/Program Files/Java/jdk-25/include"
```
Use forward slashes in the path even on Windows.

## Linux (cross-compile)

```
sudo apt install g++-mingw-w64-x86-64 make    # Debian/Ubuntu
make JAVA_INC=/path/to/jdk/include
```

## Checking the result

The DLL must depend on **only** `KERNEL32`, `USER32`, `GDI32`, `OPENGL32` and
`msvcrt` — never `libstdc++-6.dll`, or it will fail to inject with "a dependency
is missing". On Linux the build prints this list; anywhere, check it with:
```
x86_64-w64-mingw32-objdump -p build/lodestone_client.dll | grep "DLL Name"
```