Patch and resume compilation of a failed package in Gentoo – ebuild, local repository or ctrl+Z

Author:

A dependency package failed to compile throwing error and existing the emerge of a queue with a hundred and more packages. Or worse you installed a new version of a package and multiple rebuilds are pulled, but one of the dependencies fails and you may end up with a broken system? What can you do? There is no new version of the failed package and yes, there is a bug in the Gentoo’s Bugzilla – https://bugs.gentoo.org/. And there is a solution with a patch, which has not made its way to the production and in Gentoo portage yet.
The package in the portage is broken, no new fixed package is released, but there is a patch to fix your issue. Here is what you can do:

  • Make your own package with the fixed version of the original package and put it in your local repository (not the official one, because on every emerge –sync it will be deleted). You should make a local repository and put the ebuild and all necessary files.
  • Or just download the patch and patch the source in the directory, which still holds the source of the failed package and resume the compilation manually. Then install it. Using this tutorial – Resume installation after a package build error, when emerging firefox under Gentoo
  • Just after the uncompress operation of the emerge press CTRL+Z to put the operation in the background and download and patch. Then bring back the emerge from the background with “fg” command.

The second and third options are not permanent solutions, but they are fast enough to be used in some situations.
Here are steps for the first and second option you may have:

OPTION 1) Make your own package.

Create a local repository (for details Simple steps to create Gentoo custom repository and add a package):

root@srv ~ # mkdir -p /var/db/repos/my-local-portage/{metadata,profiles}
root@srv ~ # cat  << 'EOF' > /var/db/repos/my-local-portage/metadata/layout.conf
masters = gentoo
auto-sync = false
EOF
root@srv ~ # cat  << 'EOF' > /etc/portage/repos.conf/my-local-portage.conf
[my-local-portage]
location = /var/db/repos/my-local-portage 
EOF
root@srv ~ # cat  << 'EOF' > /var/db/repos/my-local-portage/profiles/repo_name
my-local-portage
EOF

Copy the ebuild file of the package you want to modify in the custom repository directory created above (it’s a good idea to copy all the sub-directories, too):

root@srv ~ # mkdir -p /var/db/repos/my-local-portage/sys-apps/bubblewrap
root@srv ~ # cp /usr/portage/sys-apps/bubblewrap/bubblewrap-0.3.1-r1.ebuild /var/db/repos/my-local-portage/sys-apps/bubblewrap/
root@srv ~ # cd /var/db/repos/my-local-portage/sys-apps/bubblewrap/
root@srv bubblewrap # mkdir files
root@srv bubblewrap # wget -O ./files/compilation-error.patch "https://674312.bugs.gentoo.org/attachment.cgi?id=563722"
--2020-02-06 23:27:02--  https://674312.bugs.gentoo.org/attachment.cgi?id=563722
Resolving 674312.bugs.gentoo.org... 204.187.15.4, 2607:fcc0:4:ffff::4
Connecting to 674312.bugs.gentoo.org|204.187.15.4|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5208 (5.1K) [text/plain]
Saving to: './files/compilation-error.patch'

./files/compilation-error.patch                  100%[========================================================================================>]   5.09K  --.-KB/s    in 0s      

2020-02-06 23:27:04 (196 MB/s) - './files/compilation-error.patch' saved [5208/5208]

Edit the file bubblewrap-0.3.1-r1.ebuild in the custom repository (i.e. /var/db/repos/my-local-portage/sys-apps/bubblewrap/bubblewrap-0.3.1-r1.ebuild) and add the following (we included the diff between edited bubblewrap-0.3.1-r1.ebuild and the orginal file):

root@srv bubblewrap # diff bubblewrap-0.3.1-r1.ebuild /usr/portage/sys-apps/bubblewrap/bubblewrap-0.3.1-r1.ebuild 
39,43d38
< src_prepare() {
<         eapply "${FILESDIR}"/compilation-error.patch
<         eapply_user
< }
<

Generate the manifest file with:

root@srv bubblewrap # ebuild bubblewrap-0.3.1-r1.ebuild manifest
>>> Downloading 'ftp://ftp.free.fr/mirrors/ftp.gentoo.org/distfiles/18/bubblewrap-0.3.1.tar.xz'
--2020-02-06 20:58:18--  ftp://ftp.free.fr/mirrors/ftp.gentoo.org/distfiles/18/bubblewrap-0.3.1.tar.xz
           => '/usr/portage/distfiles/bubblewrap-0.3.1.tar.xz.__download__'
