whyoleg / cryptography-kotlin

Kotlin Multiplatform cryptography / crypto library
https://whyoleg.github.io/cryptography-kotlin/
Apache License 2.0
285 stars 18 forks source link

Build error on mingwX64 #13

Closed blurkidi closed 7 months ago

blurkidi commented 7 months ago

How to reproduce:

Expected result: Test runs and passes

Actual result: FAILURE: Build failed with an exception.

Comments: I run into the same issue when adding the the lib through a gradle dependency: "implementation("dev.whyoleg.cryptography:cryptography-provider-openssl3-prebuilt-mingwx64:0.2.0")". Think makes cryptography-kotlin unusable on Windows targets. I wanted to further debug the problem before posting the issue, but I don't know where to start from.

whyoleg commented 7 months ago

Hey! Hm, I'm not sure what's going on here (I don't have Windows machine at my side), but on CI with Windows server 2022 (windows 10) everything works fine.

Could you please check dev branch locally and run :cryptography-provider-openssl3-prebuilt:mingwX64ReleaseTest and :cryptography-provider-openssl3-prebuilt:mingwX64Test? There were a lot of changes regarding how openssl is integrated there.

blurkidi commented 7 months ago

Hi, I tried the dev branch and sadly, I had the same result.

I might have a clue though. I realized that the build is successful, but running the test fails, so I tried to run the generated executable (...\bin\mingwX64\debugTest\test.exe) and I get the following error: "The code execution cannot process because zlib1.dll was not found"

It is not much, but that is all I have.

whyoleg commented 7 months ago

Thank you! This is really helpful! Now looks like I understand what's going on: zlib is installed by default everywhere except windows (why am I not surprised?), so looks like for mingw in prebuilt variant we need to link to libz.a statically. On CI it most likely works because zlib is installed there... Not sure now, how I will be able to test the fix without windows machine at my side. Will it be fine for you if I will publish some snapshot versions for you to test If I will not be able to reproduce it on CI somehow?

whyoleg commented 7 months ago

Good news: I was able to reproduce the issue on CI! Good news[2]: I was able to fix the issue. Good news[3]: I was able to setup testing of this issue consistently on CI!

So, when the build will be finished (specifically publish step), will you be able to re-check the fix at your side using the 0.3.0-SNAPSHOT version? For this you will need to additionally add "https://s01.oss.sonatype.org/content/repositories/snapshots/" to repositories. Example is available here https://github.com/whyoleg/cryptography-kotlin?tab=readme-ov-file#using-in-your-projects (under a drop-down)

Stable release (0.3.0, not snapshot) is planned in coming weeks, on current moment it will be hard for me to make a patch release for this...

blurkidi commented 7 months ago

Good news! I just tested '0.3.0-SNAPSHOT' and my tests run perfectly 🎉

Thanks you very much for the fix, and glad I could help (a little 😊)

PS: Kudos for this library! Extremely useful, plus I love your take on Providers that leverage platform specific implementation.

whyoleg commented 7 months ago

Cool! Thanks for testing! And thanks for such great words! I will close the issue after the release of 0.3.0, so you will be notified.

whyoleg commented 7 months ago

0.3.0 is released!