Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 787572 - app-emulation/virtualbox-6.1.20-r1 kmk_builtin_redirect […]/Runtime/errmsgdata.h Segmentation fault kmk: *** Exiting with status 2
Summary: app-emulation/virtualbox-6.1.20-r1 kmk_builtin_redirect […]/Runtime/errmsgdat...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Viorel Munteanu
Depends on: 788691
  Show dependency tree
Reported: 2021-05-01 22:51 UTC by Thibaud CANALE
Modified: 2023-02-15 12:27 UTC (History)
4 users (show)

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

Build log (in gzip format) (app-emulation:virtualbox-6.1.20-r1:20210501-211149.log.gz,17.00 KB, application/gzip)
2021-05-01 22:51 UTC, Thibaud CANALE
emerge --info 'app-emulation/virtualbox' (file_787572.txt,9.00 KB, text/plain)
2021-05-01 22:53 UTC, Thibaud CANALE
build.log with GCC 10 (build.log.gz,333.08 KB, application/gzip)
2021-05-02 17:55 UTC, Mike Limansky

Note You need to log in before you can comment on or make changes to this bug.
Description Thibaud CANALE 2021-05-01 22:51:44 UTC
Created attachment 705087 [details]
Build log (in gzip format)


app-emulation/virtualbox-6.1.20-r1 compilation fails, as displayed in build log in attachment.
Using GCC 11.1.0 with kernel 5.11.17, and Python 3.8.

[ebuild     U  ] app-emulation/virtualbox-6.1.20-r1:0/6.1::gentoo [6.1.18:0/6.1::gentoo] USE="alsa lvm opengl opus pam pulseaudio qt5 sdk udev -debug -doc -dtrace -headless -java -pax_kernel -python -vboxwebsrv -vnc (-libressl%)" PYTHON_SINGLE_TARGET="python3_8 -python3_7 -python3_9%" 161,690 KiB

Best regards,
Comment 1 Thibaud CANALE 2021-05-01 22:53:00 UTC
Created attachment 705093 [details]
emerge --info 'app-emulation/virtualbox'
Comment 2 Mike Limansky 2021-05-02 17:55:57 UTC
Created attachment 705420 [details]
build.log with GCC 10

