Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 909009 - dev-qt/qtwebengine: No progress information from parallel build with ninja
Summary: dev-qt/qtwebengine: No progress information from parallel build with ninja
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Qt Bug Alias
URL:
Whiteboard:
Keywords:
Depends on: 911938
Blocks:
  Show dependency tree
 
Reported: 2023-06-22 18:29 UTC by Jonathan Marten
Modified: 2023-11-29 11:38 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 Jonathan Marten 2023-06-22 18:29:18 UTC
The build system for qtwebengine is complex, but in summary it runs the usual 'make' command which itself runs 'ninja' in a subprocess to actually build the source.  The problem is that the 'make' is run with the standard '-j jobs' option which causes it to buffer the output of any subprocess until it completes, and 'ninja' is run with the same parallel option.  Since 'ninja' builds the entire source, which can take several hours, no progress output is shown until it completes, at which point all of the output is dumped.  It would be far more useful to see the progress output as it is generated.

Partial process tree while building:

1067453  /usr/bin/python3.11 /usr/lib/python-exec/python3.11/emerge -a -1 --autounm
1068696  \_ /usr/bin/python3.11 /usr/lib/portage/python3.11/pid-ns-init 1068697
1068697     \_ /usr/bin/python3.11 /usr/lib/portage/python3.11/pid-ns-init 250 25
1068700        \_ [dev-qt/qtwebengine-5.15.9_p20230505] sandbox /usr/lib/portage
1068701           \_ bash /usr/lib/portage/python3.11/ebuild.sh compile
1068717              \_ bash /usr/lib/portage/python3.11/ebuild.sh compile
1068724                 \_ bash /usr/lib/portage/python3.11/ebuild-helpers/emake
1068726                     \_ make -j4
1068728                        \_ make -f Makefile
1069350                            \_ make -f Makefile
1069360                               \_ make -f Makefile.gn_run
1069435                                  \_ ninja -j4 -l0 -v -C /var/tmp/p
1069461                                     \_ /usr/bin/x86_64-pc-linux-gcc
                                            \_ [more gcc processes]

Tracing shows that process 1068726 (make -j4) is waiting for 1069360 (make -f Makefile.gn_run) to finish before it displays its output, but process 1069435 (ninja) will not finish until the complete source is built.


Reproducible: Always

Steps to Reproduce:
1.  emerge qtwebengine
2.  Wait until the configuration phase is finished and the message "Done. Made 14717 targets from 2324 files in 11065ms" is displayed.
3.  Wait several hours with no progress output.
4.  Observer that the progress is dumped in one black just before the compile phase finishes.

Actual Results:  
Long delay with no progress output at step 3.


Expected Results:  
Progress output displayed while the build is in progress.


Workaround: set the qtwebengine build environment to

NINJAFLAGS="-j6 -l8 -v"
MAKEOPTS="-j1"

at the cost of not performing the first part of the build (creating 'gn') in parallel.


ebuild version: dev-qt/qtwebengine-5.15.9_p20230505

emerge --info:

Portage 3.0.46 (python 3.11.3-final-0, default/linux/amd64/17.1/systemd/merged-usr, gcc-12, glibc-2.36-r8, 5.15.69-gentoo-x86_64 x86_64)
=================================================================
System uname: Linux-5.15.69-gentoo-x86_64-x86_64-AMD_A8-9600_RADEON_R7,_10_COMPUTE_CORES_4C+6G-with-glibc2.36
KiB Mem:     7586900 total,   2312712 free
KiB Swap:   16777212 total,  16751100 free
Timestamp of repository gentoo: Tue, 20 Jun 2023 10:30:01 +0000
Head commit of repository gentoo: 3cac361206f51b91780d3bcc50a41f98f0e191f1
sh bash 5.1_p16-r4
ld GNU ld (Gentoo 2.39 p6) 2.39.0
app-misc/pax-utils:        1.3.5::gentoo
app-shells/bash:           5.1_p16-r4::gentoo
dev-lang/perl:             5.36.0-r2::gentoo
dev-lang/python:           3.10.11::gentoo, 3.11.3::gentoo
dev-lang/rust-bin:         1.69.0::gentoo
dev-util/cmake:            3.26.4-r1::gentoo
dev-util/meson:            1.1.1::gentoo
sys-apps/baselayout:       2.13-r1::gentoo
sys-apps/sandbox:          2.30-r1::gentoo
sys-apps/systemd:          253.3-r1::gentoo
sys-devel/autoconf:        2.71-r6::gentoo
sys-devel/automake:        1.16.5::gentoo
sys-devel/binutils:        2.39-r5::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/gcc:             12.2.1_p20230428-r1::gentoo
sys-devel/gcc-config:      2.10::gentoo
sys-devel/libtool:         2.4.7-r1::gentoo
sys-devel/llvm:            16.0.5::gentoo
sys-devel/make:            4.4.1-r1::gentoo
sys-kernel/linux-headers:  6.1::gentoo (virtual/os-headers)
sys-libs/glibc:            2.36-r8::gentoo
Repositories:

gentoo
    location: /mnt/auto/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    volatile: True
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-metamanifest: yes
    sync-rsync-extra-opts: 
    sync-rsync-verify-jobs: 1

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE fairuse freedist NVIDIA-r2 Kermit bh-luxi google-chrome AdobeFlash-11.x all-rights-reserved unRAR free-noncomm linux-fw-redistributable no-source-code"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=amdfam10 -mtune=native -pipe -fno-diagnostics-show-option -fno-diagnostics-show-caret"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d"
CXXFLAGS="-O2 -march=amdfam10 -mtune=native -pipe -fno-diagnostics-show-option -fno-diagnostics-show-caret"
DISTDIR="/var/tmp/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://www.mirrorservice.org/sites/distfiles.gentoo.org/ http://mirror.bytemark.co.uk/gentoo/"
LANG="en_GB.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LEX="flex"
LINGUAS="en en_GB de fr"
MAKEFLAGS="-j6"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
SHELL="/bin/bash"
USE="X aac acl alsa amd64 bash-completion bzip2 cdr cli crypt cups dbus dri exif ffmpeg fortran ftp gdbm gif iconv jpeg jpeg2k libtirpc mmx mmxext mp3 multilib ncurses nls nptl ogg opengl openmp pam pcre pdf png readline samba seccomp sse sse2 sse3 ssl svg systemd test-rust tiff truetype udev unicode usb vim-syntax vorbis wmf xattr xface xml xpm zlib" ABI_X86="64" ADA_TARGET="gnat_2021" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 sse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="evdev" KERNEL="linux" L10N="en en-GB de fr" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_11" RUBY_TARGETS="ruby26" VIDEO_CARDS="dummy fbdev vesa vga radeon amdgpu radeonsi" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, MAKE, MAKEOPTS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-06-22 23:27:32 UTC
Hm, is this because of the default in newer Portage? But you have MAKEOPTS="-j6"...
Comment 2 Oskari Pirhonen 2023-06-23 03:24:39 UTC
From the --info output:

    MAKEFLAGS="-j6"
    Unset:  ... MAKEOPTS, ...

Portage doesn't take into account MAKEFLAGS when deciding on whether to use default values or not[1]. The question is, should it do that?

1: https://github.com/gentoo/portage/blob/f537f520422af0900049c760b435ab3e0938240d/lib/portage/package/ebuild/doebuild.py#L588
Comment 3 Jonathan Marten 2023-06-23 06:38:33 UTC
Ignore the MAKEFLAGS="-j6" in the emerge --info output, this is set in my make.conf but does not seem to be used anywhere - it may be a historical artifact.  MAKEOPTS is not set in make.conf which means that it is calculated automatically by doebuild.py (for 4 CPUs).  The option for Ninja is manually set in the package environment file, any value will work here.
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-06-23 06:41:45 UTC
No, make will respect MAKEFLAGS. It's relevant to whether the default for output synchronisation we added in Portage should be used or not.
Comment 5 Jonathan Marten 2023-06-23 08:30:36 UTC
Confirmed that the same happens (make -j4, ninja -j4, no progress output) if neither MAKEFLAGS nor MAKEOPTS is set in make.conf or environment.
Comment 6 Oskari Pirhonen 2023-06-24 04:33:08 UTC
Yes, that is expected behavior. Portage is "blind" to MAKEFLAGS in make.conf, and makes it's decisions purely on whether MAKEOPTS is set or not. In the case out output synchronization, it adds an extra check if GNUMAKEFLAGS is set to avoid clobbering it on the off chance someone has GNU Make-specific options set (so setting either one will prevent the default output synchronization from being set as well).
Comment 7 Oskari Pirhonen 2023-06-24 04:40:42 UTC
Instead of setting MAKEOPTS="-j1" in the qtwebengine env file, you should be able to set MAKEOPTS="-j$(nproc)" and see the same progress output because now MAKEOPTS is set which prevents the output synchronization default from taking effect.
Comment 8 Jonathan Marten 2023-06-24 10:30:51 UTC
Confirmed that with no MAKE* settings in make.conf but setting

NINJAFLAGS="-j7 -l8 -v"
MAKEOPTS="-j5"

