On 10/9/20 9:27 AM, Ashley Dixon wrote:
On Fri, Oct 09, 2020 at 12:26:17AM +0000, Jonathan Yong wrote:
I'm open to fixing ebuild packages by myself in my own overlay, though I
prefer not to due to eventual bit rot. Any hints on how to mask CPU USE
flags based on multilib arch in the .ebuild file itself?

I suppose you could detect whether a CPU_FLAG is enabled for a x86_32  multilib,
although be wary that `MULTILIB_ABI_FLAG` is only  exported  for  some  multilib
functions, such as `multilib_src_configure` [1]:

         if [[ ${MULTILIB_ABI_FLAG} == abi_x86_32 ]] && use cpu_flags_x86_avx2;
         then
                ewarn "Disabling AVX2 extensions for 32-bit build."
                # circumvention measures
        fi

I'm not sure of the best way to achieve the "circumvention measures", hence  the
comment.  You could run this conditional after  GLOBALCMAKEARGS  has  been  set,
omitting the CPU_BASELINE definition in the main block [2],  or  you  could  sed
through the USE flags and disable `cpu_flags_x86_avx2` there.   You're  probably
better asking on IRC for the best-practice way to achieve this.


OK, thanks for the hints, I had something similar when I tried /etc/portage/bashrc, so MULTILIB_ABI_FLAG is the variable to look out for.

I will try this next time if another package misbehaves with AVX2. I'm OK with trial and error learning.

As mentioned in the relevant bug report, this is not  an  issue  caused  by  the
ebuild, so although this might prove to be a temporary fix, it will hopefully be
resolved by upstream very soon. Just be patient. ;-)
> [1]
https://wiki.gentoo.org/wiki/Project:Multilib/multilib-build#MULTILIB_ABI_FLAG
[2] 
https://github.com/opencv/opencv/wiki/CPU-optimizations-build-options#customizing-cmake-options
[3] https://bugs.gentoo.org/747163#c15


I'm not so worried about OpenCV itself, since it is very much an active project.

The notion that I am unable to fix a problem myself, on a system that I own, because of some technicality, even as a temporary measure is disconcerting. Controlling every piece of how a software is configured, built and installed is why I love Gentoo's portage system so much.

Reply via email to