Skip to content
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

set(OQS_USE_PTHREADS OFF) on MinGW/Cygwin #1695

Merged
merged 1 commit into from
Feb 12, 2024

Conversation

zxjtan
Copy link
Contributor

@zxjtan zxjtan commented Feb 12, 2024

Fixes #1693.
Looks like if cross-compiling from POSIX to Windows, the CMake detect pthreads as available on the host and sets OQS_USE_PTHREADS ON for compilation, which will not work on windows.

Copy link
Member

@baentsch baentsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick fix, @zxjtan ! Would it be OK for you to try adding a cross-build job to CI so this doesn't occur again, e.g., here? Edit/Add: No problem if that's not so straightforward for you; will do a separate PR otherwise.

@zxjtan
Copy link
Contributor Author

zxjtan commented Feb 12, 2024

Thanks for the quick fix, @zxjtan ! Would it be OK for you to try adding a cross-build job to CI so this doesn't occur again, e.g., here? Edit/Add: No problem if that's not so straightforward for you; will do a separate PR otherwise.

Looks easy enough if there is a container that installs gcc-mingw-w64, but there does not seem to be one.

@SWilson4
Copy link
Member

SWilson4 commented Feb 12, 2024

This seems to fix the pthread linking issue, but in turn another issue appears (at least for me, running in our Focal Docker container). Running

cmake -GNinja -DCMAKE_TOOLCHAIN_FILE=../.CMake/toolchain_windows-amd64.cmake -DOQS_DIST_BUILD=ON -DBUILD_SHARED_LIBS=ON .. && ninja

leads to further linking errors, this time seemingly to do with our internal API :(

However, this change does make the build pass with -DOQS_BUILD_ONLY_LIB=ON set, so it certainly moves the ball down the field. I suggest that we merge this as-is. I can investigate the internal API linking issue (they're probably due to my work) and add the CI test in the PR to address that issue. How does that sound @baentsch @zxjtan ?

@zxjtan
Copy link
Contributor Author

zxjtan commented Feb 12, 2024

@SWilson4 If the Focal container is ci-ubuntu-focal-x86_64, gcc-mingw-w64 is not in the install command. Could that be the cause of a problem?

@zxjtan zxjtan marked this pull request as ready for review February 12, 2024 16:07
@zxjtan zxjtan requested a review from dstebila as a code owner February 12, 2024 16:07
Copy link
Member

@baentsch baentsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per discussion. Adding cross-build CI in a separate PR.

@SWilson4
Copy link
Member

@SWilson4 If the Focal container is ci-ubuntu-focal-x86_64, gcc-mingw-w64 is not in the install command. Could that be the cause of a problem?

I don't think so; I'm using a container based on that one on my local machine, and I installed gcc-mingw-w64 via apt.

@baentsch baentsch merged commit f371848 into open-quantum-safe:main Feb 12, 2024
34 checks passed
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.

Crosscompilation from linux to windows fails
3 participants