Troubleshooting - unhappy-ending/gentoo-clang-served-rice GitHub Wiki

Using the complete LLVM toolchain system wide in Gentoo is not standard. Knowledge on how to troubleshoot various Portage phase errors is important. The key phases are configuring, compiling, testing, and installing. Any one of these phases can fail when straying off the standard Gentoo configuration.

This page will cover how to troubleshoot and also document packages with problems. Some errors are not going to be universal since Gentoo is capable of being tailored to different uses. What may affect one machine might not affect another.

A package failed to emerge :(

If a package failed to emerge, take note of the phase it failed at. Did it fail at the configure phase, compile phase, or test phase? Each of these phases can fail for various reasons and troubleshooting each one takes a little finesse to find out why. When using Clang and the LLVM toolchain system wide, you will need to be able to diagnose if the failure is toolchain related or from some other cause, like a missing dependency or USE flag setting.

Configure phase

The compiler failed to compile a test program!

When the compiler fails to compile a test program it's likely the command is at fault. Check the output and see what causes it. Usually the offending command is shown.

Clang specific flags causing failures

Clang as the system wide compiler is likely not being respected in this case. This is a fairly serious issue and should be reported on the bug tracker. There probably isn't much of this these days but in the case there is, it's necessary to report.

Solution:

  • If the ebuild is at fault, use a local ebuild
  • If the source is at fault, use a local patch
  • Regardless, report the offending package not respecting the chosen system compiler

Flag filtering causing failures

Check the ebuild for any specific flag overriding. Most normal people don't use flags beyond -march and -O. This isn't a normal system and uses flags like -fvirtual-function-elimination which can cause a test program to fail if -flto was filtered out by the ebuild. Gentoo developers are not going to expect users to use Clang only -flto flags and aren't likely to write flag filtering to take care of those.

Ricer solution:

  • Use the workaround _FLAG_O_MATIC_ECLASS=1
  • Use a local ebuild if the workaround doesn't work
  • Use a local patch if the source itself is altering system flag settings

The workaround _FLAG_O_MATIC_ECLASS=1 works most of the time, but sometimes altering an offending ebuild is necessary. Worst case scenario is the filtering occurring in the actual source. For example, x11-base/xorg-server has the -flto flag and GCC link-time optimization related flags such as -fuse-linker-plugin filtered in the test sources. Since it doesn't filter Clang related link-time optimization flags, a compile phase error happens when the compiling the test code to be run during the test phase because -fvirutal-function-elimination requires -flto, and hasn't been filtered.

Proper solution:

  • Remove the offending flags and trust the developers to remove harmful flags as the ebuilds dictate

This is the proper way to handle things. It's possible to make an appeal to the maintainer to remove the flag filtering if it's possible to prove the built package behaves properly.

LLD specific flags causing failures

Compile phase

Test phase


Documentation of found issues

The following is a personal list of packages with various issues. The list is broken down into phases. The goal is for these issues to be documented, reported, and fixed regardless of whether they are Clang only or not.

Configure phase failures

USE flag settings

  • kde-apps/kio-extras configure phase fails with USE="-X"; not reported
  • kde-frameworks/kinit configure phase fails with USE="-X"; not reported
  • kde-frameworks/kio configure phase fails with USE="-X"; not reported
  • kde-plasma/libksysguard configure phase fails with USE="-X"; not reported
  • kde-plasma/plasma-pa configure phase fails with media-sound/pulseaudio[-glib]; not reported

Compile phase failures

USE flag settings

  • sys-devel/bc compile phase fails with USE="libedit"; bug 830101

Missing dependencies

  • sys-devel/elftoolchain compile phase requires sys-apps/groff; not reported

Test phase failures

USE flag settings

  • app-arch/gzip test phase fails with sys-apps/util-linux[-ncurses]; not reported
  • app-arch/lzlib test phase fails with sys-devel/binutils-config[-native-symlinks]; not reported
  • app-arch/p7zip test phase fails with USE="-rar"; bug 907221
  • app-crypt/p11-kit test phase fails with USE="-libffi"; bug 691640
  • app-crypt/gcr test phase fails with app-cypt/gnupg[-bzip2]; not reported
  • app-crypt/gnupg test phase fails with net-misc/openssh[-ssl]; bug 833148
  • app-portage/gemato test phase fails with app-crypt/gnupg[-ssl]; not reported
  • dev-libs/gmp test phase fails with USE="cxx"; not reported
  • dev-libs/libpcre2 test phase fails with USE="jit"; not reported
  • dev-libs/openssl test phase fails with USE="-weak-ssl-ciphers"; not reported
  • dev-python/six test phase fails with dev-lang/python[-gdbm]; not reported
  • dev-vcs/git test phase fails with USE="-iconv"; not reported
  • net-misc/wget test phase fails with USE="-ipv6"; not reported

Missing dependencies

  • app-text/htmltidy test phase requires dev-ruby/thor; bug 824534
  • dev-python/pillow test phase requires sys-libs/zlib; not reported
  • dev-python/pycurl test phase requires dev-python/bottle; not reported
  • dev-python/pygobject test phase requires dev-python/pycairo; not reported
  • dev-ruby/mini_portile test phase requires dev-ruby/thor; not reported
  • sys-fs/fuse test phase requires app-misc/hello; not reported
  • sys-fs/fuse test phase requires dev-python/looseversion; not reported
  • sys-devel/elftoolchain test phase requires sys-apps/groff; not reported
  • sys-libs/libblockdev test phase requires app-admin/sudo; not reported
  • x11-libs/pango test phase requires media-fonts/cantarell; bug 816378

Less with Clang

More with Clang

  • dev-libs/elfutils not reported

Only with Clang

  • dev-libs/double-conversion not reported
  • dev-libs/libfmt not reported

Unrelated to Clang

  • app-crypt/gcr not reported
  • app-crypt/libsecret not reported
  • app-portage/gemato not reported
  • app-shells/fish not reported
  • app-text/docbook-xsl-stylesheets not reported
  • dev-libs/libnl bug 840167
  • dev-libs/newt not reported
  • dev-util/cmake not reported
  • dev-util/gtk-doc not reported
  • dev-util/umockdev not reported
  • x11-libs/pango bug 836317