Skip to content

Commit 8de50d7

Browse files
James Roomeclaude
andcommitted
0.0.6: load Slang's companion libraries from the pinned payload
Ships the fix in 11fbc06: on Windows, slang-glslang (which backs the glslang, spirv-dis and spirv-opt downstream compilers) was loadable only if the host happened to have a Slang install or the Vulkan SDK on PATH, so SPIRV_ASM and friends failed with "failed to load dynamic library 'slang-glslang'" for anyone consuming the natives artifact normally. Record it in the §13 risk table, and bump the coordinates in README. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 11fbc06 commit 8de50d7

3 files changed

Lines changed: 10 additions & 9 deletions

File tree

‎DESIGN.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,7 @@ libclang-based — regex parsing is fine for a survey, not for slot-perfect code
532532
| Preview-classfile lock-in | — | Policy §10: preview never ships in published jars |
533533
| macOS Gatekeeper on extracted dylibs | Low | Byte-exact extraction preserves notarized signatures; JVM writes carry no quarantine attr; CI runs on clean macOS runners to catch regressions |
534534
| Large natives (slang-llvm ~100 MB) bloating downloads | Resolved | slang-llvm excluded from the payload (out-of-scope CPU targets only); natives jars are ~16–21 MB. A separate opt-in llvm artifact can be added if host-callable targets are ever wanted. |
535+
| Slang's companion libraries (`slang-glslang`) not loadable from the payload on Windows | *resolved in 0.0.6* | Slang loads companions lazily and **by bare name**, which Windows resolves against the executable's directory, the system directories, the CWD and PATH — never against `slang-compiler.dll`'s own directory, and there is no `RPATH=$ORIGIN` to stand in for it (the macOS/Linux payloads have one, so they were never affected). A payload shipping `slang-glslang.dll` beside the compiler therefore still failed `SPIRV_ASM` / `spirv-opt` / `spirv-dis` / GLSL pass-through with `failed to load dynamic library 'slang-glslang'` unless the host happened to have a Slang install or the Vulkan SDK on PATH — which is exactly why it passed on a dev box and failed only on the Windows CI job, silently reading a *host* library instead of the pinned one. `IGlobalSession.create` now calls `setDownstreamCompilerPath` for the glslang-backed pass-throughs with `SlangLibrary.directory()`: the load stays lazy, and the pinned payload comes ahead of the host on every platform — the pinning §7's class-path case already promised. Reproduce a clean host by stripping Vulkan/Slang from PATH before running the suite. |
535536
| Serialized module IR from another Slang release **aborts the process** | *resolved in 0.0.5* | `loadModuleFromIRBlob` does not fail — it calls `abort()` (Windows exit `0xC0000409`, no `hs_err`, no diagnostic), so a mismatch cannot be caught, only prevented. `Session.loadModuleFromIr` therefore pre-checks with `slang_loadModuleInfoFromIRBlob` (safe on exactly that IR) and throws `SlangCompileException` instead, per `ModuleIrCompatibilityTest`. The predicate is `ModuleInfo.moduleVersion() == GlobalSession.supportedModuleVersion()`, i.e. the **module** version, not the compiler version — two releases emitting the same module version interoperate. `supportedModuleVersion()` is observed by round-tripping a trivial module because Slang exposes the real range only through `slangc -get-supported-module-versions` (`CompilerOptionName.GetSupportedModuleVersions` has no C export), so a build that also reads *older* versions is treated conservatively: the cost is a needless source recompile, against a silent process kill. Worth revisiting if Slang ever exports the range. |
536537

537538
## 14. Prior art

‎README.md‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ directly. Windows, macOS, and Linux, on x86_64 and aarch64. Requires JDK 25+.
1515

1616
| Artifact | Purpose |
1717
|--------------------------------------------------------|---|
18-
| `io.github.refux:slang-java:0.0.5` | The library: compiler API, reflection, Java file systems |
19-
| `io.github.refux:slang-java-natives:0.0.5:<os>-<arch>` | The official Slang binaries, as one classifier per platform: `windows`, `linux`, or `macos` × `x86_64` or `aarch64` |
18+
| `io.github.refux:slang-java:0.0.6` | The library: compiler API, reflection, Java file systems |
19+
| `io.github.refux:slang-java-natives:0.0.6:<os>-<arch>` | The official Slang binaries, as one classifier per platform: `windows`, `linux`, or `macos` × `x86_64` or `aarch64` |
2020

2121
## Getting started
2222

@@ -34,8 +34,8 @@ val slangNatives = "${
3434
}-${if (System.getProperty("os.arch") in listOf("aarch64", "arm64")) "aarch64" else "x86_64"}"
3535

3636
dependencies {
37-
implementation("io.github.refux:slang-java:0.0.5")
38-
runtimeOnly("io.github.refux:slang-java-natives:0.0.5:$slangNatives")
37+
implementation("io.github.refux:slang-java:0.0.6")
38+
runtimeOnly("io.github.refux:slang-java-natives:0.0.6:$slangNatives")
3939
}
4040

4141
tasks.withType<JavaExec> {
@@ -48,10 +48,10 @@ classpath together and the loader picks the host's at runtime (LWJGL-style):
4848

4949
```kotlin
5050
dependencies {
51-
implementation("io.github.refux:slang-java:0.0.5")
52-
runtimeOnly("io.github.refux:slang-java-natives:0.0.5:macos-aarch64")
53-
runtimeOnly("io.github.refux:slang-java-natives:0.0.5:windows-x86_64")
54-
runtimeOnly("io.github.refux:slang-java-natives:0.0.5:linux-x86_64")
51+
implementation("io.github.refux:slang-java:0.0.6")
52+
runtimeOnly("io.github.refux:slang-java-natives:0.0.6:macos-aarch64")
53+
runtimeOnly("io.github.refux:slang-java-natives:0.0.6:windows-x86_64")
54+
runtimeOnly("io.github.refux:slang-java-natives:0.0.6:linux-x86_64")
5555
}
5656
```
5757

‎gradle.properties‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ org.gradle.caching=true
44
# Single source of truth for the published version (library + natives artifacts).
55
# Release tags must match: tag v0.0.1 <-> version=0.0.1.
66
group=io.github.refux
7-
version=0.0.5
7+
version=0.0.6

0 commit comments

Comments
 (0)