Bug 2416546 - IWYU doesn't find resource dir
Summary: IWYU doesn't find resource dir
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: iwyu
Version: 42
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Vitaly
QA Contact: Fedora Extras Quality Assurance
URL: https://github.com/include-what-you-u...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2025-11-22 10:56 UTC by Kim Gräsman
Modified: 2025-12-13 00:50 UTC (History)
1 user (show)

Fixed In Version: iwyu-0.24-5.fc42
Clone Of:
Environment:
Last Closed: 2025-12-13 00:50:24 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github include-what-you-use include-what-you-use issues 1864 0 None closed Wrong path to resources in Clang 20.1.8 based build 2025-12-04 10:54:28 UTC

Description Kim Gräsman 2025-11-22 10:56:08 UTC
I'm an IWYU upstream maintainer. We received this bug report from a Fedora user, which indicates IWYU can no longer find the Clang resource dir (where builtin headers like `<stdbool.h>` etc live): https://github.com/include-what-you-use/include-what-you-use/issues/1864.

IWYU recently (https://github.com/include-what-you-use/include-what-you-use/releases/tag/0.23) changed its mechanics for how to find the resource dir, and I wonder if the packaging spec now needs to do something different to wire it correctly.

I'm not very familiar with RPM specs, but it looks like the LLVM spec overrides `CLANG_RESOURCE_DIR`: https://src.fedoraproject.org/rpms/llvm/blob/rawhide/f/llvm.spec#_1563

I suspect that means a similar override will need to be added to IWYU, using `IWYU_RESOURCE_DIR`, but it's all a bit subtle. I'd be happy to help weigh options if someone wants to look into this.

Reproducible: Always

Steps to Reproduce:
Please see linked upstream bug.
Actual Results:
IWYU cannot find headers from resource dir in clean install, analysis fails.

Expected Results:
IWYU should find headers from resource dir.

Comment 1 Vitaly 2025-11-23 09:17:09 UTC
Sorry, but I can't reproduce. Everything works as expected. Maybe the upstream bug reporter has their own build of include-what-you-use or LLVM. Also, they should upgrade to Fedora 43.

Warning: include-what-you-use reported diagnostics:

/home/test/1111/main.h should add these lines:

/home/test/1111/main.h should remove these lines:
- #include <stdbool.h>  // lines 1-1

The full include-list for /home/test/1111/main.h:
---

/home/test/1111/main.c should add these lines:
#include <stdbool.h>  // for true, bool

/home/test/1111/main.c should remove these lines:

The full include-list for /home/test/1111/main.c:
#include "main.h"
#include <stdbool.h>  // for true, bool
---

[test@local 1111]$ include-what-you-use -print-resource-dir
/usr/bin/../lib/clang/21
[test@local 1111]$ clang -print-resource-dir
/usr/bin/../lib/clang/21

> I suspect that means a similar override will need to be added to IWYU, using `IWYU_RESOURCE_DIR`, but it's all a bit subtle. I'd be happy to help weigh options if someone wants to look into this.

We removed it in https://src.fedoraproject.org/rpms/iwyu/c/11c1fc50747faa359d433cc0d283972e89f88bfa?branch=rawhide commit, since it is no longer required.

include-what-you-use now uses built-in LLVM discovery feature, as requested by upstream: https://github.com/include-what-you-use/include-what-you-use/pull/1637. It works with Fedora LLVM builds correctly. But we does not support all other custom LLVM builds.

Comment 2 Kim Gräsman 2025-12-03 20:00:04 UTC
Thank you!

I've confirmed that it works for fedora:43, and fails as described for fedora:42 based on the IWYU bugreport: https://github.com/include-what-you-use/include-what-you-use/issues/1864#issuecomment-3606505559

I'll redirect that user here and close the upstream bug.

I don't know what the maintenance of fedora:42 looks like, but I'd be happy to assist with IWYU details if someone wants to try and fix it.

Comment 3 Vitaly 2025-12-04 10:32:47 UTC
I will try to rebuild it on Fedora 42.

Comment 4 Vitaly 2025-12-04 10:46:48 UTC
Please try the iwyu-0.24-5.fc42 build:
sudo dnf install https://kojipkgs.fedoraproject.org/packages/iwyu/0.24/5.fc42/x86_64/iwyu-0.24-5.fc42.x86_64.rpm

All tests passed:
207/208 Test #207: fix_includes_test .................................   Passed    0.08 sec
208/208 Test #208: iwyu_tool_test ....................................   Passed    0.60 sec
100% tests passed, 0 tests failed out of 208
Total Test time (real) =   2.59 sec

It now uses the same SPEC as the F43 version (except for the version). If it still doesn't work, the problem isn't with iwyu packaging. It could be with LLVM packaging or a bug in the iwyu code.

Comment 5 Fedora Update System 2025-12-04 10:48:33 UTC
FEDORA-2025-3bffaf86c8 (iwyu-0.24-5.fc42) has been submitted as an update to Fedora 42.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-3bffaf86c8

Comment 6 Fedora Update System 2025-12-05 17:41:37 UTC
FEDORA-2025-3bffaf86c8 has been pushed to the Fedora 42 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-3bffaf86c8`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-3bffaf86c8

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 7 Kim Gräsman 2025-12-07 16:20:58 UTC
> Please try the iwyu-0.24-5.fc42 build:
> sudo dnf install https://kojipkgs.fedoraproject.org/packages/iwyu/0.24/5.fc42/x86_64/iwyu-0.24-5.fc42.x86_64.rpm

Thank you! I can confirm that the resource dirs are the same for clang and include-what-you-use at this version.

Comment 8 Vitaly 2025-12-08 08:45:47 UTC
Great. Please give positive karma to FEDORA-2025-3bffaf86c8 update to push it to stable.

Comment 9 Fedora Update System 2025-12-13 00:50:24 UTC
FEDORA-2025-3bffaf86c8 (iwyu-0.24-5.fc42) has been pushed to the Fedora 42 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.