Open Bug 1853280 Opened 3 years ago Updated 2 years ago

Fails to build with Clang 17: clang++ -print-search-dirs should not be used to search for libclang.so

Categories

(Firefox Build System :: General, defect)

defect

Tracking

(Not tracked)

ASSIGNED

People

(Reporter: stransky, Assigned: sergesanspaille)

Details

Attachments

(1 file)

See https://bugzilla.redhat.com/show_bug.cgi?id=2239046

Firefox 117.0.1 fails to build with clang 17 due to changes how -print-search-dirs is printed.
print-search-dirs is internal clang tool and should not be used for system wide library scan.

The Bugbug bot thinks this bug should belong to the 'Firefox Build System::Toolchains' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: General → Toolchains

Basically relying on llvm-config --libdir instead of clang -print-search-dirs

Assignee: nobody → sguelton
Status: NEW → ASSIGNED

Martin, can you confirm that the attached patch fixes the issue in your setup?

Flags: needinfo?(stransky)

Yes, I'll look at it. Thanks!

The patch works for Fedora. But right now we use hardcoded with-libclang-path .mozbuild option:

ac_add_options --with-libclang-path=`llvm-config --libdir`
Flags: needinfo?(stransky)
Severity: -- → S3
Component: Toolchains → General

FYI I've encountered this with the current m-c. Build fails with cbindgen complaining that it can't find libclang.so and adding the option in comment 5 to my .mozconfig fixes the issue. No changes to my box, I just pull the latest m-c and it doesn't work anymore (it used to with a pull from last Friday).

(In reply to Gabriele Svelto [:gsvelto] from comment #6)

FYI I've encountered this with the current m-c. Build fails with cbindgen complaining that it can't find libclang.so and adding the option in comment 5 to my .mozconfig fixes the issue. No changes to my box, I just pull the latest m-c and it doesn't work anymore (it used to with a pull from last Friday).

what does your configure output look like?

Flags: needinfo?(gsvelto)

I've re-tested today removing the change from comment 5 and got this error:

 0:08.32 checking for libclang for bindgen... Trying "libclang.so" in "/home/gsvelto/.mozbuild/clang/lib"
 0:08.32 Trying "libclang.so.*" in "/home/gsvelto/.mozbuild/clang/lib"
 0:08.33 not found
 0:08.33 ERROR: Could not find libclang to generate rust bindings for C/C++. Please install the necessary packages, run `mach bootstrap`, or use --with-libclang-path to give the path containing it.

I had run ./mach bootstrap just before running the configure step again. I looked into /home/gsvelto/.mozbuild/clang/lib and indeed there was no libclang.so there. So I removed the /home/gsvelto/.mozbuild/clang folder again, and now everything works! libclang.so is where the build system expects it to be. I'm unsure what happened, maybe bootstrap hadn't updated my clang somehow?

Flags: needinfo?(gsvelto)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: