netty / netty-tcnative

A fork of Apache Tomcat Native, based on finagle-native
Apache License 2.0
239 stars 179 forks source link

OpenSSL-Static not linking all libs on Windows #588

Open hyperxpro opened 3 years ago

hyperxpro commented 3 years ago

I tried building OpenSSL-Static with Visual Studio 2019 but I end up 213KB netty_tcnative.dll file and when I load it using System.load(String), I get: Exception in thread "main" java.lang.UnsatisfiedLinkError: ... : Can't find dependent libraries.

Also to build OpenSSL-Static on Windows, I have to add <arg line="Configure VC-WIN64A --prefix=${sslHome} --openssldir=${opensslHome}" /> where opensslHome points to a directory inside target. So this also needs to be fixed in separate PR.

normanmaurer commented 3 years ago

Sorry but we don't currently support these on windows... If you can make it work I am happy to merge a PR tho. For windows we support the openssl-dynamic and boringssl-static libs.

hyperxpro commented 3 years ago
        System.load("D:\\netty-tcnative\\openssl-static\\target\\apr\\bin\\libapr-1.dll");
        System.load("D:\\netty-tcnative\\openssl-static\\target\\ssl\\bin\\libcrypto-1_1-x64.dll");
        System.load("D:\\netty-tcnative\\openssl-static\\target\\ssl\\bin\\libssl-1_1-x64.dll");
        System.load("D:\\netty-tcnative\\openssl-static\\target\\native-build\\target\\x64-release\\lib\\netty_tcnative.dll");

        System.out.println(OpenSsl.isAvailable());
        System.out.println(OpenSsl.versionString());
true
OpenSSL 1.1.1h  22 Sep 2020

It's working but gotta load libraries manually. VS is not linking them together.

normanmaurer commented 3 years ago

Like I said if you get it work I am happy to pull it in but otherwise I can't spent any time on it.