Resolving ftp.free.fr... 212.27.60.27, 2a01:e0c:1:1598::1
Connecting to ftp.free.fr|212.27.60.27|:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done.    ==> PWD ... done.
==> TYPE I ... done.  ==> CWD (1) /mirrors/ftp.gentoo.org/distfiles/18 ... done.
==> SIZE bubblewrap-0.3.1.tar.xz ... 209924
==> PASV ... done.    ==> RETR bubblewrap-0.3.1.tar.xz ... done.
Length: 209924 (205K) (unauthoritative)

bubblewrap-0.3.1.tar.xz                    100%[========================================================================================>] 205.00K  1.05MB/s    in 0.2s    

2020-02-06 20:58:18 (1.05 MB/s) - '/usr/portage/distfiles/bubblewrap-0.3.1.tar.xz.__download__' saved [209924]

>>> Creating Manifest for /var/db/repos/my-local-portage/sys-apps/bubblewrap

Here is what you should have in the manifest file

root@srv bubblewrap # cat Manifest
AUX compilation-error.patch 5208 BLAKE2B 69db3066eebae54d34f02a02aa053a6bf5ed675329b3d18a4f261529a434d1c9dbfb637a3f96f4079a6adba586b666d7890370c8761c92dc9450f096a8368bbe SHA512 f6515a25c6b311c9b8336761c7daea2440964982f8a7a6587b6707ef9e9a5705ec380e13982b0765af205c221724ef418b44c3efd1b6e5f0c1788b143a88ef17
DIST bubblewrap-0.3.1.tar.xz 209924 BLAKE2B bacc4080106cd9876bf0e1ad866a7397d7d232e61a720b52b5a6b9b0d860e625511ed15ac630aa71003fb9fa145ffa9d08ae2e6ba6d1411fd75e7d9568312717 SHA512 74e36caa56540a956158445f5f38c7ac5f7ff3c733ecaf85893de4607900e1fe4050db86a4435cbe18d722e90c5b39c466c555ea8ea8d4944da6207ef1011d67
EBUILD bubblewrap-0.3.1-r1.ebuild 1144 BLAKE2B b80bf80f7d6907446e5972d11f525d752af4dccb4a84490ccb24c62da6e17f5cedd06cd1e39554414e74ad2f5fc2759dd585aa56d9f9c45bb1447f26923d839b SHA512 75a68b691a485202292b34fc19226e2284e068eb77196385de53360d502af315cfe7021d18d629a4b141175ddb873d018872479ed020b519a6b4b89f5da6814a

And emerge the package, by default the custom repository is used, when the packages are with the same version:

root@srv bubblewrap # emerge -va sys-apps/bubblewrap

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] sys-apps/bubblewrap-0.3.1-r1::my-local-portage [0.3.1-r1::gentoo] USE="(selinux) suid" 0 KiB

Total: 1 package (1 reinstall), Size of downloads: 0 KiB

Would you like to merge these packages? [Yes/No]

The patch version is going to be emerge – sys-apps/bubblewrap-0.3.1-r1::my-local-portage. The patch will be applied before the build of the package.

OPTION 2) Resume the build manually.

The build process could be resumed manually following this article – Resume compilation of a package from where it failed under Gentoo.
First, download and patch and then resume with the ebuild commands.

AWLAYS go to the working directory shown in the error output because sometimes the build process might fail in a subdirectory. A 32bit multilib environment prepared for building, for example.

root@srv my-local-portage # emerge -v sys-apps/bubblewrap

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] sys-apps/bubblewrap-0.3.1-r1::gentoo  USE="(selinux) suid" 0 KiB

Total: 1 package (1 reinstall), Size of downloads: 0 KiB


>>> Verifying ebuild manifests

>>> Emerging (1 of 1) sys-apps/bubblewrap-0.3.1-r1::gentoo
 * bubblewrap-0.3.1.tar.xz BLAKE2B SHA512 size ;-) ...                                                                                                               [ ok ]
 * Determining the location of the kernel source code
 * Found kernel source directory:
 *     /usr/src/linux
 * Found sources for kernel version:
 *     5.4.6-gentoo
 * Checking for suitable kernel configuration options...                                                                                                             [ ok ]
