Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 936629 - bootstrap-prefix.sh failures wrt. binutils and cet
Summary: bootstrap-prefix.sh failures wrt. binutils and cet
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Prefix
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-25 12:45 UTC by hsk17
Modified: 2024-08-22 11:07 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
stage2 of failed run of bootstrap-prefix.sh, snapshot 20240721 (bootstrap.stage2.log.xz,124.32 KB, application/x-xz)
2024-07-26 11:32 UTC, hsk17
Details
stage3.log of bootstrap-prefix.sh, snapshot version changed to 20240622 (bootstrap-20240622.stage3.log.xz,848.88 KB, application/x-xz)
2024-07-26 11:34 UTC, hsk17
Details
patch to bootstrap-prefix.sh (bootstrap-prefix.patch,1.18 KB, patch)
2024-08-19 15:30 UTC, hsk17
Details | Diff
failed bootstrap-prefix.sh: last lines of terminal output (last-lines-of-output.txt,5.16 KB, text/plain)
2024-08-20 07:00 UTC, hsk17
Details
an abridged stage3.log of my latest run of bootstrap-prefix.sh (part_of_latest_stage3_log.txt,24.38 KB, text/plain)
2024-08-21 11:56 UTC, hsk17
Details

Note You need to log in before you can comment on or make changes to this bug.
Description hsk17 2024-07-25 12:45:37 UTC
prefix-guest on top of opensuse leap:  current bootstrap-prefix.sh halts on error when trying to build sys-devel/binutils in stage2: "configure: error: compiler and assembler with CET support are required for --enable-cet".  using the previous snapshot 20240622 sort of works, but the final "emerge --depclean" removes sys-devel/binutils, causing all sorts of disaster in subsequent runs of emerge in the newly built prefix.

seems, the two commits to gx86, gitweb.gentoo.org/repo/gentoo.git/commit?id=14f2561 (adding "sys-devel/binutils cet" to amd64/package.use.force) and gitweb.gentoo.org/repo/gentoo.git/commit?id=1d4bc75 (drop amd64?(sys-devel/binutils[cet]) from BDEPEND) need some action in the prefix profile...
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-07-25 13:40:23 UTC
Please include the logs.
Comment 2 hsk17 2024-07-26 11:31:08 UTC
hmmm.  they sum up to about 100 MB, tarred-and-compressed still 2100 KB.

will upload stage2.log from run of (almost) current bootstrap-prefix.sh, snapshot 20240721, and a somewhat shortened stage3.log from run of the same bootstrap-prefix.sh with snapshot version changed to 20240622.  done on opensuse leap 15.6 after "export PREFIX_DISABLE_RAP=yes".  any more logs wanted?

note that the 2 commits cited above date from 20240702.

without sys-devel/binutils installed in the prefix, the hosts' ld is used by an emerge inside the prefix, and the routinely (?) added RUNPATH entry, containing notably PREFIX/usr/x86_64-pc-linux-gnu/lib/gcc and PREFIX/usr/lib, in prefix libraries and binaries is missing in (most of) them.
Comment 3 hsk17 2024-07-26 11:32:44 UTC
Created attachment 898373 [details]
stage2 of failed run of bootstrap-prefix.sh, snapshot 20240721
Comment 4 hsk17 2024-07-26 11:34:01 UTC
Created attachment 898374 [details]
stage3.log of bootstrap-prefix.sh, snapshot version changed to 20240622
Comment 5 hsk17 2024-08-19 15:28:24 UTC
please let me state that bootstrap-prefix.sh, as of now, still fails to
build a prefix instance (prefix-guest as well as RAP) on top of
opensuse leap, i.e., on top of an amd64 system and host gcc not
cet capable.  as "sys-devel/binutils cet" was added recently to
arch/amd64/package.use.force, bootstrap-prefix.sh fails to emerge
sys-devel/binutils in stage2 w/ error message "compiler and assembler
with CET support are required for --enable-cet".  i worked around by
creating "${ROOT}"/tmp/etc/portage/profile/package.use.force and adding
"sys-devel/binutils -cet" there.

next point of trouble, when bootstrapping prefix-guest: recently,
with net-misc/curl-8.9.1, +http3 and +quic were added to curl ebuild's
IUSE flags, resulting in circular dependency net-libs/nghttp3 -->
dev-build/cmake --> net-misc/curl --> net-libs/nghttp3 at the end of
stage3 when "emerge -uDN" is run.  i worked around by adding "-http3
-quic -curl_quic_openssl" to the "export USE=..." statement preceding
that emerge.  (probably these should also go into the myuse array in
do_emerge_pkgs.)

