Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 408963 (systemwide-clang) - [TRACKER] Support LLVM/Clang as alternative system compiler
Summary: [TRACKER] Support LLVM/Clang as alternative system compiler
Status: CONFIRMED
Alias: systemwide-clang
Product: Quality Assurance
Classification: Unclassified
Component: Trackers (show other bugs)
Hardware: All All
: High enhancement
Assignee: Gentoo Quality Assurance Team
URL:
Whiteboard:
Keywords: Goal, Tracker
Depends on: 427346 502464 509696 509700 557874 576646 588226 630072 729118 729124 729134 729160 729266 729288 729426 729512 729520 729522 729528 729688 729868 729888 730314 730792 730836 731024 731158 731170 731678 731854 731856 731862 731916 731934 732246 732258 732278 732448 733016 734180 734220 734280 739074 739110 739154 739312 739314 739990 740798 740812 741060 741080 741098 741364 741592 742422 742965 744055 744064 744067 813249 829081 829340 830231 831387 835457 846500 860111 860114 870028 c99-porting 871591 873631 874339 876307 876520 877065 880653 882805 887115 900144 908078 910426 910438 914336 915999 916039 919740 921730 403071 406163 409267 409269 410945 417171 417181 417349 417537 417541 417545 417547 417703 freebsd-clang-3.1 417913 418137 418141 420121 422829 427206 427298 427300 427304 427310 427314 427316 427318 427320 427322 427324 427326 427330 427338 427342 427344 427348 427350 427352 427796 427808 430040 432924 434928 435506 446080 448714 449060 449366 449368 449370 449376 449378 449380 450270 451986 454980 455414 456298 457630 457950 457966 458134 458142 458154 458254 458316 458324 458916 458932 462608 462832 464758 464882 464982 466010 466312 467986 476554 478338 483376 483408 483412 483540 485146 485310 486876 502408 502450 502452 502454 502458 502460 502462 502466 502470 502472 502474 502476 502478 502480 503352 504170 504228 506902 506934 508214 509698 509702 509704 509712 510102 513054 517554 517620 519006 519362 520182 520194 523096 523260 523560 526832 526842 551238 551466 551518 554384 554392 558080 558084 561662 561726 564526 587094 587122 587248 587442 587996 588488 588772 589936 589948 595286 596352 596504 596506 596546 601504 603738 607848 608248 624070 624186 624190 624192 629410 630634 646360 681656 685688 688730 695612 698022 698164 707330 713574 726200 726718 729102 729114 729136 729234 729242 729244 729252 729254 729256 729276 729418 729428 729510 729532 729536 729550 729566 729680 729736 729910 730244 730686 730692 730826 730948 731018 731062 731074 731196 731206 731210 731256 731278 731280 731676 731720 731872 731886 732012 732014 732026 732098 732102 732216 732256 732262 732266 732284 732286 732416 732430 732438 732792 732846 733070 734204 734208 734216 734230 735854 735858 737072 737084 737120 737206 737208 738814 739034 739070 739080 739086 739090 739092 739094 739202 739238 739318 739378 739982 739988 740010 740290 740328 740334 740536 740540 740654 740826 740852 741082 741086 741152 741180 741184 741186 741366 741582 741584 741598 741644 741816 741819 741915 741939 742419 742671 742755 742764 742902 744970 744973 745024 767865 772314 784173 786597 792609 793917 802030 807766 817278 818379 818706 821433 822615 823857 824846 828019 828099 828105 828127 828947 829054 829057 829059 829066 829090 830225 830949 831305 831339 831472 832003 832764 832818 833371 834911 836604 836864 841770 848495 851831 858806 860078 862888 863950 865337 865339 869080 869128 869170 869203 869242 869254 869320 869371 869380 869404 869419 869539 869785 869839 869884 869911 869980 869992 869995 870001 870004 870007 870031 870034 870043 870094 870178 870238 870280 871174 872548 879157 879177 882007 882061 882787 885901 889410 889432 900148 900761 901099 901993 906174 907843 910309 915603 917561 917646 919743 921564
Blocks:
  Show dependency tree
 
Reported: 2012-03-20 07:13 UTC by Richard Yao (RETIRED)
Modified: 2024-01-21 13:59 UTC (History)
60 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Yao (RETIRED) gentoo-dev 2012-03-20 07:13:22 UTC
LLVM/Clang seems to be the future as far as open source compilers go. The FreeBSD developers switched to LLVM/Clang in FreeBSD 9 and the Debian project appears to be considering a switch as well. They did a survey that shows that only 8.8% of their packages fail to build with LLVM/Clang 3.0:

http://clang.debian.net/

It is probably a good time to look into building Gentoo with LLVM/Clang. FreeBSD upstream has already switched, so this should work well for Gentoo/FreeBSD. With some work, this could be leveraged by Gentoo Linux and Gentoo Prefix as well.

