Gentoo Archives: gentoo-user

From: Jonathan Yong <10walls@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Re: Multilib ABI specific CPU use flags?
Date: Sat, 10 Oct 2020 03:47:47
Message-Id: 2727317b-2680-ce84-08f4-86629ab61132@gmail.com
In Reply to: Re: [gentoo-user] Re: Multilib ABI specific CPU use flags? by Ashley Dixon
1 On 10/9/20 9:27 AM, Ashley Dixon wrote:
2 > On Fri, Oct 09, 2020 at 12:26:17AM +0000, Jonathan Yong wrote:
3 >> I'm open to fixing ebuild packages by myself in my own overlay, though I
4 >> prefer not to due to eventual bit rot. Any hints on how to mask CPU USE
5 >> flags based on multilib arch in the .ebuild file itself?
6 >
7 > I suppose you could detect whether a CPU_FLAG is enabled for a x86_32 multilib,
8 > although be wary that `MULTILIB_ABI_FLAG` is only exported for some multilib
9 > functions, such as `multilib_src_configure` [1]:
10 >
11 > if [[ ${MULTILIB_ABI_FLAG} == abi_x86_32 ]] && use cpu_flags_x86_avx2;
12 > then
13 > ewarn "Disabling AVX2 extensions for 32-bit build."
14 > # circumvention measures
15 > fi
16 >
17 > I'm not sure of the best way to achieve the "circumvention measures", hence the
18 > comment. You could run this conditional after GLOBALCMAKEARGS has been set,
19 > omitting the CPU_BASELINE definition in the main block [2], or you could sed
20 > through the USE flags and disable `cpu_flags_x86_avx2` there. You're probably
21 > better asking on IRC for the best-practice way to achieve this.
22 >
23
24 OK, thanks for the hints, I had something similar when I tried
25 /etc/portage/bashrc, so MULTILIB_ABI_FLAG is the variable to look out for.
26
27 I will try this next time if another package misbehaves with AVX2. I'm
28 OK with trial and error learning.
29
30 > As mentioned in the relevant bug report, this is not an issue caused by the
31 > ebuild, so although this might prove to be a temporary fix, it will hopefully be
32 > resolved by upstream very soon. Just be patient. ;-)
33 > > [1]
34 https://wiki.gentoo.org/wiki/Project:Multilib/multilib-build#MULTILIB_ABI_FLAG
35 > [2] https://github.com/opencv/opencv/wiki/CPU-optimizations-build-options#customizing-cmake-options
36 > [3] https://bugs.gentoo.org/747163#c15
37 >
38
39 I'm not so worried about OpenCV itself, since it is very much an active
40 project.
41
42 The notion that I am unable to fix a problem myself, on a system that I
43 own, because of some technicality, even as a temporary measure is
44 disconcerting. Controlling every piece of how a software is configured,
45 built and installed is why I love Gentoo's portage system so much.