Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 890752 - app-portage/portage-utils[openmp] requires gcc[openmp] in catalyst
Summary: app-portage/portage-utils[openmp] requires gcc[openmp] in catalyst
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Fabian Groffen
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-13 21:09 UTC by Damien Moody (audiodef)
Modified: 2024-01-26 20:25 UTC (History)
5 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 Damien Moody (audiodef) 2023-01-13 21:09:47 UTC
This is new... portage-utils now fails in catalyst stage3 with "Enable OpemMP support by building sys-devel/gcc with USE='openmp'". 

Reproducible: Always

Steps to Reproduce:
1. Download latest stage3 from gentoo to use as seed
2. catalyst -af stage1.spec && catalyst -af stage2.spec && catalyst -af stage3.spec
Actual Results:  
catalyst -af stage3.spec fails

Expected Results:  
gcc should already be compiled with openmp.
Comment 1 Damien Moody (audiodef) 2023-01-13 23:05:38 UTC
Just an observation... chrooted into my stage3 dir. emerge --pretend portage-utils does pull in gcc[openmp]. It seems like pkg_pretend stops the emerge from proceeding even though gcc would get recompiled with openmp before getting to portage-utils.
Comment 2 Fabian Groffen gentoo-dev 2023-01-14 08:44:16 UTC
This new openmp handling was introduced in commit 152cba16dd90e36b4e8abd4c4445adee321a37d3

https://bugs.gentoo.org/867076 is the source for that, point 3 mentions the OpenMP part.

@soap do you have any thoughts on what's going on here?
Comment 3 Mike Gilbert gentoo-dev 2023-01-15 02:29:58 UTC
(In reply to Damien Moody (audiodef) from comment #0)

I think the problem lies with your catalyst-based process. You may need to alter it to rebuild gcc with the required USE flags.
Comment 4 Mike Gilbert gentoo-dev 2023-01-15 02:31:56 UTC
Also, moving the tc-check-openmp from pkg_pretend to pkg_setup in the portage-utils ebuild would probably help here.
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-01-15 15:37:39 UTC
Right, the OpenMP dep is necessary-but-not-sufficient, so we should add it.

pkg_pretend vs pkg_setup (or both) is hard because pkg_pretend may fail even if GCC is queued for a rebuild to enable OpenMP before portage-utils.

(We've had various issues with the linux-headers check in the glibc ebuild, for example, with this.)
Comment 6 Damien Moody (audiodef) 2023-01-15 15:47:31 UTC
(In reply to Mike Gilbert from comment #3)
> (In reply to Damien Moody (audiodef) from comment #0)
> 
> I think the problem lies with your catalyst-based process. You may need to
> alter it to rebuild gcc with the required USE flags.

Could be! I've been trying to figure out how. Haven't been successful so far with a modified portage-utils ebuild. The other thing I'm thinking about is scripting a dive into the stage2 to rebuild gcc. Catalyst would then start stage3 with gcc[openmp] done. (I thought it was already supposed to be that way, though, but I'm not l337.)
Comment 7 Mike Gilbert gentoo-dev 2023-01-15 15:52:37 UTC
(In reply to Sam James from comment #5)
> Right, the OpenMP dep is necessary-but-not-sufficient, so we should add it.

Based on reading the tc-check-openmp function, the dep would need to be something like:

|| ( sys-devel/gcc[openmp] sys-libs/libomp )

If we added a clang USE flag, we could be more specific.

!clang? ( sys-devel/gcc[openmp] )
clang? ( sys-libs/libomp )

It might be good idea to add a virtual for this to avoid repeating it across any package that needs openmp support.
Comment 8 Damien Moody (audiodef) 2023-03-27 23:48:13 UTC
Has there been any movement on this? I was forced to resolve it by masking newer versions of portage-utils, but this issue is still stopping my catalyst builds.
Comment 9 Fabian Groffen gentoo-dev 2023-03-28 06:53:24 UTC
Can you force -openmp for portage-utils to work around this during this stage?  I doubt you'll really need multi-threading support at this point.
Comment 10 Damien Moody (audiodef) 2023-03-29 21:24:15 UTC
I noted that older versions of portage-utils had no pkg_pretend stage, so I pushed a modified version of the current portage-utils to Gentoo Studio's overlay without pkg_pretend. It compiled successfully in stage3.
Comment 11 sancoder 2023-05-26 06:53:48 UTC
Hit the same bug.
tc-check-openmp fails because of absence of omp.h
/tmp # cat t.c
===
#include <omp.h>
int main(void) {
        int nthreads, tid, ret = 0;
        #pragma omp parallel private(nthreads, tid)
        {
        tid = omp_get_thread_num();
        nthreads = omp_get_num_threads(); ret += tid + nthreads;
        }
        return ret;
}

/tmp # gcc -fopenmp t.c
t.c:1:10: fatal error: omp.h: No such file or directory
    1 | #include <omp.h>
      |          ^~~~~~~
compilation terminated.
===

If file omp.h is placed into <chroot_base>/usr/include and libgomp.* into <chroot_base>/usr/lib building continues.
Not sure how to check if gcc really has openmp support.
Comment 12 Ben Kohler gentoo-dev 2023-06-27 15:40:17 UTC
(In reply to Fabian Groffen from comment #9)
> Can you force -openmp for portage-utils to work around this during this
> stage?  I doubt you'll really need multi-threading support at this point.

Do you mind if I add the dep suggested in comment #7 and remove the pkg_pretend check, so that gcc gets queued for rebuild for +openmp (or libomp is queued for install) and is ready by the time pkg_setup is run?

Thanks
Comment 13 Fabian Groffen gentoo-dev 2023-06-27 19:13:53 UTC
(In reply to Ben Kohler from comment #12)
> (In reply to Fabian Groffen from comment #9)
> > Can you force -openmp for portage-utils to work around this during this
> > stage?  I doubt you'll really need multi-threading support at this point.
> 
> Do you mind if I add the dep suggested in comment #7 and remove the
> pkg_pretend check, so that gcc gets queued for rebuild for +openmp (or
> libomp is queued for install) and is ready by the time pkg_setup is run?
> 
> Thanks

QA added the current code in 152cba16dd90e36b4e8abd4c4445adee321a37d3.  Before that, the code looked somewhat like the suggestion, e.g. ec3307e507ccfc092371f8e16ea40ff50557ca9f.

That said, I'm not going to stop you, but in my experience QA is not flexible, and I expect you to deal with them if the need should arise.
Comment 14 Larry the Git Cow gentoo-dev 2023-06-29 19:57:34 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c9f4376eb1b1ac1134fa71e74c52b53c594635c2

commit c9f4376eb1b1ac1134fa71e74c52b53c594635c2
Author:     Ben Kohler <bkohler@gentoo.org>
AuthorDate: 2023-06-28 15:02:30 +0000
Commit:     Ben Kohler <bkohler@gentoo.org>
CommitDate: 2023-06-29 19:57:26 +0000

    app-portage/portage-utils: make best effort to get gcc[openmp] installed
    
    Bug: https://bugs.gentoo.org/890752
    
    Signed-off-by: Ben Kohler <bkohler@gentoo.org>

 .../portage-utils/portage-utils-0.95-r1.ebuild     | 75 ++++++++++++++++++++++
 .../portage-utils/portage-utils-0.96-r1.ebuild     | 75 ++++++++++++++++++++++
 .../portage-utils/portage-utils-9999.ebuild        |  8 +--
 3 files changed, 154 insertions(+), 4 deletions(-)
Comment 15 Fabian Groffen gentoo-dev 2024-01-26 20:25:38 UTC
assuming sufficiently fixed