finally, when bootstrapping a prefix-guest, "emerge --depclean" at the
end of stage3 removes sys-devel/binutils from the installed prefix system.
this IMO is obviously a Bad Thing, see above in Comment #2.
i worked around by adding "emerge -n sys-devel/binutils" before that
depclean.  but instead of added to the world file, sys-devel/binutils
should, as it used to, be part of the prefix' gcc dependencies:
  BDEPEND+="prefix-guest? ( amd64? ( ${CATEGORY}/binutils[cet?] ) )"
Comment 6 hsk17 2024-08-19 15:30:33 UTC
Created attachment 900616 [details, diff]
patch to bootstrap-prefix.sh

patch to bootstrap-prefix.sh containing my work-arounds described in comment #5
Comment 7 Larry the Git Cow gentoo-dev 2024-08-19 16:24:49 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=63b269d10e7d752c4ca4f793d428da8b2fd4cd16

commit 63b269d10e7d752c4ca4f793d428da8b2fd4cd16
Author:     Fabian Groffen <grobian@gentoo.org>
AuthorDate: 2024-08-19 16:22:42 +0000
Commit:     Fabian Groffen <grobian@gentoo.org>
CommitDate: 2024-08-19 16:22:42 +0000

    scripts/bootstrap-prefix: try and unify USE-flag disabling
    
    As pointed out by hsk17, we have two places in which we disable
    different sets of USE-flags, try to unify them.
    
    In addition add http3, quic and curl_quic_openssl during bootstrap.
    
    Bug: https://bugs.gentoo.org/936629
    Signed-off-by: Fabian Groffen <grobian@gentoo.org>

 scripts/bootstrap-prefix.sh | 40 ++++++++++++++++++++++++++--------------
 1 file changed, 26 insertions(+), 14 deletions(-)
Comment 8 Fabian Groffen gentoo-dev 2024-08-19 16:29:34 UTC
Nothing depending on binutils seems like a bug, but it seems true on normal systems too.  The fact that sys-libs/db happens to depend on the linker makes it not being removed I guess for musl systems, glibc seems to depend on the linker too, but this is interesting.
Comment 9 Larry the Git Cow gentoo-dev 2024-08-19 16:42:52 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=ae67723b0166b5de843e288b40d56016fffcf192

commit ae67723b0166b5de843e288b40d56016fffcf192
Author:     Fabian Groffen <grobian@gentoo.org>
AuthorDate: 2024-08-19 16:41:45 +0000
Commit:     Fabian Groffen <grobian@gentoo.org>
CommitDate: 2024-08-19 16:41:45 +0000

    scripts/bootstrap-prefix: workaround binutils being dep-cleaned
    
    Thanks hsk17 for noticing and providing a patch.
    
    Bug: https://bugs.gentoo.org/936629
    Signed-off-by: Fabian Groffen <grobian@gentoo.org>

 scripts/bootstrap-prefix.sh | 5 +++++
 1 file changed, 5 insertions(+)
Comment 10 Larry the Git Cow gentoo-dev 2024-08-19 16:56:10 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=a075ebb0f6e2b47034e3d69fdf30a06e6f61af8a

commit a075ebb0f6e2b47034e3d69fdf30a06e6f61af8a
Author:     Fabian Groffen <grobian@gentoo.org>
AuthorDate: 2024-08-19 16:54:35 +0000
Commit:     Fabian Groffen <grobian@gentoo.org>
CommitDate: 2024-08-19 16:54:35 +0000

    scripts/bootstrap-prefix: avoid USE=cet with binutils during bootstrap
    
    the host compiler used may not support CET, causing binutils to fail, so
    wait for that later when we got our own compiler
    
    Thanks hsk17 for the analysis and proposed fix.
    
    Bug: https://bugs.gentoo.org/936629
    Signed-off-by: Fabian Groffen <grobian@gentoo.org>

 scripts/bootstrap-prefix.sh | 4 ++++
 1 file changed, 4 insertions(+)
Comment 11 Fabian Groffen gentoo-dev 2024-08-19 17:01:04 UTC
I applied all three of your fixes, thanks!

