build: various mingw fixes - #9939
Conversation
These were needed in order to cross-compile for windows in JuliaPackaging/Yggdrasil#14225. There were some additional patches in that PR, but I excluded the more controversial/hacky fixes for now. Some of the patches were written with help from Claude, but verified and reviewed one-by-one. Signed-off-by: Simeon David Schaub <simeon@schaub.rocks>
|
@simeonschaub is not a repository collaborator. To proceed:
|
stsoe
left a comment
There was a problem hiding this comment.
Trace logging conditionals do not seem correct. Explain how common/trace.cpp compiles?
Please separate trace changes into its own PR.
Thanks!
Signed-off-by: Simeon David Schaub <simeon@schaub.rocks>
|
@simeonschaub is not a repository collaborator. To proceed:
|
That particular patch came from a previous Ygddrasil build, so I must admit I am not familiar with the exact details behind it. I did confirm that the cross build fails without that patch, though it did include a very similar change to |
Signed-off-by: Simeon David Schaub <simeon@schaub.rocks>
|
@simeonschaub is not a repository collaborator. To proceed:
|
| if(NOT MSVC) | ||
| add_compile_options(-Wextra -fvisibility=default) | ||
| else() | ||
| add_compile_options(/wd4244 /wd4267 /wd4477 /wd4245) |
There was a problem hiding this comment.
Reverse, /wd* are MSVC specific
| @@ -62,6 +63,10 @@ getenv(const char* name) | |||
| // Use unique_ptr to ensure memory is freed even if string constructor throws | |||
| std::unique_ptr<char, decltype(&std::free)> guard(value, &std::free); | |||
| return std::string(guard.get()); | |||
| #else | |||
| const char* value = std::getenv(name); | |||
| return value ? std::string(value) : std::string{}; | |||
| #endif | |||
There was a problem hiding this comment.
It's not clear that these changes check for MinGW, please adjust, e.g. maybe #ifdef __MINGW32__ / #else .
Also changes seem a little haphazardly, for example, I don't believe strerror_s works with MinGW, so why wasn't this fixed? Is this PR even needed, it is a concerted effort to build XRT with MinGW, or is just change a little here and there?
These were needed in order to cross-compile for windows in JuliaPackaging/Yggdrasil#14225. There were some additional patches in that PR, but I excluded the more controversial/hacky fixes for now. Some of the patches were written with help from Claude, but verified and reviewed one-by-one.
Signed-off-by: Simeon David Schaub simeon@schaub.rocks