ueno/ruby-gpgme

Building v2.0.20 fails on ubuntu 21.10

azul opened this issue · 4 comments

azul commented

Attempting to build the locally build versions fails on ubuntu 21.10 with the default packages for ruby, gpgme etc. installed.

build error
Installing gpgme 2.0.20 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/home/azul/code/crabgrass/crabgrass/vendor/bundle/ruby/2.7.0/gems/gpgme-2.0.20/ext/gpgme
/usr/bin/ruby2.7 -I /usr/lib/ruby/vendor_ruby -r
./siteconf20211217-157326-hfgrsw.rb extconf.rb
************************************************************************
IMPORTANT!  gpgme gem uses locally built versions of required C libraries,
namely libgpg-error, libassuan, and gpgme.

If this is a concern for you and you want to use the system library
instead, abort this installation process and reinstall gpgme gem as
follows:

    gem install gpgme -- --use-system-libraries

************************************************************************
Extracting libgpg-error-1.37.tar.bz2 into
tmp/x86_64-linux-gnu/ports/libgpg-error/1.37... OK
Running 'configure' for libgpg-error 1.37... OK
Running 'compile' for libgpg-error 1.37... OK
Running 'install' for libgpg-error 1.37... OK
Activating libgpg-error 1.37 (from
/home/azul/code/crabgrass/crabgrass/vendor/bundle/ruby/2.7.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libgpg-error/1.37)...
Extracting libassuan-2.5.3.tar.bz2 into
tmp/x86_64-linux-gnu/ports/libassuan/2.5.3... OK
Running 'configure' for libassuan 2.5.3... OK
Running 'compile' for libassuan 2.5.3... OK
Running 'install' for libassuan 2.5.3... OK
Activating libassuan 2.5.3 (from
/home/azul/code/crabgrass/crabgrass/vendor/bundle/ruby/2.7.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3)...
Extracting gpgme-1.13.1.tar.bz2 into
tmp/x86_64-linux-gnu/ports/gpgme/1.13.1... OK
Running 'configure' for gpgme 1.13.1... OK
Running 'compile' for gpgme 1.13.1... ERROR, review
'/home/azul/code/crabgrass/crabgrass/vendor/bundle/ruby/2.7.0/gems/gpgme-2.0.20/ext/gpgme/tmp/x86_64-linux-gnu/ports/gpgme/1.13.1/compile.log'
to see what happened. Last lines are:
========================================================================
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../conf
-I/home/azul/code/crabgrass/crabgrass/vendor/bundle/ruby/2.7.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-fPIC -Wall -Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k
-Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT engine-spawn.lo -MD -MP
-MF .deps/engine-spawn.Tpo -c engine-spawn.c -o engine-spawn.o
mv -f .deps/engine-spawn.Tpo .deps/engine-spawn.Plo
/bin/bash ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.
-I../conf   
-I/home/azul/code/crabgrass/crabgrass/vendor/bundle/ruby/2.7.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-fPIC  -Wall -Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k
-Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT gpgconf.lo -MD -MP -MF
.deps/gpgconf.Tpo -c -o gpgconf.lo gpgconf.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../conf
-I/home/azul/code/crabgrass/crabgrass/vendor/bundle/ruby/2.7.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-fPIC -Wall -Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k
-Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT gpgconf.lo -MD -MP -MF
.deps/gpgconf.Tpo -c gpgconf.c -o gpgconf.o
mv -f .deps/gpgconf.Tpo .deps/gpgconf.Plo
/bin/bash ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.
-I../conf   
-I/home/azul/code/crabgrass/crabgrass/vendor/bundle/ruby/2.7.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-fPIC  -Wall -Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k
-Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT queryswdb.lo -MD -MP
-MF .deps/queryswdb.Tpo -c -o queryswdb.lo queryswdb.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../conf
-I/home/azul/code/crabgrass/crabgrass/vendor/bundle/ruby/2.7.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-fPIC -Wall -Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k
-Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT queryswdb.lo -MD -MP
-MF .deps/queryswdb.Tpo -c queryswdb.c -o queryswdb.o
mv -f .deps/queryswdb.Tpo .deps/queryswdb.Plo
/bin/bash ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.
-I../conf   
-I/home/azul/code/crabgrass/crabgrass/vendor/bundle/ruby/2.7.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-fPIC  -Wall -Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k
-Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT posix-util.lo -MD -MP
-MF .deps/posix-util.Tpo -c -o posix-util.lo posix-util.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../conf
-I/home/azul/code/crabgrass/crabgrass/vendor/bundle/ruby/2.7.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-fPIC -Wall -Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k
-Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT posix-util.lo -MD -MP
-MF .deps/posix-util.Tpo -c posix-util.c -o posix-util.o
mv -f .deps/posix-util.Tpo .deps/posix-util.Plo
/bin/bash ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.
-I../conf   
-I/home/azul/code/crabgrass/crabgrass/vendor/bundle/ruby/2.7.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-fPIC  -Wall -Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k
-Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT posix-io.lo -MD -MP -MF
.deps/posix-io.Tpo -c -o posix-io.lo posix-io.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../conf
-I/home/azul/code/crabgrass/crabgrass/vendor/bundle/ruby/2.7.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-fPIC -Wall -Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k
-Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT posix-io.lo -MD -MP -MF
.deps/posix-io.Tpo -c posix-io.c -o posix-io.o
posix-io.c: In function '_gpgme_io_spawn':
posix-io.c:577:23: error: void value not ignored as it ought to be
  577 |             while ((i = closefrom (fd)) && errno == EINTR)
      |                       ^
make[1]: *** [Makefile:941: posix-io.lo] Fehler 1
make[1]: Verzeichnis
„/home/azul/code/crabgrass/crabgrass/vendor/bundle/ruby/2.7.0/gems/gpgme-2.0.20/ext/gpgme/tmp/x86_64-linux-gnu/ports/gpgme/1.13.1/gpgme-1.13.1/src“
wird verlassen
make: *** [Makefile:534: all-recursive] Fehler 1
========================================================================
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You
may
need configuration options.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/usr/bin/$(RUBY_BASE_NAME)2.7
	--clean
	--use-system-libraries
/home/azul/code/crabgrass/crabgrass/vendor/bundle/ruby/2.7.0/gems/mini_portile2-2.4.0/lib/mini_portile2/mini_portile.rb:402:in
`block in execute': Failed to complete compile task (RuntimeError)
from
/home/azul/code/crabgrass/crabgrass/vendor/bundle/ruby/2.7.0/gems/mini_portile2-2.4.0/lib/mini_portile2/mini_portile.rb:373:in
`chdir'
from
/home/azul/code/crabgrass/crabgrass/vendor/bundle/ruby/2.7.0/gems/mini_portile2-2.4.0/lib/mini_portile2/mini_portile.rb:373:in
`execute'
from
/home/azul/code/crabgrass/crabgrass/vendor/bundle/ruby/2.7.0/gems/mini_portile2-2.4.0/lib/mini_portile2/mini_portile.rb:115:in
`compile'
from
/home/azul/code/crabgrass/crabgrass/vendor/bundle/ruby/2.7.0/gems/mini_portile2-2.4.0/lib/mini_portile2/mini_portile.rb:154:in
`cook'
	from extconf.rb:129:in `block in <main>'
	from extconf.rb:105:in `tap'
	from extconf.rb:105:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in
/home/azul/code/crabgrass/crabgrass/vendor/bundle/ruby/2.7.0/gems/gpgme-2.0.20
for inspection.
Results logged to
/home/azul/code/crabgrass/crabgrass/vendor/bundle/ruby/2.7.0/extensions/x86_64-linux/2.7.0/gpgme-2.0.20/gem_make.out

An error occurred while installing gpgme (2.0.20), and Bundler
cannot continue.
Make sure that `gem install gpgme -v '2.0.20' --source
'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  mail-gpg was resolved to 0.3.3, which depends on
    gpgme

The error line seems to be:

libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../conf
-I/home/azul/code/crabgrass/crabgrass/vendor/bundle/ruby/2.7.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-fPIC -Wall -Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k
-Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT posix-io.lo -MD -MP -MF
.deps/posix-io.Tpo -c posix-io.c -o posix-io.o
posix-io.c: In function '_gpgme_io_spawn':
posix-io.c:577:23: error: void value not ignored as it ought to be
  577 |             while ((i = closefrom (fd)) && errno == EINTR)
      |                       ^
make[1]: *** [Makefile:941: posix-io.lo] Fehler 1
make[1]: Verzeichnis
„/home/azul/code/crabgrass/crabgrass/vendor/bundle/ruby/2.7.0/gems/gpgme-2.0.20/ext/gpgme/tmp/x86_64-linux-gnu/ports/gpgme/1.13.1/gpgme-1.13.1/src“
wird verlassen
make: *** [Makefile:534: all-recursive] Fehler 1

Relevant upstream issue (with fix): https://dev.gnupg.org/T5587

Having the same issue with this.

Workaround until an update is released:

  • remove this gem folder, just in case (for me, bundler didn't try to install that gem again after the failure)
rm -rf `$GEM_HOME/gems/gpgme-2.0.20`
  • install gpgme related headers
sudo apt install libgpgme-dev
  • force ruby-gpgme build to use system libraries
gem install gpgme -- --use-system-libraries

gpgme has this as a bug report too, which has been fixed. But there is a comment:

I see whats going on. The GitHub gpgme mirror (https://github.com/gpg/gpgme) is no longer updated. The last commit is from June 22, 2021. Changing the source link to the official (https://dev.gnupg.org/source/gpgme) URL gets the latest updates, and now builds successfully.