Does this resolve the problem completely for you?
Comment 12 hsk17 2024-08-19 17:31:17 UTC
(In reply to Fabian Groffen from comment #11)
> I applied all three of your fixes, thanks!

great, thanks

> Does this resolve the problem completely for you?

seems
  mkdir -p "${ROOT}"/tmp/etc/portage/profile
is actually needed before echoing into package.use.force :-)
Comment 13 Fabian Groffen gentoo-dev 2024-08-19 20:48:05 UTC
weird, then all commands before that that do similar stuff should fail to, and the Solaris bit I added recently and it will fail for sure if that doesn't work ...
Comment 14 hsk17 2024-08-20 06:58:44 UTC
(In reply to Fabian Groffen from comment #13)
> weird, then all commands before that that do similar stuff should fail to,
> and the Solaris bit I added recently and it will fail for sure if that
> doesn't work ...

ROOT/tmp/etc/portage exists and files there can be handled, but package.use.force lives in subdir profile and that subdir has yet to be created.

unfortunately, the re-organisation of the to-be-disabled-use-flags does not yet fully work as expected - stage3 finishes but the circular deps problem now is in the final "emerge -uDN @world".  last lines of the terminal output attached. 
maybe the full set of DISABLE_USE for "emerge -uDN @system" at the end of stage3 is too much?  will have a deeper look into this tonight or tomorrow.
Comment 15 hsk17 2024-08-20 07:00:54 UTC
Created attachment 900729 [details]
failed bootstrap-prefix.sh:  last lines of terminal output
Comment 16 hsk17 2024-08-21 06:41:37 UTC
as stated above, full set of DISABLE_USE flags suppresses install of
net-misc/curl at all in stage3's final "emerge -uDN @system".  thus it
will be pulled in by main bootstrap's final "emerge -uDN @world",
resulting in the noted circular dep.

so i'd say, either explicitly emerge a stripped-down net-misc/curl in
stage3, or run, as it used to be, the "emerge -uDN @system" in stage3
with a somewhat minimal subset of DISABLE_USE.  and then the susequent
"emerge -uDN @world" will get it right.   for me, and for the moment,
running "emerge -uDN @system" in stage3 with
  export USE="-http2 -http3 -quic -curl_quic_openssl"
did the trick.
Comment 17 Fabian Groffen gentoo-dev 2024-08-21 06:44:20 UTC
I added the mkdir and I've reverted to the previous limited set and did some work around it to stage the upgrade.  At least it could resolve without cyclic deps now.
Comment 18 hsk17 2024-08-21 11:55:06 UTC
tried the latest bootstrap-prefix.sh (1c92fe1), but found, "-http2" only
was not enough to inhibit circular dependency w/ curl, seems we need
  export USE="-git -crypt -http2 -http3 -quic -curl_quic_openssl"
preceding "emerge -uDN @system" in stage3.  then bootstrap-prefix.sh
finished ok.  see attached an edited stage3.log.
Comment 19 hsk17 2024-08-21 11:56:42 UTC
Created attachment 900845 [details]
an abridged stage3.log of my latest run of bootstrap-prefix.sh
Comment 20 Fabian Groffen gentoo-dev 2024-08-21 13:21:53 UTC
yes, this is obvious, because I tested on Solaris where quic isn't compiling, so it's masked... duh, sorry
Comment 21 Larry the Git Cow gentoo-dev 2024-08-21 13:30:09 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=715db699226245f555867d8f3774f1f9343f2c8a

commit 715db699226245f555867d8f3774f1f9343f2c8a
Author:     Fabian Groffen <grobian@gentoo.org>
AuthorDate: 2024-08-21 13:27:55 +0000
Commit:     Fabian Groffen <grobian@gentoo.org>
CommitDate: 2024-08-21 13:27:55 +0000

    scripts/bootstrap-prefix: use DISABLE_USE for circular deps
    
    Use set of USE-flags that are necessary to break circular deps, and
    reduce more to just weed unnecessary dependencies.  Use DISABLE_USE for
    the circular ones so they can be properly reused.
    
    Bug: https://bugs.gentoo.org/936629
    Signed-off-by: Fabian Groffen <grobian@gentoo.org>

 scripts/bootstrap-prefix.sh | 38 ++++++++++++++++++++------------------
 1 file changed, 20 insertions(+), 18 deletions(-)
Comment 22 hsk17 2024-08-22 11:07:28 UTC
yes, that works :-)