I've got compilation error almost in the same stage with stable gcc (10.2.0-r5). But it's a seg fault. Not really sure if it's the same issue or not.
Comment 3 Thibaud CANALE 2021-05-08 03:09:51 UTC
(In reply to Mike Limansky from comment #2)
> Created attachment 705420 [details]
> build.log with GCC 10
> I've got compilation error almost in the same stage with stable gcc
> (10.2.0-r5). But it's a seg fault. Not really sure if it's the same issue or
> not.

Hello Mike,

Indeed, I also have a Segmentation Fault, however still related to kbuild in my case.

Could you please try to recompile dev-util/kbuild, and confirm you might have the same issues than bug #788691? Thanks.

Also, I tried to compile VirtualBox version 6.1.22, I now really think dev-util/kbuild is the root issue.
Comment 4 genBTC 2021-08-23 08:21:53 UTC
I have this bug too.
kmk: *** Exiting with status 2
  GEN {T}/Runtime/errmsgdata.h
kmk_builtin_redirect -wo /var/tmp/portage/app-emulation/virtualbox-6.1.22/work/VirtualBox-6.1.22/out/linux.amd64/release/obj/Runtime/errmsgdata.h -- /usr/bin/kmk_sed -f /var/tmp/portage/app-emulation/virtualbox-6.1.22/work/VirtualBox-6.1.22/src/VBox/Runtime/common/err/errmsg.sed /var/tmp/portage/app-emulation/virtualbox-6.1.22/work/VirtualBox-6.1.22/include/iprt/err.h /var/tmp/portage/app-emulation/virtualbox-6.1.22/work/VirtualBox-6.1.22/include/VBox/err.h
kmk: *** [/var/tmp/portage/app-emulation/virtualbox-6.1.22/work/VirtualBox-6.1.22/src/VBox/Runtime/Makefile.kmk:3667: /var/tmp/portage/app-emulation/virtualbox-6.1.22/work/VirtualBox-6.1.22/out/linux.amd64/release/obj/Runtime/errmsgdata.h] Segmentation fault

I originally had a bug even getting the Kbuild pre-requisite package compiled - Bug #788691, but I managed to hack it and get that compiled, move past it, but now I have this "errmsgdata.h" bug with virtualbox itself.... I have also tried kbuild binaries from debian.
(The errors all manifest the same regardless, likewise between vbox 6.1.20 , .22 and .26 )

-However I can report a partial success!?
I managed to get past this error message, by manually running this command:

# cd /var/tmp/portage/app-emulation/virtualbox-6.1.22/work/VirtualBox-6.1.22/ 
# /usr/bin/kmk_sed -f /var/tmp/portage/app-emulation/virtualbox-6.1.22/work/VirtualBox-6.1.22/src/VBox/Runtime/common/err/errmsg.sed /var/tmp/portage/app-emulation/virtualbox-6.1.22/work/VirtualBox-6.1.22/include/iprt/err.h /var/tmp/portage/app-emulation/virtualbox-6.1.22/work/VirtualBox-6.1.22/include/VBox/err.h > /var/tmp/portage/app-emulation/virtualbox-6.1.22/work/VirtualBox-6.1.22/out/linux.amd64/release/obj/Runtime/errmsgdata.h

That uses "kmk_sed" and uses the shell > to redirect and populates the relevant file "errmsgdata.h" so the build can proceed. For some reason "kmk_builtin_redirect" just segfaults...

Unfortunately, However, this hack/fix alone does not resolve the build. It proceeds past the original "errmsgdata.h" error, compiles somewhat more, but then gets stuck on some "isomaker docbook manual xml" stuff, and that has stumped me, and requires a new bug report, but is likely all related to kbuild somehow. This:

xsltproc docbook-refentry-to-C-help.xsl  - {T}/Runtime/man/isomakercmd-man.xml

The failing command:
$(QUIET)$(call VBOX_XSLTPROC_WITH_CAT, -a+to "$@") --stringparam 'g_sMode' 'cmd' $(VBOX_DOCBOOK_REFENTRY_TO_H_HELP)  /var/tmp/portage/app-emulation/virtualbox-6.1.26/work/VirtualBox-6.1.26/out/linux.amd64/release/obj/Runtime/man/isomakercmd-man.xml
Comment 5 genBTC 2021-08-24 03:32:56 UTC
(In reply to genBTC from comment #4)
I figured everything out finally.
I ended up being able to hack/compile virtualbox.
It required emerge =dev-util/kbuild-9999 (unmasking ~amd64 and using SVN to download  latest revision 3499 from the SVN trunk)
At that point, a bug remained that "kmk -v" resulted in "kmk - kBuild version 0.1.9998 (r0)" (revision 0) - the "revision 3499" did not get compiled in, and there is a check for this version number in Virtualbox's Config.KMK file @ line 177 that checks for the revision. I commented that entire check revision section out, and re-ran the ebuild compile. successfully.

There was 1 additional bug partway through involving "iPxeBaseBin".
for some reason there is a giant linker command being run that tries to execute "N" --no-check-sections --gc-sections, it says "N not found" - Its obvious it should actually use "ld" instead. Copying and pasting that giant command, and manually running it with "ld", (also manually re-did the next "objcopy" step, since it was shown as failing also), then re-ran the ebuild compile...

Then it worked!
ebuild install , ebuild qmerge.

The moral of the story is:
we need Kbuild fixed in gentoo (I advise bundling the 3499 revision from trunk into a .tar.gz file (because SVN had a bunch of pre-reqs), and creating a new .3499 ebuild that does whatever the -9999 version does, with 1 extra patch to make sure the binary gets marked as revision 3499 instead of 0).
and we need Virtualbox fixed in gentoo (patch the iPxeBaseBin: N -> ld bug) the specifics of which/why are beyond me.
Comment 6 Larry the Git Cow gentoo-dev 2021-08-25 08:39:44 UTC
The bug has been referenced in the following commit(s):

commit 68e5e01daa13f366aa7faccc63c10575e6f972e9
Author:     Lars Wendler <>
AuthorDate: 2021-08-25 08:36:15 +0000
Commit:     Lars Wendler <>
CommitDate: 2021-08-25 08:39:30 +0000

    dev-util/kbuild: Bump to version 0.1.9998.3499
    Thanks-to: <>
    Signed-off-by: Lars Wendler <>

 dev-util/kbuild/Manifest                           |  1 +
 .../kbuild/files/kbuild-0.1.9998.3499-gold.patch   | 15 +++++
 ...98.3499-kash-no_separate_parser_allocator.patch | 11 ++++
 dev-util/kbuild/kbuild-0.1.9998.3499.ebuild        | 75 ++++++++++++++++++++++
 4 files changed, 102 insertions(+)
Comment 7 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2021-08-25 08:40:48 UTC
Please give dev-util/kbuild-0.1.9998.3499 a try and report back your results.
Comment 8 genBTC 2021-11-14 22:26:58 UTC
(In reply to Lars Wendler (Polynomial-C) from comment #7)
> Please give dev-util/kbuild-0.1.9998.3499 a try and report back your results.

Sorry for taking so long to get back to you but the KBuild link stage is still bugged.
see other bugpage:
Comment 9 Viorel Munteanu gentoo-dev 2023-01-08 09:58:05 UTC
This is caused by bug #788691

Even with kmk compiled, virtualbox fails to build on a hardened kernel.