Skip to content

shader-slang: fix LLVM build#436961

Closed
samestep wants to merge 2 commits intoNixOS:masterfrom
samestep:shader-slang-fix-llvm-build
Closed

shader-slang: fix LLVM build#436961
samestep wants to merge 2 commits intoNixOS:masterfrom
samestep:shader-slang-fix-llvm-build

Conversation

@samestep
Copy link
Contributor

While reviewing #435962, I forgot that this fix is necessary when using withLLVM, due to shader-slang/slang#8031.

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

@samestep samestep requested a review from niklaskorz August 26, 2025 00:54
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Aug 26, 2025
This uses libllvm instead of the environment's compiler for compiling
shaders to CPU targets.
@niklaskorz
Copy link
Member

niklaskorz commented Aug 26, 2025

Added shader-slang-llvm which sets withLLVM = true; so this gets catched by nixpkgs-review and built by hydra in the future. However, I came to realize that the final binaries and libraries do not seem to link to LLVM anymore when withLLVM = true;. I'm pretty sure this used to be different when I originally created this package, so we should try to figure out what's going on here before merging (to make LLVM support actually work).

In the shader-slang repository, only slang-test seems to explicitly link against slang-llvm. How is LLVM mode supposed to work? As libslang-llvm.so also does not seem to be loaded at runtime by libslang or slangc, only by slang-test.

@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. and removed 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Aug 26, 2025
@samestep
Copy link
Contributor Author

@niklaskorz yeah actually, as far as I'm aware, Slang pretty much only uses LLVM for FileCheck in testing. I'm not aware of any uses of LLVM in Slang other than testing (although I could be wrong).

In that case do you think we should maybe just remove LLVM from Slang in Nixpkgs?

@samestep
Copy link
Contributor Author

OK never mind, I was incorrect; I asked Yong and he said:

Slang-llvm also provides the clang-llvm backend to generate code from c++ source without going through a system c++ compiler.

So it seems like slang-llvm is indeed not meant to be used by libslang or slangc, but the intention is that others can link against lib/libslang-llvm.so if they want.

@niklaskorz I don't see lib/libslang-llvm.so in the shader-slang-llvm package when I build it though; do you know why?

@niklaskorz
Copy link
Member

So it seems like slang-llvm is indeed not meant to be used by libslang or slangc, but the intention is that others can link against lib/libslang-llvm.so if they want.

@niklaskorz I don't see lib/libslang-llvm.so in the shader-slang-llvm package when I build it though; do you know why?

I see, in that case it might be best to always build it and move it to a separate output llvm (so instead of having a package shader-slang-llvm, it would be accessed as shader-slang.llvm).

As for why the library is missing from the output, that is because the target is missing the INSTALL property. We could patch it in manually if not installing the library is intended by upstream.

@samestep samestep mentioned this pull request Aug 27, 2025
13 tasks
@samestep
Copy link
Contributor Author

Superseded by #437524.

@samestep samestep closed this Aug 27, 2025
@samestep samestep deleted the shader-slang-fix-llvm-build branch August 27, 2025 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants