icecc / icecream

Distributed compiler with a central scheduler to share build load
GNU General Public License v2.0
1.58k stars 248 forks source link

Failure to run clang++ from clang toolchain #603

Open lauromoura opened 2 years ago

lauromoura commented 2 years ago

In the WebKit GTK and WPE ports, we have an SDK based on Flatpak. It supports distributed builds by automatically bundling GCC and Clang toolchains with icecc --build-native and setting up ICECC_VERSION accordingly. This scheme uses clang from the flatpak remote org.freedesktop.Sdk.Extension.llvm14, which places the clang binaries on /usr/lib/sdk/llvm14/bin/....

One issue with the clang toolchain file is related to the clang++ file (a symbolic link to clang). Currently, icecc-create-env moves the clang binary, located initially at usr/lib/sdk/llvm14/bin/clang, to usr/bin/clang inside the toolchain file, also placing the dependencies libclang-cpp and libLLVM-14 inside usr/lib. This scheme works fine for clang as its rpath points to $ORIGIN/../lib.

In the clang++ case, which some dependencies of WebKit require, the toolchain keeps it in its original path, usr/lib/sdk/llvm14/bin/clang++. As it has the same rpath as clang, the libraries are not there, and the compiler invocation fails on the remote icecc node.

Is this a bug in how icecc-create-env handles clang and clang++? Or is there any way to work around this limitation?

arkq commented 1 year ago

I've got the same issue (it seems) and adding clang++ symlink to the created bundle fixed that for me. Simply unpack created bundle, add ln -s clang usr/bin/clang++, and pack it again.