>>> Unpacking source...
>>> Unpacking bubblewrap-0.3.1.tar.xz to /var/tmp/portage/sys-apps/bubblewrap-0.3.1-r1/work
>>> Source unpacked in /var/tmp/portage/sys-apps/bubblewrap-0.3.1-r1/work
>>> Preparing source in /var/tmp/portage/sys-apps/bubblewrap-0.3.1-r1/work/bubblewrap-0.3.1 ...
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/sys-apps/bubblewrap-0.3.1-r1/work/bubblewrap-0.3.1 ...
 * econf: updating bubblewrap-0.3.1/build-aux/config.guess with /usr/share/gnuconfig/config.guess
 * econf: updating bubblewrap-0.3.1/build-aux/config.sub with /usr/share/gnuconfig/config.sub
./configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --disable-dependency-tracking --disable-silent-rules --docdir=/usr/share/doc/bubblewrap-0.3.1-r1 --htmldir=/usr/share/doc/bubblewrap-0.3.1-r1/html --libdir=/usr/lib64 --enable-selinux --enable-man --with-bash-completion-dir=/usr/share/bash-completion/completions --with-priv-mode=setuid
configure: loading site script /usr/share/config.site
checking for x86_64-pc-linux-gnu-gcc... x86_64-pc-linux-gnu-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether x86_64-pc-linux-gnu-gcc accepts -g... yes
checking for x86_64-pc-linux-gnu-gcc option to accept ISO C89... none needed
checking whether x86_64-pc-linux-gnu-gcc understands -c and -o together... yes
checking how to run the C preprocessor... x86_64-pc-linux-gnu-gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for a BSD-compatible install... /usr/lib/portage/python3.6/ebuild-helpers/xattr/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking whether make supports nested variables... yes
checking whether UID '250' is supported by ustar format... yes
checking whether GID '250' is supported by ustar format... yes
checking how to create a ustar tar archive... gnutar
checking dependency style of x86_64-pc-linux-gnu-gcc... none
checking whether to enable maintainer-specific portions of Makefiles... yes
checking whether make supports nested variables... (cached) yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for x86_64-pc-linux-gnu-gcc... (cached) x86_64-pc-linux-gnu-gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether x86_64-pc-linux-gnu-gcc accepts -g... (cached) yes
checking for x86_64-pc-linux-gnu-gcc option to accept ISO C89... (cached) none needed
checking whether x86_64-pc-linux-gnu-gcc understands -c and -o together... (cached) yes
checking sys/capability.h usability... yes
checking sys/capability.h presence... yes
checking for sys/capability.h... yes
checking for xsltproc... /usr/bin/xsltproc
checking for SELINUX... no
configure: error: *** SELinux support requested but libraries not found

!!! Please attach the following file when seeking support:
!!! /var/tmp/portage/sys-apps/bubblewrap-0.3.1-r1/work/bubblewrap-0.3.1/config.log
 * ERROR: sys-apps/bubblewrap-0.3.1-r1::gentoo failed (configure phase):
 *   econf failed
 * 
 * Call stack:
 *               ebuild.sh, line  125:  Called src_configure
 *             environment, line 1757:  Called econf '--enable-selinux' '--enable-man' '--with-bash-completion-dir=/usr/share/bash-completion/completions' '--with-priv-mode=setuid'
 *        phase-helpers.sh, line  681:  Called __helpers_die 'econf failed'
 *   isolated-functions.sh, line  112:  Called die
 * The specific snippet of code:
 *              die "$@"
 * 
 * If you need support, post the output of `emerge --info '=sys-apps/bubblewrap-0.3.1-r1::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=sys-apps/bubblewrap-0.3.1-r1::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/sys-apps/bubblewrap-0.3.1-r1/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/sys-apps/bubblewrap-0.3.1-r1/temp/environment'.
 * Working directory: '/var/tmp/portage/sys-apps/bubblewrap-0.3.1-r1/work/bubblewrap-0.3.1'
 * S: '/var/tmp/portage/sys-apps/bubblewrap-0.3.1-r1/work/bubblewrap-0.3.1'

>>> Failed to emerge sys-apps/bubblewrap-0.3.1-r1, Log file:

>>>  '/var/tmp/portage/sys-apps/bubblewrap-0.3.1-r1/temp/build.log'

 * Messages for package sys-apps/bubblewrap-0.3.1-r1:

 * ERROR: sys-apps/bubblewrap-0.3.1-r1::gentoo failed (configure phase):
 *   econf failed
 * 
 * Call stack:
 *               ebuild.sh, line  125:  Called src_configure
 *             environment, line 1757:  Called econf '--enable-selinux' '--enable-man' '--with-bash-completion-dir=/usr/share/bash-completion/completions' '--with-priv-mode=setuid'
 *        phase-helpers.sh, line  681:  Called __helpers_die 'econf failed'
 *   isolated-functions.sh, line  112:  Called die
 * The specific snippet of code:
 *              die "$@"
 * 
 * If you need support, post the output of `emerge --info '=sys-apps/bubblewrap-0.3.1-r1::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=sys-apps/bubblewrap-0.3.1-r1::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/sys-apps/bubblewrap-0.3.1-r1/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/sys-apps/bubblewrap-0.3.1-r1/temp/environment'.
 * Working directory: '/var/tmp/portage/sys-apps/bubblewrap-0.3.1-r1/work/bubblewrap-0.3.1'
 * S: '/var/tmp/portage/sys-apps/bubblewrap-0.3.1-r1/work/bubblewrap-0.3.1'