As per a chat I had with bonsaikitten (Patrick Lauer) in IRC, I am filing this bug to serve as a tracker for progress on this.
Comment 1 Alexandre 2012-08-03 02:17:11 UTC
I found this project and then I think it's may be interesting:

https://github.com/chneukirchen/obase

They are porting the OpenBSD useland for Linux.

In Arch Linux AUR are some PKGBUILDs about, but I don't know if already functional.

https://aur.archlinux.org/packages.php?ID=56826
Comment 2 gentoo@aoibh.in 2012-11-27 21:35:44 UTC
I'd love to start a project within the Gentoo community to start the transition from the inferior GCC to Clang. Would be a very interesting and rewarding project I think.
Comment 3 Richard Yao (RETIRED) gentoo-dev 2012-12-16 05:31:36 UTC
(In reply to comment #2)
> I'd love to start a project within the Gentoo community to start the
> transition from the inferior GCC to Clang. Would be a very interesting and
> rewarding project I think.

I am going to blame Hurricane Sandy for putting me behind on bug mail. Gentoo is quite large and I am one developer. It would be better to do this as a community effort and if people are interested in that, then it would be best to take this to the gentoo-dev mailing list. If you are strongly interested in doing this, I suggest that you subscribe to the gentoo-dev mailing list and send an email to the list about this. Instructions on how to subscribe are on the following webpage:

http://www.gentoo.org/main/en/lists.xml
Comment 4 Oleg Ageev 2013-07-17 21:04:27 UTC
If we want have systemwide-clang
first we need remove dependencies from gcc
remove from all packages
and first remove from llvm ebuild
llvm don't need dependency on gcc
we can check gcc version at pkg_pretend
and throw error if have broken gcc version
but this check need only if we use gcc as CC for build llvm.
Determine which compiler we use we can in pkg_pretend,
but we need remove gcc_version and Co from toolchain-funcs.eclass and split that in separate gcc-version.eclass
or clang-vesion.eclass
gcc-version
use CPP for determine version of gcc,
but for clang it's work too
clang return 4.2 if CPP=clang and call gcc-version
but...
what does what mean?
and determine compiler from tc-getCC
it's not best way
what if CC=cc and cc it's symlink to clang or script that call clang?
maybe we have better solution?

PS: dependencies to gcc don't need for all package
systemwide compiler it's part of system
and we have systemwide compiler in /usr/portage/profile/../packages
systemwide compiler always have last supported version
and if some package need specific version of system wide compiler
we should determine this in pkg_pretend
Comment 5 Austin English (RETIRED) gentoo-dev 2014-02-26 01:28:21 UTC
There are a couple missing dependencies:
bug 417795 (dev-libs/openssl)
bug 458932 (media-libs/libaacplus)

as well as a few I just filed:
bug 502450 (app-crypt/seahorse)
bug 502452 (dev-lang/tcc)
bug 502454 (media-libs/gstreamer)
bug 502458 (net-libs/glib-networking)
bug 502460 (net-libs/libsoup)
bug 502462 (sci-libs/fftw)
bug 502464 (sys-apps/memtest86+)
bug 502466 (sys-apps/ipmiutil)
bug 502470 (sys-boot/efibootmgr)
bug 502472 (sys-devel/autogen)
bug 502474 (sys-fs/udisks)
bug 502476 (sys-libs/glibc)
bug 502478 (x11-libs/cairo)
bug 502480 (x11-misc/lightdm)

btw, bugzilla seems to have an off by one, it's skipping all odd numbers. See above numbers ;)
Comment 7 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-11-09 08:14:35 UTC
Redacting comment 6 per request:
> I'm slowly (manually) moving lots of my packages over to LLVM/Clang (using
> the environment portage feature).
> Here's a gist of packages that work! (I'll update it periodically).
> Once I'm finished with my porting, I'll also file a bug report for every
> package that _doesn't_ work.
> 
> [redacted dead URL]
Comment 8 Daniel Hiepler 2023-06-14 09:23:37 UTC
app-text/tesseract-5.3.0 with USE="openmp" errors with "undefined symbol: __kmpc_global_thread_num"
Comment 9 Daniel Hiepler 2023-06-14 09:25:10 UTC
Here's my current package.env for installed packages, that don't compile successfully with clang:


