Skip to content

Conversation

@rkoser-nv
Copy link
Contributor

Add the packages required for prebuilt LLVM to LD_LIBRARY_PATH.

Also, switch from stdenvNoCC to a proper clang/llvm stdenv.

@rkoser-nv rkoser-nv requested a review from a team as a code owner December 19, 2025 20:20
@CLAassistant
Copy link

CLAassistant commented Dec 19, 2025

CLA assistant check
All committers have signed the CLA.

@rkoser-nv rkoser-nv added the pr: non-breaking PRs without breaking changes label Dec 19, 2025
Copy link
Contributor

@samestep samestep left a comment

Choose a reason for hiding this comment

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

Thanks for these fixes! I haven't tested them yet, but I did have one request in the meantime.

Add the packages required for prebuilt LLVM to LD_LIBRARY_PATH.

Also, switch from `stdenvNoCC` to a proper clang/llvm stdenv.
Also rewrites the comments around our slicing of llvmPackages
to explain exactly what each slice is for.
@rkoser-nv
Copy link
Contributor Author

The clang/clangd interaction is upsetting and subtle. I broke it before, but it should be fixed with the latest commit.

Copy link
Contributor

@samestep samestep left a comment

Choose a reason for hiding this comment

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

Wow, this does indeed look subtle... thank you for figuring this all out!

@samestep
Copy link
Contributor

samestep commented Dec 30, 2025

@rkoser-nv since you mentioned that this PR is meant to add support for prebuilt LLVM, do you have a particular (set of) build command(s) I can run in the Nix dev shell before and after this PR to see what specifically didn't work before but does now?

For instance, just running this command doesn't seem to work:

cmake --preset default -DSLANG_SLANG_LLVM_FLAVOR=USE_SYSTEM_LLVM

That is, on both commit 671b391 and commit 5674b1b, I get the same error:

CMake Error at cmake/LLVM.cmake:41 (find_package):
  Could not find a package configuration file provided by "LLVM" (requested
  version 21.1) with any of the following names:

    LLVMConfig.cmake
    llvm-config.cmake

  Add the installation prefix of "LLVM" to CMAKE_PREFIX_PATH or set
  "LLVM_DIR" to a directory containing one of the above files.  If "LLVM"
  provides a separate development package or SDK, be sure it has been
  installed.
Call Stack (most recent call first):
  CMakeLists.txt:494 (fetch_or_build_slang_llvm)

@rkoser-nv
Copy link
Contributor Author

This fixes the downloaded LLVM binaries used by slang-test. Without the LD_LIBRARY_PATH changes, slang-test fails to load libslang-llvm.so so all the tests that rely on FileCheck are ignored:

IFileCheck* fc = context.getFileCheck();
if (!fc)
{
// Ignore if FileCheck is not available.
// We could report an error, but our ARM64 CI doesn't have FileCheck yet.
testReporter.message(TestMessageType::Info, "FileCheck is not available");
return TestResult::Ignored;
}

@samestep
Copy link
Contributor

@rkoser-nv right yeah, I understand that: that was why I opened #8028 and #8031 in August, at which point in time I was having to follow the Building with a Local Build of slang-llvm instructions from CONTRIBUTING.md; so I know that slang-test already successfully runs the FileCheck tests if I use those build commands (unless something's regressed, of course):

external/build-llvm.sh --source-dir build/slang-llvm_src --install-prefix build/slang-llvm_install
cmake --preset default --fresh -DSLANG_SLANG_LLVM_FLAVOR=USE_SYSTEM_LLVM -DLLVM_DIR=build/slang-llvm_install/lib/cmake/llvm -DClang_DIR=build/slang-llvm_install/lib/cmake/clang
cmake --build --preset release

What I'm asking is: does this PR now enable me to successfully run the FileCheck tests with a different set of commands? If so, which ones? (Since the one I tried in my message above didn't work.)

@rkoser-nv
Copy link
Contributor Author

Yes, the following should work:

cmake -S . -B build/  # I imagine this is equivalent to cmake --preset default but haven't confirmed that
cmake --build -j$(nproc) ./build

the resulting slang-test should be able to use filecheck in a nix dev-shell after this PR.

Copy link
Contributor

@samestep samestep left a comment

Choose a reason for hiding this comment

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

Got it, thanks! In the future it would be cool if one could just use -DSLANG_SLANG_LLVM_FLAVOR=USE_SYSTEM_LLVM with LLVM from Nix instead of having to download a prebuilt slang-llvm binary, but obviously that's beyond the scope of this PR.

Just now I ran these commands to see the difference produced by this PR:

cmake --preset default
cmake --build --preset release
build/Release/bin/slang-test

On commit dd4ba6e (the base of this PR branch), I got this output at the end:

===
99% of tests passed (1828/1829), 4396 tests ignored
===

1 failing tests:
---
tests/hlsl-intrinsic/scalar-int64.slang (cpu)
---

And on commit 5674b1b (the tip of this PR branch), I got this output at the end instead:

===
100% of tests passed (4264/4264), 2641 tests ignored
===

I'm guessing those 2436 extra passing tests / 1755 fewer ignored tests mean that slang-llvm is working properly using this PR.

@expipiplus1
Copy link
Collaborator

Got it, thanks! In the future it would be cool if one could just use -DSLANG_SLANG_LLVM_FLAVOR=USE_SYSTEM_LLVM with LLVM from Nix instead of having to download a prebuilt slang-llvm binary, but obviously that's beyond the scope of this PR

this is what I've been doing for a while now! I should really integrate my version...

@expipiplus1 expipiplus1 enabled auto-merge January 7, 2026 15:22
@samestep
Copy link
Contributor

samestep commented Jan 7, 2026

@expipiplus1 that would be amazing! It would definitely have saved me and @rkoser-nv from working on these inferior solutions 😅

@expipiplus1 expipiplus1 added this pull request to the merge queue Jan 8, 2026
github-merge-queue bot pushed a commit that referenced this pull request Jan 8, 2026
Add the packages required for prebuilt LLVM to `LD_LIBRARY_PATH`.

Also, switch from `stdenvNoCC` to a proper clang/llvm stdenv.

---------

Co-authored-by: Ellie Hermaszewska <[email protected]>
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 8, 2026
@expipiplus1 expipiplus1 added this pull request to the merge queue Jan 9, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 9, 2026
@rkoser-nv rkoser-nv added this pull request to the merge queue Jan 9, 2026
Merged via the queue into shader-slang:master with commit 186351f Jan 9, 2026
82 of 91 checks passed
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