Thanks to @nmittler on gRPC + SSL = UnsatisfiedLinkError I've got gRPC + SSL working on my Windows PC and on the target Linux platform.
But only when I specify a <classifier>
for the io.netty/netty-tcnative-boringssl-static/1.1.33.Fork17
dependency. That can be:
- hard-coded (e.g. to
windows-x86_64
) - injected using os-maven-plugin and
${os.detected.classifier}
But that means I can only run on:
- Windows (or whichever platform I hard-code)
- the platform I used to compile
But what I'd really like to be able to do is compile on Windows but run on Linux. So, in theory, I can just leave off the <classifier>
to bring in the uber-jar (as specified in the docs).
But this doesn't work: when I step through io.netty.util.internal.NativeLibraryLoader.load()
I find a call to System.mapLibraryName()
.
- On Windows this correctly returns
netty-tcnative.dll
. - But on Linux (RHEL 7) it returns
libnetty-tcnative.so
... which isn't in the uber-jar (jar tf netty-tcnative-boringssl-static-1.1.33.Fork17.jar
returns, among others,META-INF/native/libnetty-tcnative-linux-x86_64.so
).
Looking at the classified linux version of the jar I can see it contains META-INF/native/libnetty-tcnative.so
... which implies either the uber jar needs to be built differently (to rename libnetty-tcnative-linux-x86_64.so
to libnetty-tcnative.so
) or NativeLibraryLoader
somewhere needs to take account of the different naming...
Am I on the right track? Can someone help fix this?