Skip to content

build: various mingw fixes - #9939

Open
simeonschaub wants to merge 3 commits into
Xilinx:masterfrom
simeonschaub:sds/mingw
Open

build: various mingw fixes#9939
simeonschaub wants to merge 3 commits into
Xilinx:masterfrom
simeonschaub:sds/mingw

Conversation

@simeonschaub

Copy link
Copy Markdown
Contributor

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

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>
@xrt-pr-bot

xrt-pr-bot Bot commented Jul 25, 2026

Copy link
Copy Markdown

⚠️ Authorization Failed

@simeonschaub is not a repository collaborator.

To proceed:

  • XRT Admins: Add the build label to authorize this PR build
  • OR Add @simeonschaub as a repository collaborator

@stsoe stsoe left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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>
@xrt-pr-bot

xrt-pr-bot Bot commented Jul 25, 2026

Copy link
Copy Markdown

⚠️ Authorization Failed

@simeonschaub is not a repository collaborator.

To proceed:

  • XRT Admins: Add the build label to authorize this PR build
  • OR Add @simeonschaub as a repository collaborator

@simeonschaub

Copy link
Copy Markdown
Contributor Author

Trace logging conditionals do not seem correct. Explain how common/trace.cpp compiles?

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 src/runtime_src/core/common/detail/windows/trace_init.h, I just noticed I didn't include here. I have dropped it for now from this PR.

Comment thread src/runtime_src/core/common/smi/smi.h Outdated
Comment thread src/runtime_src/core/common/smi/smi.h Outdated
Signed-off-by: Simeon David Schaub <simeon@schaub.rocks>
@xrt-pr-bot

xrt-pr-bot Bot commented Jul 25, 2026

Copy link
Copy Markdown

⚠️ Authorization Failed

@simeonschaub is not a repository collaborator.

To proceed:

  • XRT Admins: Add the build label to authorize this PR build
  • OR Add @simeonschaub as a repository collaborator

Comment on lines +4 to 7
if(NOT MSVC)
add_compile_options(-Wextra -fvisibility=default)
else()
add_compile_options(/wd4244 /wd4267 /wd4477 /wd4245)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reverse, /wd* are MSVC specific

Comment on lines 55 to +69
@@ -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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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?

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.

2 participants