-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable build on Windows #1
Comments
@christianpaquin Maven build instructions "almost" work. When I do
I'm getting a Maven crash when trying to compile the unit tests: INFO] ------------------------------------------------------- [WARNING] Corrupted STDOUT by directly writing to native stream in forked JVM 1. See FAQ web page and the dump file C:\Users\vsoft\Documents\GitHub\liboqs-java\target\surefire-reports\2020-04-22T16-34-01_279-jvmRun1.dumpstream |
@christianpaquin Also when trying to run the examples, I can compile fine, e.g.
works fine, but running with
produces
|
@vsoftco If you compile with
Does the compile command generate a It seems that the class separator for the classpath in Windows is
|
@jimouris Yes, without testing is fine. I think it's a maven/jdk issue. However, for the examples, you were right, now they run, but on my side crash after the printing the enabled/supported KEMs/Sigs:
|
Okay, so compilation works for Windows. Most likely, the error that you face when you build (with tests) is a similar crash to the above that you mentioned that happens when maven runs the tests. I haven't seen this error before. I'll have to find out a way to replicate this error on Ubuntu and then I'll try to resolve it. |
The same problem exists on Mac as well (but not on Ubuntu). It seems that the crash occurs in the native code when it calls OQS_KEM_keypair. I checked all three parameters and both the public and the private key have been allocated properly and their lengths are correct ( I'll look more into it. |
I was able to resolve the issue on Mac by updating liboqs and installing it again. I probably had an older version. I am not sure what may have caused that issue but it now works for me. @vsoftco Can you try to pull and update liboqs to see if it works as well? |
On my Mac it worked fine, just the Windows had issues. Just pull it and compiled liboqs, however the rand API changed slightly, and cannot link so you'd need to alter the corresponding line in the wrapper. |
Still crashing when building unit tests (build liboqs alone fine), and unfortunately still crashing KEM and Sigs. Rand works (prints the NIST-KAT) but complains it cannot switch to OpenSSL (disable this under Windows, as we don't support it). Under Mac and Linux it works fine. |
OK, I finally have some bandwidth to test the Windows maven build. I'm not getting as far, @vsoftco: when trying to build the windows package (
I get an error that
Anything obvious to you? |
I didn't have a chance to setup OQS in Windows yet. We haven't defined different native compilers in If that works, I can define different compilers for different OSes in the profiles section like it is for the shared jni library. |
Oh, I see. There are a few more things to tweak, as the Windows compiler options are not the same as gcc. I'm curious how @vsoftco packaged the wrapper on Windows. |
@christianpaquin Sorry I missed somehow the notification... I had MSYS2 installed and gcc was in the path, so most likely that's how the gcc was invoked. |
Pushing to next version. |
Quick question: Does anyone presently work on this? I'd otherwise try to see how an AWS-Windows instance could aid me in giving this a shot... |
@baentsch I am not either but would be happy to help if you run into any issues/questions with the code. |
The problems I ran into were of the "Windows" sort: I just don't know enough about the tooling on that platform (and have not used maven in a long time -- and never the mojo plugin). Whatever: After replacing
--> It seems the native build plugin doesn't detect that it's supposed to operate a MSVC compiler and use |
PS: For anyone interested: This is now set up for "development" in an AWS Windows instance. Those of us without a local Win machine/VM could actually jointly use/share this to "trial" things on Windows: Anyone interested? We'd need to share a password for RDP access. OK for this purpose? |
It seems that the native plugin supports compiler/linker options and they mention I think that we need to overwrite the compiler executable here from gcc to msvc. If that works we can add a compiler-property to use either gcc or msvc depending on the OS. |
That's what I did (and meant to say with "After replacing gcc with cl"); hence we see |
I think the issue is that in the pom.xml file I have specified <compilerProvider>generic-classic</compilerProvider>
<compilerExecutable>gcc</compilerExecutable> Changing the second line ( <compilerProvider>msvc</compilerProvider> The plugin changed
(running the above on linux just to test the plugin options) |
This indeed creates proper object files -- but then the linking fails completely: It looks like the linker takes the JAR file as target instead of the shared library:
To get there I changed the
Maybe time to read the full maven documentation alongside the one for MSVC... |
Can you re-run Maven with -e and -X switch to get full stack trace and debug output, @baentsch? Also, the following properties in the windows profile look wrong:
I don't know if they cause the linking errors you are seeing. |
Completely agree. But I'm running maven like the below (overruling these settings, I'd think):
Thanks for checking and for the suggestion. Shows clearly that the jar and not the dll is link target: So clearly no linker problem, but a maven config issue: Any idea, @jimouris ? Also attached the complete pom.xml: |
I made a few changes and pushed to a new In your log,
it doesn't seem to include ${liboqs.lib.dir} at all. I think the correct flag is Also, it adds the In the windows branch in the |
Hi. I am running windows 11 here, but without MSVC. Do you guys think it's feasible to use some gcc-based compiler (mingw) or even consider providing the windows binary? If there's something I can do to help, pls let me know. |
Can you get it to work with mingw? If so, you can document how or explain what we would need to change. |
I finally got it working in windows but it did require a bunch of updates to the POM file. If you like I could submit a fix for this. |
That would be very welcome! |
Working POM file: Directions:
Here is a tested POM file (Test by two people at Entrust with Visual Studio 2019). |
Hi @democuritus, I'm having trouble understanding what's going on based on the screenshot provided above. If you have a bug report, please open a new issue or discussion and provide more details about your setup and what you're trying to do. |
It seems completely impossible to integrate the liboq library into my JAVA project on Windows |
thaks you very much for responding my question! Here is my process of compiling and packaging. |
I'm afraid I'm not very knowledgeable about either Windows or Java, but I'll try to help. Two questions:
|
Moreover, under Windows, Maven and Mingw seem to encounter compilation errors when generating DLLs and JARs. This is the only method I have explored that can generate these target files.I use:
to import these files into my springbootproject, then had written a test class,here is my source code:
} |
Thank you very much for your reply, I am using liboqs C library version 0.11.0, and liboqs-java version 0.1.0 |
I'm afraid that this goes beyond my knowledge of either Windows or Java. I did confirm (using Ubuntu 24 / OpenJDK 11) that liboqs-java can create a MAYO-3 signature (using the name "MAYO-3", not "mayo_3"—the latter leads to an exception). This project is also not officially supported for Windows. I'd suggest you try the instructions and pom file above if you haven't already. |
thanks you for confriming, this information is important. that means my jar and oqs.dll have no problem? I will try newer java version.
…---Original---
From: "Spencer ***@***.***>
Date: Sat, Oct 19, 2024 03:32 AM
To: ***@***.***>;
Cc: ***@***.******@***.***>;
Subject: Re: [open-quantum-safe/liboqs-java] Enable build on Windows (#1)
I'm afraid that this goes beyond my knowledge of either Windows or Java. I did confirm (using Ubuntu 24 / OpenJDK 11) that liboqs-java can create a MAYO-3 signature (using the name "MAYO-3", not "mayo_3"—the latter leads to an exception).
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
hi @johngray-dev I don't know whether my oqs.dll,oqs-jni.dll,oqs-java.jar is generated correctly. handle.c KEMs.c KeyEncapsulation.c Rand.c Signature.c Sigs.c 正在创建库 D:\liboqs-java-master\target\oqs-jni.lib 和对象 D:\liboqs-java-master\target\oqs-jni.exp |
|
I am trying to deploy the project for my thesis, but it isn't working. I only need a JAR file to use the post-quantum algorithms. |
This guide looks very helpful, especially since Windows builds are a common pain point. Would there be plans to merge this POM file and build instructions into the master branch? It could help many developers who face similar Windows build challenges. |
you can try the zip under my comment,and get according deplory to adopt your private computer.that dll and jar is tested working
…---Original---
From: ***@***.***>
Date: Wed, Oct 23, 2024 06:38 AM
To: ***@***.***>;
Cc: ***@***.******@***.***>;
Subject: Re: [open-quantum-safe/liboqs-java] Enable build on Windows (#1)
I am trying to deploy the project for my thesis, but it isn't working. I only need a JAR file to use the post-quantum algorithms.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
I've found a solution to build liboqs-java on Windows and created a working demo project. Here are the details:
Please note that while this solution works well across Linux/macOS/Windows, it may not be suitable for merging into the main branch since it uses static libraries (.a) instead of dynamic libraries. However, if anyone is interested in building and running liboqs-java on Windows, feel free to check out my repository for a working implementation. |
Thanks for your work and this report @AdijeShen !
Why do you think so? Building |
Thank you for clarifying that liboqs static builds are supported - I'll prepare the necessary changes and documentation for PR. |
The Makefile needs to be rewritten for Windows.
The text was updated successfully, but these errors were encountered: