Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Can't change LLVM_TARGETS for llvm and clang
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
chromatic abberation
n00b
n00b


Joined: 28 Jan 2023
Posts: 2

PostPosted: Sat Jan 28, 2023 8:55 pm    Post subject: Can't change LLVM_TARGETS for llvm and clang Reply with quote

Been trying to emerge llvm but can't emerge llvm for just X86 arch. It tries to compile it for other architectures too!

I tried to follow https://bugs.gentoo.org/767700 which was referenced from https://forums.gentoo.org/viewtopic-p-8694149.html.

Running emerge -pv --nodeps llvm rust clang gives this.
Code:
emerge -pv --nodeps llvm rust clang

These are the packages that would be merged, in order:

[ebuild  N     ] sys-devel/llvm-15.0.7:15::gentoo  USE="binutils-plugin libffi ncurses -debug -doc -exegesis -libedit -test -verify-sig -xar -xml -z3 -zstd" ABI_X86="(64) -32 (-x32)" 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)" 108,579 KiB

[ebuild  N     ] dev-lang/rust-1.66.1:stable/1.66::gentoo  USE="-clippy -debug -dist -doc (-llvm-libunwind) (-miri) (-nightly) (-parallel-compiler) (-profiler) -rust-analyzer -rust-src -rustfmt (-system-bootstrap) (-system-llvm) -test -verify-sig -wasm" ABI_X86="(64) -32 (-x32)" CPU_FLAGS_X86="sse2" LLVM_TARGETS="(X86) -AArch64 -AMDGPU -ARM -AVR -BPF -Hexagon -Lanai -MSP430 -Mips -NVPTX -PowerPC -RISCV -Sparc -SystemZ -WebAssembly -XCore" 296,603 KiB

[ebuild  N     ] sys-devel/clang-15.0.7-r1:15/15g1::gentoo  USE="extra (pie) static-analyzer -debug -doc (-ieee-long-double) -test -verify-sig -xml" ABI_X86="(64) -32 (-x32)" 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)" PYTHON_SINGLE_TARGET="python3_10 -python3_9 -python3_11" 0 KiB



Only rust seems to take LLVM_TARGETS as X86 and not others.

Also tried setting LLVM_TARGETS="X86" on make.conf but it doesn't respect it. How to fix this?
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 22603

PostPosted: Sat Jan 28, 2023 10:51 pm    Post subject: Reply with quote

Those flags are forced on by $PORTDIR/profiles/base/package.use.force:
Code:
# Michał Górny <mgorny@gentoo.org> (2021-11-04)
# Enable all LLVM targets unconditionally.  Unfortunately, disabling
# targets tend to break reverse dependencies (e.g. Rust) and we are yet
# to find a clean way of resolving that.  Compared to the damage
# potential, the increase of build time is a minor problem.  Users who
# really insist of building a smaller system can un-force the flags
# at their own responsibility.
>=sys-devel/clang-13.0.1_rc llvm_targets_AArch64 llvm_targets_AMDGPU
>=sys-devel/clang-13.0.1_rc llvm_targets_ARM llvm_targets_AVR llvm_targets_BPF
>=sys-devel/clang-13.0.1_rc llvm_targets_Hexagon llvm_targets_Lanai
>=sys-devel/clang-13.0.1_rc llvm_targets_MSP430 llvm_targets_Mips
>=sys-devel/clang-13.0.1_rc llvm_targets_NVPTX llvm_targets_PowerPC
>=sys-devel/clang-13.0.1_rc llvm_targets_RISCV llvm_targets_Sparc
>=sys-devel/clang-13.0.1_rc llvm_targets_SystemZ llvm_targets_WebAssembly
>=sys-devel/clang-13.0.1_rc llvm_targets_X86 llvm_targets_XCore
>=sys-devel/clang-14 llvm_targets_VE
>=sys-devel/clang-16 llvm_targets_LoongArch
>=sys-devel/llvm-13.0.1_rc llvm_targets_AArch64 llvm_targets_AMDGPU
>=sys-devel/llvm-13.0.1_rc llvm_targets_ARM llvm_targets_AVR llvm_targets_BPF
>=sys-devel/llvm-13.0.1_rc llvm_targets_Hexagon llvm_targets_Lanai
>=sys-devel/llvm-13.0.1_rc llvm_targets_MSP430 llvm_targets_Mips
>=sys-devel/llvm-13.0.1_rc llvm_targets_NVPTX llvm_targets_PowerPC
>=sys-devel/llvm-13.0.1_rc llvm_targets_RISCV llvm_targets_Sparc
>=sys-devel/llvm-13.0.1_rc llvm_targets_SystemZ llvm_targets_WebAssembly
>=sys-devel/llvm-13.0.1_rc llvm_targets_X86 llvm_targets_XCore
As the note says, if you need to disable them and are willing to take the risks, you can negate the forced configuration and then disable them.

