-
Notifications
You must be signed in to change notification settings - Fork 95
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
Fix OQS_ADDL_SOCKET_LIBS setting for cmake #256
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes the cmake flag so it generates the right lib dependencies for msvc build. Otherwise, ths VS would complain about: LINK : fatal error LNK1104: cannot open file 'ws2_32.lib gdi32.lib crypt32.lib'
Thanks for this contribution! Just one question: Why did VS CI tests pass even without this PR (separating the libs by " ")? Can you point to some documentation requiring the ";"as per this improvement? I'm approving as I don't have any real experience with VS development and assume you do have more.
I did search the cmake doc and found out a more conventional way to fix the issues. The problem is probably caused by the string in set(OQS_ADDL_SOCKET_LIBS "ws2_32.lib gdi32.lib crypt32.lib") The previous code forced cmake into thinking the three libraries as a whole. The later as below followed the cmake normal syntax (recommended). set(OQS_ADDL_SOCKET_LIBS ws2_32.lib gdi32.lib crypt32.lib) About "Why did VS CI tests pass even without this PR": cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="/wd5105" -S . -B _build |
Understood. What about adding a CI job for this then as part of this PR, too? This way we can be sure this never happens again. |
I tried to add a CI job but encountered a several problems: Issues 1: If liboqs is built with Windows 2019 (shipped only with latest Visual Studio version 16), it would failed and the CI raw output as below:
Issues 2: Change to Visual Studio version 16/MSVC 19 solved the first issue. The liboqs pass the build but if I run the follow test code:
All the tests failed. But I also solved the issue 2. Issue 3: When CI run tests for oqs-provider, CTest reports no tests found without -C on multi-config generators. Original command
As cmake issue point out, we need to add args "-C Debug" or "-C Release" accordingly in the build tree with a VS generator. Issue 4: Even if I called "ctest -V --test-dir _build", ctest still cannot pass. Conclusion: |
Please let me know when I should take another look. |
Superceded/replaced by #263 |
This fixes the cmake flag so it generates the right lib dependencies for msvc build. Otherwise, ths VS would complain about:
LINK : fatal error LNK1104: cannot open file 'ws2_32.lib gdi32.lib crypt32.lib'