Skip to content

Add GraalVM native-image metadata for tcnative#992

Open
emilienbev wants to merge 1 commit into
netty:mainfrom
emilienbev:AddNativeConfig
Open

Add GraalVM native-image metadata for tcnative#992
emilienbev wants to merge 1 commit into
netty:mainfrom
emilienbev:AddNativeConfig

Conversation

@emilienbev

@emilienbev emilienbev commented Jul 23, 2026

Copy link
Copy Markdown

Motivation

Note: the follow-up PR to this one is netty/netty#17131

OpenSsl.isAvailable() returns true on the JVM but false in a GraalVM native image (netty/netty#11088), so apps silently fall back to the JDK SSL provider.

netty-tcnative ships no META-INF/native-image metadata, so the native library never gets embedded, the JNI classes go unregistered, and the tcnative classes initialize at build time instead of runtime. Shipping the metadata in the artifacts keeps it version-matched out of the box.

Modifications

Added native-image metadata across the tcnative artifacts:

  • netty-tcnative-classes:

    • native-image.properties: initializes io.netty.internal.tcnative classes at runtime.
    • jni-config.json: registers all tcnative classes for JNI, plus the standard Java types native code creates or throws.
    • reflect-config.json: mirrors the reflection registration for tcnative classes.
  • netty-tcnative-boringssl-static:

    • resource-config.json: embeds the native binaries (.so, .jnilib, .dll) so NativeLibraryLoader can extract and load them at runtime.

Result

OpenSsl.isAvailable() now returns true inside native images, and BoringSSL loads without issues. Tested alongside the companion Netty PR on Mandrel 25.0.1 (macOS aarch64).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant