Bug 241334

Summary: [Flatpak] IceCC is broken for clang
Product: WebKit Reporter: Xabier Rodríguez Calvar <calvaris>
Component: Tools / TestsAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: lmoura, philn
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Description Xabier Rodríguez Calvar 2022-06-06 06:25:19 PDT
I am getting a the following error:

 /usr/bin/clang: error while loading shared libraries: libclang-cpp.so.13: cannot open shared object file: No such file or directory 

Sounds like a malformed IceCC toolchain.
Comment 1 Lauro Moura 2022-06-22 16:34:18 PDT
This seems to be an issue with the clang toolchain generated by icecc inside the flatpak env.

It's generated with `icecc --build-native <path-to-clang> <path-to-clang++>`.

In practice, icecc translates this to something `icecc-create-env clang --addfile=<path-to-clang++>`.

`icecc-create-env` then creates the env translating the clang path to `usr/bin/clang`[1] inside the toolchain file alongside its dependencies `libLLVM-14.so` and `libclang-cpp.so.14` in `usr/lib`. This works fine as clang's `DT_RPATH` is set to `$ORIGIN/../lib`.

But the script keeps the clang++ binary at its usual path, which is `usr/lib/sdk/llvm14/bin/clang++`. And as it has the same `DT_RPATH`, which poins effectively to `usr/lib/sdk/llvm14/lib/`, which is empty, clang++ can't find the required libraries.

Looks like a valid upstream icecc issue and would deserve an upstream bug. Meanwhile, I'm testing a SDK patch to `icecc-create-env` as a workaround.

[1] https://github.com/icecc/icecream/blob/master/client/icecc-create-env.in#L490
Comment 2 Lauro Moura 2022-06-23 20:00:40 PDT
> Looks like a valid upstream icecc issue and would deserve an upstream bug.

Submitted in https://github.com/icecc/icecream/issues/603 asking for either a fix or how we could approach this.

> Meanwhile, I'm testing a SDK patch to `icecc-create-env` as a workaround.
> L490

Tried a few tweaks on the way `icecc-create-env` adds the clang and clang++ files to the toolchain without luck. In the end, the clang++ was always invoked from `usr/lib/sdk...` while the required libraries were moved to `usr/lib/`.

PS: Adding philn to the loop.
Comment 3 Philippe Normand 2022-06-24 01:33:42 PDT
The same toolchain zipped files work just fine with sccache. I wonder how, then :)