Bug 2239046 - Output of clang++ -print-search-dirs is different on clang 17, breaks Firefox build
Summary: Output of clang++ -print-search-dirs is different on clang 17, breaks Firefox...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: clang
Version: 39
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Tom Stellard
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-09-14 23:49 UTC by Adam Williamson (Red Hat non-Fedora)
Modified: 2023-09-15 17:22 UTC (History)
11 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2023-09-15 17:22:39 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Adam Williamson (Red Hat non-Fedora) 2023-09-14 23:49:10 UTC
With clang 16, the libraries line in the output of `clang++ -print-search-dirs` is:

libraries: =/usr/lib64/clang/16:/usr/bin/../lib/gcc/x86_64-redhat-linux/13:/usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../lib64:/lib/../lib64:/usr/lib/../lib64:/lib:/usr/lib

The output on 17 is:

libraries: =/usr/bin/../lib/clang/17:/usr/bin/../lib/clang/17/lib/x86_64-redhat-linux-gnu:/usr/bin/../lib/gcc/x86_64-redhat-linux/13:/usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../lib64:/lib/../lib64:/usr/lib/../lib64:/lib:/usr/lib

split out, those look like this:

16
--

/usr/lib64/clang/16
/usr/bin/../lib/gcc/x86_64-redhat-linux/13
/usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../lib64
/lib/../lib64
/usr/lib/../lib64
/lib
/usr/lib

17
--

/usr/bin/../lib/clang/17
/usr/bin/../lib/clang/17/lib/x86_64-redhat-linux-gnu
/usr/bin/../lib/gcc/x86_64-redhat-linux/13
/usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../lib64
/lib/../lib64
/usr/lib/../lib64
/lib
/usr/lib

so in 17 there's one "extra" entry - the second - and the first entry has changed from /usr/lib64/clang/(version) to /usr/bin/../lib/clang/(version) (on x86_64). The other entries seem the same.

This breaks the build of Firefox, so it's kind of a big problem. I can hack around it in Firefox, but wanted to report it in case it's a bug.

Reproducible: Always

Steps to Reproduce:
1. Run clang++ -print-search-dirs
2. Observe the output
Actual Results:  
See above.

Expected Results:  
See above.

Comment 1 Adam Williamson (Red Hat non-Fedora) 2023-09-14 23:58:46 UTC
Firefox bug - https://bugzilla.redhat.com/show_bug.cgi?id=2239047 . I'm testing if I can work around the issue ATM.

Comment 2 Tom Stellard 2023-09-15 03:49:14 UTC
This is change was made on purpose: https://fedoraproject.org/wiki/Changes/LLVM-17#Detailed_Description

Firefox should not be using `clang++ -print-search-dirs` to find the location of libclang.so.  This option outputs the compiler search paths which have nothing to do with the location of this library.  The fact that it was working before was a coincidence.  Isn't there a standard process for finding a specific library on the system?  I know cmake an autoconf can do this.

Comment 3 Adam Williamson (Red Hat non-Fedora) 2023-09-15 05:19:51 UTC
Firefox has its own build system. If you think it shouldn't be doing this, we can report it upstream.

Comment 4 Tom Stellard 2023-09-15 05:55:38 UTC
(In reply to Adam Williamson from comment #3)
> Firefox has its own build system. If you think it shouldn't be doing this,
> we can report it upstream.

Yeah, I think reporting an upstream bug is a good idea.

Comment 5 Martin Stransky 2023-09-15 06:39:33 UTC
Filed as https://bugzilla.mozilla.org/show_bug.cgi?id=1853280
Thanks.

Comment 6 Adam Williamson (Red Hat non-Fedora) 2023-09-15 17:22:39 UTC
OK, so with that reported, it doesn't look like there's really anything else to do here. Thanks folks.


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