Bug 2299949 - Driver::GetResourcesPath() returns the wrong resource path
Summary: Driver::GetResourcesPath() returns the wrong resource path
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: clang
Version: 42
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Tulio Magno Quites Machado Filho
QA Contact: Fedora Extras Quality Assurance
URL: https://github.com/include-what-you-u...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2024-07-25 19:45 UTC by Tulio Magno Quites Machado Filho
Modified: 2025-03-18 13:14 UTC (History)
12 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2025-03-18 13:14:53 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker FC-1263 0 None None None 2024-07-27 18:15:35 UTC

Description Tulio Magno Quites Machado Filho 2024-07-25 19:45:13 UTC
On Rawhide and F40, this function is returning `/usr/lib64/clang/18`.
The correct path is `/usr/lib/clang/18`.

I'm not sure if this construction is correct: https://github.com/llvm/llvm-project/blob/main/clang/lib/Driver/Driver.cpp#L195-L196

Reproducible: Always

Comment 1 Tulio Magno Quites Machado Filho 2024-07-25 19:51:57 UTC
I think the this discussion from upstream might be important too: https://github.com/llvm/llvm-project/pull/97197#issuecomment-2225809257

Comment 2 Kim Gräsman 2024-08-13 18:41:46 UTC
Hmm, see also https://reviews.llvm.org/D130586 -- some of the early testing appears to have seen the same lib64 vs. lib confusion (this patch does not appear to have been merged).

I wonder if that's something latent in the CMake/Driver division of responsibilities that happens to surface in Fedora's configuration? Do you have a link to Fedora's cmake configure line somewhere?

Comment 3 Tulio Magno Quites Machado Filho 2024-08-13 20:20:56 UTC
This is the latest cmake call for x86_64:

/usr/bin/cmake -S . -B redhat-linux-build -DCMAKE_C_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_CXX_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_Fortran_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_INSTALL_DO_STRIP:BOOL=OFF -DCMAKE_INSTALL_PREFIX:PATH=/usr -DINCLUDE_INSTALL_DIR:PATH=/usr/include -DLIB_INSTALL_DIR:PATH=/usr/lib64 -DSYSCONF_INSTALL_DIR:PATH=/etc -DSHARE_INSTALL_PREFIX:PATH=/usr/share -DLIB_SUFFIX=64 -DBUILD_SHARED_LIBS:BOOL=ON -G Ninja -DCLANG_DEFAULT_PIE_ON_LINUX=OFF -DPPC_LINUX_DEFAULT_IEEELONGDOUBLE=ON -DLLVM_PARALLEL_LINK_JOBS=1 -DLLVM_LINK_LLVM_DYLIB:BOOL=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DPYTHON_EXECUTABLE=/usr/bin/python3 -DCMAKE_SKIP_RPATH:BOOL=ON -DLLVM_LIBDIR_SUFFIX=64 -DCLANG_INCLUDE_TESTS:BOOL=ON -DLLVM_BUILD_UTILS:BOOL=ON -DLLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR=../clang-tools-extra-18.1.8.src -DLLVM_EXTERNAL_LIT=/usr/bin/lit -DLLVM_LIT_ARGS=-vv -DLLVM_MAIN_SRC_DIR=/usr/share/llvm/src -DLLVM_TABLEGEN_EXE:FILEPATH=/usr/bin/llvm-tblgen -DLLVM_COMMON_CMAKE_UTILS=/usr/share/llvm/cmake -DCLANG_ENABLE_ARCMT:BOOL=ON -DCLANG_ENABLE_STATIC_ANALYZER:BOOL=ON -DCLANG_INCLUDE_DOCS:BOOL=ON -DCLANG_PLUGIN_SUPPORT:BOOL=ON -DENABLE_LINKER_BUILD_ID:BOOL=ON -DLLVM_ENABLE_EH=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_BUILD_DOCS=ON -DLLVM_ENABLE_SPHINX=ON -DCLANG_LINK_CLANG_DYLIB=ON -DSPHINX_WARNINGS_AS_ERRORS=OFF -DCLANG_BUILD_EXAMPLES:BOOL=OFF -DBUILD_SHARED_LIBS=OFF '-DCLANG_REPOSITORY_STRING=Fedora 18.1.8-3.fc41' -DCLANG_RESOURCE_DIR=../lib/clang/18 -DCLANG_CONFIG_FILE_SYSTEM_DIR=/etc/clang/ -DCLANG_DEFAULT_UNWINDLIB=libgcc

Notice that we use -DCLANG_RESOURCE_DIR=../lib/clang/18

The complete log of the build is available at: https://kojipkgs.fedoraproject.org//packages/clang/18.1.8/3.fc41/data/logs/x86_64/build.log

Comment 4 Kim Gräsman 2024-08-18 08:22:35 UTC
> On Rawhide and F40, this function is returning `/usr/lib64/clang/18`.
> The correct path is `/usr/lib/clang/18`.

Just to clarify, does it return the wrong path when used inside Clang, or when used from a project external to Clang, using Clang libraries?

There is an issue of consistency (because CLANG_RESOURCE_DIR is not available to external projects) that I try to address here:
https://github.com/llvm/llvm-project/pull/103388

Just want to make sure there's not additional complexities I've missed. Thanks!

Comment 5 Tulio Magno Quites Machado Filho 2024-08-19 12:11:39 UTC
(In reply to Kim Gräsman from comment #4)
> Just to clarify, does it return the wrong path when used inside Clang, or
> when used from a project external to Clang, using Clang libraries?

I didn't test it from inside Clang.
But the issue was caused by not having CustomResourceDir=CLANG_RESOURCE_DIR

So, your PR 103388 should solve this.

> Just want to make sure there's not additional complexities I've missed.

Let me test PR 103388 and confirm if it works with https://github.com/include-what-you-use/include-what-you-use/pull/1575

Comment 6 Tulio Magno Quites Machado Filho 2024-08-20 12:34:30 UTC
Kim, I confirmed that all tests from iwyu passed after applying https://github.com/llvm/llvm-project/pull/103388 to clang and https://github.com/include-what-you-use/include-what-you-use/pull/1575 to iwyu.

I created a copr repository for these tests: https://copr.fedorainfracloud.org/coprs/tuliom/bz2299949/builds/

It's unclear to me which path we'll use in order to fix this issue in Fedora, i.e. applying the patch downstream or waiting for LLVM 20.0.
That's because of the API change.
Let's see what the rest of the Fedora LLVM Team thinks.

Thank you!

Comment 7 Aoife Moloney 2025-02-26 13:05:37 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 42 development cycle.
Changing version to 42.

Comment 8 Tulio Magno Quites Machado Filho 2025-03-18 13:14:53 UTC
We ended up waiting for LLVM 20.
This is now fixed in Rawhide and F42.


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