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

Fix: Missing cross compile symbols #5864

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Parad0x84
Copy link

@Parad0x84 Parad0x84 commented Dec 13, 2024

It seems like mingw-w64 doesn't define some symbols like fread_s and _wstat32 when doing cross compile #5843 (comment)

To clarify, I still encounter other errors because some tools required during the build process are being built for the target

system, making them unable to run on the host system 
[ 41%] Built target slang-embed
[ 42%] Generating slang-torch-prelude.h.cpp
/bin/sh: 1: slang-embed: not found

Full commands I used to build (from a fresh install of ubuntu 24.04)

sudo apt install mingw-w64
sudo snap install cmake --classic
git clone --recurse-submodules https://github.com/Parad0x84/slang.git cd slang
cmake -B build/ -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=./cmake/cross-windows-x86_64.cmake cmake --build build/ --config Release

@Parad0x84 Parad0x84 requested a review from a team as a code owner December 13, 2024 21:11
@CLAassistant
Copy link

CLAassistant commented Dec 13, 2024

CLA assistant check
All committers have signed the CLA.

set(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)

# Slang specific
set(SLANG_LIB_TYPE STATIC)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are we setting static library as default?

Copy link
Author

Choose a reason for hiding this comment

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

The toolchain file is only intended for an easy way to reproduce same build, not intended for merging. You can ignore that file. This is Work in Progress anyways. I'm not expecting to merge as is. Open to ideas

@Parad0x84
Copy link
Author

Fixed formatting issue.
By the way, I didn't know I should label PR about breaking or not. This change shouldn't be breaking unless you are using mingw on windows and targeting windows. Shouldn't be a common use case (I'm open to ideas on that)

@Parad0x84 Parad0x84 requested a review from csyonghe December 14, 2024 20:51
It seems like mingw-w64 doesn't define some symbols like `fread_s` and `_wstat32` when doing cross compile
shader-slang#5843 (comment)

To clarify, I still encounter other errors because some tools required during the build process are being built for the target system, making them unable to run on the host system
"
[ 41%] Built target slang-embed
[ 42%] Generating slang-torch-prelude.h.cpp
/bin/sh: 1: slang-embed: not found
"

Full commands I used to build (from a fresh install of ubuntu 24.04)
"
sudo apt install mingw-w64
sudo snap install cmake --classic
git clone --recurse-submodules https://github.com/Parad0x84/slang.git
cd slang
cmake -B build/ -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=./cmake/cross-windows-x86_64.cmake
cmake --build build/ --config Release
"
@csyonghe csyonghe added the pr: non-breaking PRs without breaking changes label Dec 18, 2024
Copy link
Collaborator

@csyonghe csyonghe left a comment

Choose a reason for hiding this comment

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

Looks good to me!

Copy link
Collaborator

@expipiplus1 expipiplus1 left a comment

Choose a reason for hiding this comment

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

Would you be able to either remove the toolchain file, or mention it in a comment and in building.md that it's intended as an example config and isn't officially supported.

FWIW I didn't need to make the other changes when I built with mingw, but I can look at that when I next go down that path, so if this helps you then happy to merge

@Parad0x84
Copy link
Author

Parad0x84 commented Dec 19, 2024

Would you be able to either remove the toolchain file, or mention it in a comment and in building.md that it's intended as an example config and isn't officially supported.

FWIW I didn't need to make the other changes when I built with mingw, but I can look at that when I next go down that path, so if this helps you then happy to merge

Please read this commit message, if you didn't yet: Parad0x84@f25f9ea
Are you sure you aren't getting same missing symbols issue when cross compiling from linux to windows?

This PR is not useful as-is. Currently slang-embed can't run at build time, since when cross compiling, it gets built for windows (target) and not for linux (host). If we decide on how to move forward solving this issue, I'm happy to implement it (if I can).
Please take a look at this: #5843 (comment)

Note: I also could do the requested changes, if you wanna just merge this as is. But as I said, currently this PR doesn't achieve anything meaningful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: non-breaking PRs without breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants