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 withUSE="-X"
; not reportedkde-frameworks/kinit
configure phase fails withUSE="-X"
; not reportedkde-frameworks/kio
configure phase fails withUSE="-X"
; not reportedkde-plasma/libksysguard
configure phase fails withUSE="-X"
; not reportedkde-plasma/plasma-pa
configure phase fails withmedia-sound/pulseaudio[-glib]
; not reported
Compile phase failures
USE flag settings
sys-devel/bc
compile phase fails withUSE="libedit"
; bug 830101
Missing dependencies
sys-devel/elftoolchain
compile phase requiressys-apps/groff
; not reported
Test phase failures
USE flag settings
app-arch/gzip
test phase fails withsys-apps/util-linux[-ncurses]
; not reportedapp-arch/lzlib
test phase fails withsys-devel/binutils-config[-native-symlinks]
; not reportedapp-arch/p7zip
test phase fails with USE="-rar"; bug 907221app-crypt/p11-kit
test phase fails with USE="-libffi"; bug 691640app-crypt/gcr
test phase fails withapp-cypt/gnupg[-bzip2]
; not reportedapp-crypt/gnupg
test phase fails withnet-misc/openssh[-ssl]
; bug 833148app-portage/gemato
test phase fails withapp-crypt/gnupg[-ssl]
; not reporteddev-libs/gmp
test phase fails withUSE="cxx"
; not reporteddev-libs/libpcre2
test phase fails withUSE="jit"
; not reporteddev-libs/openssl
test phase fails withUSE="-weak-ssl-ciphers"
; not reporteddev-python/six
test phase fails withdev-lang/python[-gdbm]
; not reporteddev-vcs/git
test phase fails withUSE="-iconv"
; not reportednet-misc/wget
test phase fails withUSE="-ipv6"
; not reported
Missing dependencies
app-text/htmltidy
test phase requiresdev-ruby/thor
; bug 824534dev-python/pillow
test phase requiressys-libs/zlib
; not reporteddev-python/pycurl
test phase requiresdev-python/bottle
; not reporteddev-python/pygobject
test phase requiresdev-python/pycairo
; not reporteddev-ruby/mini_portile
test phase requiresdev-ruby/thor
; not reportedsys-fs/fuse
test phase requiresapp-misc/hello
; not reportedsys-fs/fuse
test phase requiresdev-python/looseversion
; not reportedsys-devel/elftoolchain
test phase requiressys-apps/groff
; not reportedsys-libs/libblockdev
test phase requiresapp-admin/sudo
; not reportedx11-libs/pango
test phase requiresmedia-fonts/cantarell
; bug 816378
Less with Clang
More with Clang
dev-libs/elfutils
not reported
Only with Clang
dev-libs/double-conversion
not reporteddev-libs/libfmt
not reported
Unrelated to Clang
app-crypt/gcr
not reportedapp-crypt/libsecret
not reportedapp-portage/gemato
not reportedapp-shells/fish
not reportedapp-text/docbook-xsl-stylesheets
not reporteddev-libs/libnl
bug 840167dev-libs/newt
not reporteddev-util/cmake
not reporteddev-util/gtk-doc
not reporteddev-util/umockdev
not reportedx11-libs/pango
bug 836317