Rust does not force these flags on because it does not have any reverse dependencies that are known to be sensitive to changing them.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54577
Location: 56N 3W

PostPosted: Sat Jan 28, 2023 11:01 pm    Post subject: Reply with quote

chromatic abberation,

Welcome to Gentoo.

Code:
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)"


The parenthesis () indicates that the option is forced by your profile. Some are forced on, others are forced off.

Before you can change forced settings you need to override your profile to remove the ().
Then LLVM_TARGETS= in make.conf will allow you to change the settings.

If you make entries in /etc/portage/profile/use.mask they will affect all packages that accept those USE flags.
Entries in /etc/portage/profile/package.use.mask are per package.

See https://wiki.gentoo.org/wiki//etc/portage/profile/use.mask and https://wiki.gentoo.org/wiki///etc/portage/profile/package.use.mask.

You also need to know that LLVM_TARGETS is a use expand, so it expands to llvm_targets_AArch64 llvm_targets_AMDGPU ...
I'm not sure if the short form is accepted or not.

That's all the bits you need. I'll leave it for you to put all the bits together, or post back if you need more explicit help.

It may make more problems than it fixes though.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
chromatic abberation
n00b
n00b


Joined: 28 Jan 2023
Posts: 2

PostPosted: Sun Jan 29, 2023 8:49 am    Post subject: Reply with quote

Thanks Hu and NeddySeagoon. :D

Masking them in /etc/portage/profile/package.use.mask did the trick.

Is this a bug with using the hardened profile?
Back to top
View user's profile Send private message
sam_
Developer
Developer


Joined: 14 Aug 2020
Posts: 1946

PostPosted: Sun Jan 29, 2023 8:56 am    Post subject: Reply with quote

chromatic abberation wrote:
Thanks Hu and NeddySeagoon. :D

Masking them in /etc/portage/profile/package.use.mask did the trick.

Is this a bug with using the hardened profile?


No, see Hu's post. Understand the risks (inc. why they're masked in the first place) before unforcing.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54577
Location: 56N 3W

PostPosted: Sun Jan 29, 2023 9:37 am    Post subject: Reply with quote

chromatic abberation,

Answering questions is one thing. How you apply your new knowledge is another.
If you shoot yourself in the foot, that's OK too.

Be aware that this may break other things and as the warning says, you will end up spending more than the build time you have saved recovering.

It's your Gentoo, your way.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
dennisn
Tux's lil' helper
Tux's lil' helper


Joined: 01 Aug 2004
Posts: 119
Location: Montreal, Canada

PostPosted: Sun Dec 24, 2023 6:19 pm    Post subject: Reply with quote

I don't understand why these targets are forced - why would I ever need an ARM target, for example? (I don't have ARM hardware.)
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 22603

PostPosted: Sun Dec 24, 2023 6:58 pm    Post subject: Reply with quote

dennisn wrote:
I don't understand why these targets are forced - why would I ever need an ARM target, for example? (I don't have ARM hardware.)
That is explained in the comment from mgorny that I showed back when the thread was new. In short, changing it after other things have come to depend on it is likely to cause problems due to how the flag is interpreted.
Back to top
View user's profile Send private message
dennisn
Tux's lil' helper
Tux's lil' helper


Joined: 01 Aug 2004
Posts: 119
Location: Montreal, Canada

PostPosted: Sun Dec 24, 2023 7:04 pm    Post subject: Reply with quote

I read that short explanation, I'm looking for more clarity/depth. Again, I have no ARM hardware, so why should I compile it as a "target", for example. (Actually I am forced to use the AMDGPU target, even though I'm pretty sure I don't have anything AMD here. Confusing.)
Back to top
View user's profile Send private message
Havin_it
Veteran
Veteran


Joined: 17 Jul 2005
Posts: 1265
Location: Edinburgh, UK

PostPosted: Sun Jul 07, 2024 3:48 pm    Post subject: Reply with quote

I'm also intrigued about this. Especially I'm wondering if the situation has evolved at all in the past 6 months, after looking at the current ebuilds for the two packages cited as being under breakage-risk from force-disabling targets.

dev-lang/zig/zig-0.12.0.ebuild does not mention LLVM_TARGETS at all. If, as is stated, it needs *all* targets enabled, shouldn't it be enforcing this?

dev-lang/rust/rust-1.78.0.ebuild contains a list of LLVM_TARGETS but I don't understand ebuild syntax well enough to say whether it is requiring llvm to have all these targets enabled, or is actually modifying what targets it builds according to the current llvm's flags.

I've not seen any other packages mentioned as affected, though I imagine those built with the above are affected. And both have -bin ebuilds for which I'd assume it is moot.

I get that this is a knotty problem to solve and justifiably low on any dev's priority list, and I'm nowadays lucky enough to have reasonably powerful hardware within my budget anyway, but my Gentoo sensibilities still abhor the redundancy. And I can't help being a little sceptical about the resource cost of all these added, unnecessary targets really being "negligible". By what measurement?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum