2022-10-30 14:25:15 +08:00
|
|
|
#+TITLE: Gentoo LLVM_TARGETS not Working?
|
|
|
|
#+DATE: <2022-10-29 六>
|
|
|
|
#+OPTIONS: toc:nil
|
|
|
|
|
2022-10-30 15:09:37 +08:00
|
|
|
Recently, I would like to test switching from =gcc= to [[https://wiki.gentoo.org/wiki/Clang][clang]] on my Gentoo VM.
|
|
|
|
+warning: you will be crazy to have too many packages can't be build with clang+
|
2022-10-30 14:25:15 +08:00
|
|
|
|
|
|
|
* problem
|
|
|
|
First I want to make [[https://llvm.org][LLVM]] not targeting too many platform, but changing =LLVM_TARGETS= don't work
|
|
|
|
#+BEGIN_SRC shell
|
|
|
|
[ebuild N ] sys-devel/llvm-15.0.3:15::gentoo USE="binutils-plugin libffi
|
|
|
|
ncurses -debug -doc -exegesis -libedit -test -verify-sig -xar -xml -z3 -zstd"
|
|
|
|
LLVM_TARGETS="(AArch64) (AMDGPU) (ARM) (AVR) (BPF) (Hexagon) (Lanai) (MSP430)
|
|
|
|
(Mips) (NVPTX) (PowerPC) (RISCV) (Sparc) (SystemZ) (VE) (WebAssembly) (X86)
|
|
|
|
(XCore) (-ARC) (-CSKY) (-DirectX) (-LoongArch) (-M68k) (-SPIRV)" 241 KiB
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* and I found [[https://forums.gentoo.org/viewtopic.php?p=8694331][[solved] LLVM_TARGETS not respected?]](Mar 2022) on gentoo forum
|
|
|
|
|
|
|
|
It seems that global =LLVM_TARGETS= setting is not respected,
|
|
|
|
and flags such as =llvm_targets_AArch64=, =llvm_targets_ARM=, are no longer there.
|
|
|
|
They're now forced by default as a precaution.
|
|
|
|
|
|
|
|
|
|
|
|
* /*solution*/
|
|
|
|
** add something like =*/* -llvm_targets_AArch64= into =/etc/portage/profile/package.use.force=
|
|
|
|
I excluded all targets exept for X86, but still 3 left: AMDGPU, BPF, NVPTX
|
|
|
|
** so I also add =sys-devel/llvm -llvm_targets_AMDGPU -llvm_targets_BPF -llvm_targets_NVPTX= in =/etc/portage/package.use/=
|
|
|
|
** and don't forget to add that three excluder to clang or other compiler that uses llvm
|
|
|
|
|
|
|
|
|
|
|
|
* finally I got this:
|
|
|
|
#+BEGIN_SRC shell
|
|
|
|
[ebuild N ] sys-devel/llvm-15.0.3:15::gentoo USE="binutils-plugin libffi
|
|
|
|
ncurses -debug -doc -exegesis -libedit -test -verify-sig -xar -xml -z3 -zstd"
|
|
|
|
LLVM_TARGETS="(X86) -AArch64 -AMDGPU (-ARC) -ARM -AVR -BPF (-CSKY) (-DirectX)
|
|
|
|
-Hexagon -Lanai (-LoongArch) (-M68k) -MSP430 -Mips -NVPTX -PowerPC -RISCV
|
|
|
|
(-SPIRV) -Sparc -SystemZ -VE -WebAssembly -XCore" 241 KiB
|
|
|
|
#+END_SRC
|
|
|
|
|