root@srv my-local-portage # cd /var/tmp/portage/sys-apps/bubblewrap-0.3.1-r1/work/bubblewrap-0.3.1
root@srv bubblewrap-0.3.1 # wget -O ./compilation-error.patch "https://674312.bugs.gentoo.org/attachment.cgi?id=563722"
--2020-02-06 23:27:02--  https://674312.bugs.gentoo.org/attachment.cgi?id=563722
Resolving 674312.bugs.gentoo.org... 204.187.15.4, 2607:fcc0:4:ffff::4
Connecting to 674312.bugs.gentoo.org|204.187.15.4|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5208 (5.1K) [text/plain]
Saving to: './compilation-error.patch'

./compilation-error.patch                  100%[========================================================================================>]   5.09K  --.-KB/s    in 0s      

2020-02-06 23:27:04 (196 MB/s) - './compilation-error.patch' saved [5208/5208]
root@srv bubblewrap-0.3.1 # patch -p1 < ./compilation-error.patch 
patching file configure
root@srv bubblewrap-0.3.1 # ebuild /usr/portage/sys-apps/bubblewrap/bubblewrap-0.3.1-r1.ebuild compile
>>> Existing ${T}/environment for 'bubblewrap-0.3.1-r1' will be sourced.
>>> Run 'clean' to start with a fresh environment.
>>> Checking bubblewrap-0.3.1.tar.xz's mtime...
>>> WORKDIR is up-to-date, keeping...
 * checking ebuild checksums ;-) ...                                                                                                                                 [ ok ]
 * checking miscfile checksums ;-) ...                                                                                                                               [ ok ]
>>> It appears that 'setup' has already executed for 'bubblewrap-0.3.1-r1'; skipping.
>>> Remove '/var/tmp/portage/sys-apps/bubblewrap-0.3.1-r1/.setuped' to force setup.
>>> It appears that 'unpack' has already executed for 'bubblewrap-0.3.1-r1'; skipping.
>>> Remove '/var/tmp/portage/sys-apps/bubblewrap-0.3.1-r1/.unpacked' to force unpack.
>>> It appears that 'prepare' has already executed for 'bubblewrap-0.3.1-r1'; skipping.
>>> Remove '/var/tmp/portage/sys-apps/bubblewrap-0.3.1-r1/.prepared' to force prepare.
>>> Configuring source in /var/tmp/portage/sys-apps/bubblewrap-0.3.1-r1/work/bubblewrap-0.3.1 ...
 * econf: updating bubblewrap-0.3.1/build-aux/config.guess with /usr/share/gnuconfig/config.guess
 * econf: updating bubblewrap-0.3.1/build-aux/config.sub with /usr/share/gnuconfig/config.sub
./configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --disable-dependency-tracking --disable-silent-rules --docdir=/usr/share/doc/bubblewrap-0.3.1-r1 --htmldir=/usr/share/doc/bubblewrap-0.3.1-r1/html --libdir=/usr/lib64 --enable-selinux --enable-man --with-bash-completion-dir=/usr/share/bash-completion/completions --with-priv-mode=setuid
configure: loading site script /usr/share/config.site
checking for x86_64-pc-linux-gnu-gcc... x86_64-pc-linux-gnu-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether x86_64-pc-linux-gnu-gcc accepts -g... yes
checking for x86_64-pc-linux-gnu-gcc option to accept ISO C89... none needed
checking whether x86_64-pc-linux-gnu-gcc understands -c and -o together... yes
checking how to run the C preprocessor... x86_64-pc-linux-gnu-gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for a BSD-compatible install... /usr/lib/portage/python3.6/ebuild-helpers/xattr/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking whether make supports nested variables... yes
checking whether UID '250' is supported by ustar format... yes
checking whether GID '250' is supported by ustar format... yes
checking how to create a ustar tar archive... gnutar
checking dependency style of x86_64-pc-linux-gnu-gcc... none
checking whether to enable maintainer-specific portions of Makefiles... yes
checking whether make supports nested variables... (cached) yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for x86_64-pc-linux-gnu-gcc... (cached) x86_64-pc-linux-gnu-gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether x86_64-pc-linux-gnu-gcc accepts -g... (cached) yes
checking for x86_64-pc-linux-gnu-gcc option to accept ISO C89... (cached) none needed
checking whether x86_64-pc-linux-gnu-gcc understands -c and -o together... (cached) yes
checking for x86_64-pc-linux-gnu-pkg-config... /usr/bin/x86_64-pc-linux-gnu-pkg-config
checking pkg-config is at least version 0.9.0... yes
checking sys/capability.h usability... yes
checking sys/capability.h presence... yes
checking for sys/capability.h... yes
checking for xsltproc... /usr/bin/xsltproc
checking for SELINUX... yes
checking if x86_64-pc-linux-gnu-gcc supports flag -pipe in envvar CFLAGS... yes
.....
.....
make[1]: Leaving directory '/var/tmp/portage/sys-apps/bubblewrap-0.3.1-r1/work/bubblewrap-0.3.1'
>>> Source compiled.
root@srv bubblewrap-0.3.1 # ebuild /usr/portage/sys-apps/bubblewrap/bubblewrap-0.3.1-r1.ebuild install
>>> Existing ${T}/environment for 'bubblewrap-0.3.1-r1' will be sourced.
.....
.....
>>> Completed installing sys-apps/bubblewrap-0.3.1-r1 into /var/tmp/portage/sys-apps/bubblewrap-0.3.1-r1/image

 * Final size of build directory: 1448 KiB (1.4 MiB)
 * Final size of installed tree:   136 KiB

strip: x86_64-pc-linux-gnu-strip --strip-unneeded -N __gentoo_check_ldflags__ -R .comment -R .GCC.command.line -R .note.gnu.gold-version
   /usr/bin/bwrap
root@srv bubblewrap-0.3.1 # ebuild /usr/portage/sys-apps/bubblewrap/bubblewrap-0.3.1-r1.ebuild qmerge 
>>> Existing ${T}/environment for 'bubblewrap-0.3.1-r1' will be sourced.
.....
.....
>>> Regenerating /etc/ld.so.cache...
>>> Original instance of package unmerged safely.
>>> sys-apps/bubblewrap-0.3.1-r1 merged.
root@srv bubblewrap-0.3.1 # cd
root@srv ~ # rm -R /var/tmp/portage/sys-apps/bubblewrap-0.3.1-r1/

OPTION 3) Just press CTRL+Z after uncompress phase during emerge

root@srv ~ # emerge -v bubblewrap

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] sys-apps/bubblewrap-0.3.1-r1::gentoo [0.3.1-r1::my-local-portage] USE="(selinux) suid" 0 KiB

Total: 1 package (1 reinstall), Size of downloads: 0 KiB


>>> Verifying ebuild manifests

>>> Emerging (1 of 1) sys-apps/bubblewrap-0.3.1-r1::gentoo
 * bubblewrap-0.3.1.tar.xz BLAKE2B SHA512 size ;-) ...                                                                                                               [ ok ]
 * Determining the location of the kernel source code
 * Found kernel source directory:
 *     /usr/src/linux
 * Found sources for kernel version:
 *     5.4.6-gentoo
 * Checking for suitable kernel configuration options...                                                                                                             [ ok ]
>>> Unpacking source...
>>> Unpacking bubblewrap-0.3.1.tar.xz to /var/tmp/portage/sys-apps/bubblewrap-0.3.1-r1/work
>>> Source unpacked in /var/tmp/portage/sys-apps/bubblewrap-0.3.1-r1/work
^Z
[1]+  Stopped                 emerge -v bubblewrap
root@srv ~ # cd /var/tmp/portage/sys-apps/bubblewrap-0.3.1-r1/work/bubblewrap-0.3.1
root@srv bubblewrap-0.3.1 # wget -O compilation-error.patch "https://674312.bugs.gentoo.org/attachment.cgi?id=563722"
--2020-02-06 14:05:52--  https://674312.bugs.gentoo.org/attachment.cgi?id=563722
Resolving 674312.bugs.gentoo.org... 204.187.15.4, 2607:fcc0:4:ffff::4
Connecting to 674312.bugs.gentoo.org|204.187.15.4|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5208 (5.1K) [text/plain]
Saving to: 'compilation-error.patch'

compilation-error.patch                    100%[========================================================================================>]   5.09K  --.-KB/s    in 0s      

2020-02-06 14:05:54 (181 MB/s) - 'compilation-error.patch' saved [5208/5208]

root@srv bubblewrap-0.3.1 # patch -p1 < ./compilation-error.patch 
patching file configure
root@srv bubblewrap-0.3.1 # fg
emerge -v bubblewrap    (wd: ~)
>>> Preparing source in /var/tmp/portage/sys-apps/bubblewrap-0.3.1-r1/work/bubblewrap-0.3.1 ...
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/sys-apps/bubblewrap-0.3.1-r1/work/bubblewrap-0.3.1 ...
 * econf: updating bubblewrap-0.3.1/build-aux/config.guess with /usr/share/gnuconfig/config.guess
 * econf: updating bubblewrap-0.3.1/build-aux/config.sub with /usr/share/gnuconfig/config.sub
./configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --disable-dependency-tracking --disable-silent-rules --docdir=/usr/share/doc/bubblewrap-0.3.1-r1 --htmldir=/usr/share/doc/bubblewrap-0.3.1-r1/html --libdir=/usr/lib64 --enable-selinux --enable-man --with-bash-completion-dir=/usr/share/bash-completion/completions --with-priv-mode=setuid
configure: loading site script /usr/share/config.site
checking for x86_64-pc-linux-gnu-gcc... x86_64-pc-linux-gnu-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether x86_64-pc-linux-gnu-gcc accepts -g... yes
checking for x86_64-pc-linux-gnu-gcc option to accept ISO C89... none needed
checking whether x86_64-pc-linux-gnu-gcc understands -c and -o together... yes
checking how to run the C preprocessor... x86_64-pc-linux-gnu-gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for a BSD-compatible install... /usr/lib/portage/python3.6/ebuild-helpers/xattr/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking whether make supports nested variables... yes
checking whether UID '250' is supported by ustar format... yes
checking whether GID '250' is supported by ustar format... yes
checking how to create a ustar tar archive... gnutar
checking dependency style of x86_64-pc-linux-gnu-gcc... none
checking whether to enable maintainer-specific portions of Makefiles... yes
checking whether make supports nested variables... (cached) yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for x86_64-pc-linux-gnu-gcc... (cached) x86_64-pc-linux-gnu-gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether x86_64-pc-linux-gnu-gcc accepts -g... (cached) yes
checking for x86_64-pc-linux-gnu-gcc option to accept ISO C89... (cached) none needed
checking whether x86_64-pc-linux-gnu-gcc understands -c and -o together... (cached) yes
checking for x86_64-pc-linux-gnu-pkg-config... /usr/bin/x86_64-pc-linux-gnu-pkg-config
checking pkg-config is at least version 0.9.0... yes
checking sys/capability.h usability... yes
checking sys/capability.h presence... yes
checking for sys/capability.h... yes
checking for xsltproc... /usr/bin/xsltproc
checking for SELINUX... yes
checking if x86_64-pc-linux-gnu-gcc supports flag -pipe in envvar CFLAGS... yes
.....
.....
--- replaced dir /usr/bin
--- replaced dir /usr
>>> Regenerating /etc/ld.so.cache...
>>> Original instance of package unmerged safely.
>>> sys-apps/bubblewrap-0.3.1-r1 merged.
>>> Auto-cleaning packages...

>>> No outdated packages were found on your system.

 * GNU info directory index is up-to-date.

The line “^Z” is when we pressed “CTRL+Z“.

One thought on “Patch and resume compilation of a failed package in Gentoo – ebuild, local repository or ctrl+Z”

  1. Built-in option is to put your patches in /etc/portage/patches.

    For all versions of the package:
    /etc/portage/patches/sys-apps/bubblewrap/compilation-error.patch

    For a specific version:
    /etc/portage/patches/sys-apps/bubblewrap-0.3.1-r1/compilation-error.patch

Leave a Reply

Your email address will not be published. Required fields are marked *