-
Notifications
You must be signed in to change notification settings - Fork 108
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
Mingw support (2022-1) #451
base: main
Are you sure you want to change the base?
Mingw support (2022-1) #451
Conversation
Signed-off-by: Schrodinger ZHU Yifan <i@zhuyi.fan>
With MinGW UCRT64 runtime, perf-contention fails with the following stacktrace:
This is only reproducible under debug mode. |
Hi, most of these changes seem to be replacing stdio with iostreams. Can you pull those out into a separate PR? Are those things necessary for MinGW or just cleanups? |
Is it definitely using the |
Signed-off-by: Schrodinger ZHU Yifan <i@zhuyi.fan>
It is needed because mingw's gcc disagrees with |
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.
I think 90% of this PR is unnecessary after the latest refactorings, which should make it more maintainable going forward.
If it actually works, please can you add MinGW to CI as well?
@@ -186,6 +188,10 @@ if (WIN32) | |||
message(STATUS "snmalloc: Avoiding Windows 10 APIs is ${WIN8COMPAT}") | |||
endif() | |||
|
|||
if (MINGW) |
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.
Please can you add a comment explaining what this is needed for (getrandom?)
@@ -15,7 +15,7 @@ using namespace snmalloc; | |||
# define snprintf_l(buf, size, loc, msg, ...) \ | |||
snprintf(buf, size, msg, __VA_ARGS__) | |||
// Windows has it with an underscore prefix | |||
#elif defined(_MSC_VER) | |||
#elif defined(_MSC_VER) || defined(__MINGW32__) |
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 code is gone now, please can you rebase the diff?
@@ -13,7 +13,9 @@ | |||
# define NOMINMAX | |||
# endif | |||
# include <windows.h> | |||
# pragma comment(lib, "bcrypt.lib") | |||
# ifndef __MINGW32__ | |||
# pragma comment(lib, "bcrypt.lib") |
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.
If we're embedding something in the .lib to tell the linker to link bcrypt, then can we make bcrypt a PRIVATE
library rather than an INTERFACE
one in the cmake?
@@ -15,23 +17,23 @@ void check_result(size_t size, size_t align, void* p, int err, bool null) | |||
bool failed = false; | |||
if (errno != err && err != SUCCESS) | |||
{ | |||
printf("Expected error: %d but got %d\n", err, errno); | |||
std::cout << "Expected error: " << err << " but got " << errno << std::endl; |
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.
These have all been replaced with the INFO and EXPECT macros. If there are any other places where they're necessary then please can you use the new formatting infrastructure rather than iostream?
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.
sure!
The old problem was addressed by introducing new way to register clean-up callbacks. However, there are still some works to do.
Signed-off-by: Schrodinger ZHU Yifan i@zhuyi.fan