=dev-lang/luajit-2.1.0_beta3_p20220127-r2	gcc
=app-forensics/unhide-20210124			gcc
=net-analyzer/bing-1.3.5			gcc
=dev-lang/micropython-1.17			gcc
dev-util/biew					gcc
sys-boot/syslinux				gcc
=app-office/dia-0.97.3-r1			gcc
dev-java/icedtea				gcc
sys-devel/binutils				gcc
sys-libs/binutils-libs				gcc
cross-arm-none-linux-gnueabi/binutils		gcc
cross-arm-none-linux-gnueabi/gcc		gcc
cross-arm-none-linux-gnueabi/glibc		gcc
dev-libs/libpwquality				gcc
sci-physics/xfoil				gcc
x11-misc/redshift				gcc
=dev-util/geany-plugins-1.38-r5			gcc
=dev-util/bazel-5.0.0				gcc
=dev-util/memprof-0.6.2-r1			gcc
=app-crypt/seahorse-43.0-r2			gcc
=dev-lang/python-3.11.2_p2			gcc
=dev-lang/python-3.11.3				gcc
dev-qt/qtcore					gcc
dev-qt/qtwebengine				gcc
=dev-vcs/cvs-1.12.12-r14			gcc
=media-libs/zvbi-0.2.35-r2			gcc
=sys-apps/sandbox-2.29				gcc
=app-text/enchant-1.6.1-r2			gcc
=dev-util/colm-0.14.7				gcc
=media-libs/t1lib-5.1.2-r3			gcc
=media-libs/portaudio-19.07.00-r2		gcc
=sci-libs/hdf5-1.12.2-r6			gcc
=app-cdr/cdrtools-3.02_alpha09-r3		gcc
=net-dns/bind-tools-9.16.37-r1			gcc
=media-libs/libggi-2.2.2-r1			gcc
=media-libs/libggiwmh-0.3.2-r1			gcc
=dev-lang/mono-6.12.0.122			gcc
=sci-libs/lapack-3.11				gcc
=dev-python/numpy-1.24.2			gcc
=sys-libs/libomp-15.0.7-r2			gcc
=app-text/gtkspell-2.0.16-r2			gcc
=xfce-extra/xfce4-sensors-plugin-1.4.4		gcc
dev-lang/php					gcc
dev-lang/php					gcc
media-video/ffmpeg				gcc
=media-libs/sdl2-image-2.0.5_p20210328-r1	gcc
=media-libs/sdl2-mixer-2.6.2-r1			gcc
=media-libs/sdl2-net-2.0.1			gcc
=media-libs/sdl-net-1.2.8_p20221010		gcc
=media-libs/libquicktime-1.2.4-r4		gcc
=app-emulation/fs-uae-3.1.66			gcc
=games-fps/quake2-icculus-0.16.1-r2		gcc
=media-video/makemkv-1.17.3			gcc
media-video/mplayer				gcc
=media-gfx/exact-image-1.0.2-r8			gcc
=media-video/transcode-1.1.7-r6			gcc
=sys-libs/ncurses-6.4_p20230401			gcc
=dev-python/cryptography-40.0.2			gcc
app-office/libreoffice				gcc
app-crypt/seahorse				gcc
media-sound/audacity				gcc
Comment 10 Michael Egger 2023-06-14 09:49:43 UTC
Here is mine for things that currently don't build with clang-15 and clang-16.
The last @world rebuild wasn't long ago so this should still be accurate.
Packages like gcc,glibc,... that are known to not support clang are not in the list. 

app-cdr/cdrtools                compiler-gcc    # configure error

app-emulation/virtualbox        compiler-gcc    # ld.lld error
app-emulation/qemu              compiler-gcc    # ERROR: sizeof(size_t) doesn't match

dev-lang/mono                   compiler-gcc    # ld.lld error

dev-libs/libsecp256k1           compiler-gcc    # unrecognized command-line option

dev-util/ostree                 compiler-gcc    # ld.lld error

dev-python/ruamel-yaml-clib     compiler-gcc    # incompatible function pointer types

dev-qt/qtwebengine              compiler-gcc    # build fails

media-libs/libpano13            compiler-gcc    # build fails
media-libs/tg_owt               compiler-gcc    # build fails
media-libs/phonon               compiler-gcc    # build fails
media-libs/vigra                compiler-gcc    # build fails

net-print/hplip                 compiler-gcc    # error: ISO C++17

sys-apps/pciutils               compiler-gcc    # ld.lld

sys-boot/syslinux               compiler-gcc    # 'stdarg.h' file not found

sys-devel/bin86                 compiler-gcc    # error: ISO C99
sys-devel/binutils              compiler-gcc    # configure: error: AR 

sys-libs/db                     compiler-gcc    # build fails

sys-process/tini                compiler-gcc    # ld.lld error
Comment 11 Marek Bartosiewicz 2023-10-27 04:56:07 UTC
Here's my current list:

sys-apps/systemd compiler-gcc
net-dialup/ppp compiler-gcc
media-libs/audiofile compiler-gcc
app-cdr/cdrtools compiler-gcc
app-crypt/chntpw compiler-gcc

I use KDE Plasma, but I have -webengine set.

systemd will compile with clang if boot/gnuefi flags are unset, but I enabled those for systemd-boot.