in package env file (random numbers just to make it clear where they come from) results in parallel build of both gn and engine but with logging as expected:

   9739           \_ make -j5
  10450               \_ ninja -j7 -l8 -v -C /var/tmp/portage/dev-qt/qtwebengine-

with the environment of process 9739 containing

MAKEOPTS=-j5

Removing MAKEOPTS from the package anv file and allowing it to be automatically calculated gives (no logging in this case):

  12244           \_ make -j4
  12954               \_ ninja -j7 -l8 -v -C /var/tmp/portage/dev-qt/qtwebengine-

with the environment of process 12244 containing

MAKEOPTS=-j4
GNUMAKEFLAGS=--output-sync=line
Comment 9 Jonathan Marten 2023-06-27 08:52:03 UTC
Same problem (no logging until build complete) also seen with net-libs/nodejs,
same workaround.
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-08-08 06:00:32 UTC
(In reply to Oskari Pirhonen from comment #6)
> Yes, that is expected behavior. Portage is "blind" to MAKEFLAGS in
> make.conf, and makes it's decisions purely on whether MAKEOPTS is set or
> not. In the case out output synchronization, it adds an extra check if
> GNUMAKEFLAGS is set to avoid clobbering it on the off chance someone has GNU
> Make-specific options set (so setting either one will prevent the default
> output synchronization from being set as well).

Let's go off MAKEFLAGS as well, even though it's odd for people to set it.
Comment 11 Larry the Git Cow gentoo-dev 2023-08-19 15:05:22 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=87d0a7447f1464157f18a8ba0991719777003325

commit 87d0a7447f1464157f18a8ba0991719777003325
Author:     Oskari Pirhonen <xxc3ncoredxx@gmail.com>
AuthorDate: 2023-08-13 03:11:15 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-08-19 15:05:19 +0000

    doebuild: gate -Oline behind MAKEFLAGS check
    
    Add a check to see if MAKEFLAGS is set (alongside the existing MAKEOPTS
    and GNUMAKEFLAGS checks) before enabling output synchronization.
    
    This is only tangentially related to the bug below via being a (likely
    rare) case of MAKEFLAGS being set in the wild.
    
    Bug: https://bugs.gentoo.org/909009
    Signed-off-by: Oskari Pirhonen <xxc3ncoredxx@gmail.com>
    Signed-off-by: Sam James <sam@gentoo.org>

 lib/portage/package/ebuild/doebuild.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 12 Oskari Pirhonen 2023-08-19 21:47:49 UTC
Note that this bug shouldn't be automatically closed with the portage-3.0.51 release IMO since it alone doesn't really address the underlying issue.

An idea I have for actually fixing it is to remove any output synchronization in the relevant ebuilds themselves. Maybe by either checking for the option in the vars or just unconditionally appending `--output-sync=none`.
Comment 13 Larry the Git Cow gentoo-dev 2023-08-20 07:58:36 UTC
The bug has been closed via the following commit(s):

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

commit a6a68c0255b6d3132dd555b1519a035204bffde2
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-08-20 07:57:47 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-08-20 07:58:22 +0000

    sys-apps/portage: add 3.0.51
    
    Bug: https://bugs.gentoo.org/587484
    Closes: https://bugs.gentoo.org/673624
    Closes: https://bugs.gentoo.org/691434
    Closes: https://bugs.gentoo.org/835927
    Closes: https://bugs.gentoo.org/909009
    Closes: https://bugs.gentoo.org/911335
    Closes: https://bugs.gentoo.org/911629
    Closes: https://bugs.gentoo.org/911938
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-apps/portage/Manifest              |   1 +
 sys-apps/portage/portage-3.0.51.ebuild | 234 +++++++++++++++++++++++++++++++++
 2 files changed, 235 insertions(+)
Comment 14 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-29 05:16:37 UTC
We should pass -Onone like we do in nodejs:

commit 223940a28118fc34c3cc2c7b630b83ddc6d9de99
Author: Sam James <sam@gentoo.org>
Date:   Wed Nov 29 05:12:21 2023 +0000

    net-libs/nodejs: adapt to newer Portage's make output synchronisation

    Newer Portage defaults to GNU Make's output synchronisation if no MAKEOPTS
    are set by the user. nodejs's Makefile fires up a ninja process which then does all the
    work, so everything gets buffered and shown at once (once all of nodejs is built).

    Pass -Onone to override the Portage default as it's not helpful here.

    Closes: https://bugs.gentoo.org/917245
    Signed-off-by: Sam James <sam@gentoo.org>
Comment 15 Ionen Wolkens gentoo-dev 2023-11-29 11:38:56 UTC
I assume qt6 doesn't need to do anything here? I don't think it still use make for anything (unless I'm missing something that gn does) and output looks normal to me.