Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 657970 - dev-lang/ruby-2.4.4 mkmf.rb does not work with GCC 8
Summary: dev-lang/ruby-2.4.4 mkmf.rb does not work with GCC 8
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Ruby Team
URL:
Whiteboard:
Keywords:
: 607524 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-06-12 11:23 UTC by Alex Turbov
Modified: 2019-02-24 08:24 UTC (History)
5 users (show)

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


Attachments
mkmf.log (mkmf.log,16.62 KB, text/x-log)
2018-06-20 21:13 UTC, Aidan Harris
Details
patch for dev-lang/ruby-2.4.4 (suppress-gcc-8-warnings.patch,2.41 KB, patch)
2018-07-08 07:26 UTC, Georgy Yakovlev
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Turbov 2018-06-12 11:23:28 UTC
The package tried to find `ffi.h` only at `/usr/include` and `/usr/local/include` (according to `ffi-1.9.25/ext/ffi_c/extconf.rb:18`). Meanwhile, `dev-libs/libffi` install headers to `/usr/lib<arch>/libffi-x.y.z/include` and provide `pkg-config` files, which must be used to set the proper cflags.

So, the package has falied to build nowadays.

Reproducible: Always

Steps to Reproduce:
1.emerge dev-ruby/ffi
2.
3.
Actual Results:  
 * Running configure phase for ruby24 ...
checking for ffi.h... no
checking for ffi.h in /usr/local/include,/usr/include/ffi... no
checking for shlwapi.h... no
checking for ruby/thread.h... yes
checking for rb_thread_blocking_region()... no
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_call_without_gvl()... yes
creating extconf.h
creating Makefile

 * Running compile phase for ruby24 ...
make: Entering directory '/storage/tmp/paludis.17/dev-ruby-ffi-1.9.25/work/ruby24/ffi-1.9.25/ext/ffi_c'
Running autoreconf for libffi
make: Leaving directory '/storage/tmp/paludis.17/dev-ruby-ffi-1.9.25/work/ruby24/ffi-1.9.25/ext/ffi_c'
make -j8 -Cext/ffi_c V=1
/bin/sh: line 2: cd: /storage/tmp/paludis.17/dev-ruby-ffi-1.9.25/work/ruby24/ffi-1.9.25/ext/ffi_c/libffi: No such file or directory
make: *** [libffi.mk:7: "/storage/tmp/paludis.17/dev-ruby-ffi-1.9.25/work/ruby24/ffi-1.9.25/ext/ffi_c/libffi-x86_64-linux"/.libs/libffi_convenience.a] Error 1
Comment 1 Hans de Graaff gentoo-dev Security 2018-06-15 05:53:11 UTC
This works fine for me. It looks like extconf.rb only starts to look for header files directly when the pkg-config check fails.

Perhaps there was an issue finding or using pkg-config?
Comment 2 Alex Turbov 2018-06-15 08:24:40 UTC
(In reply to Hans de Graaff from comment #1)
> Perhaps there was an issue finding or using pkg-config?

$ pkg-config --cflags libffi
-I/usr/lib64/libffi-3.2.1/include

definitely some problem w/ the ruby file... how can I debug it?
Comment 3 Hans de Graaff gentoo-dev Security 2018-06-16 05:25:55 UTC
(In reply to Alex Turbov from comment #2)
> (In reply to Hans de Graaff from comment #1)
> > Perhaps there was an issue finding or using pkg-config?
> 
> $ pkg-config --cflags libffi
> -I/usr/lib64/libffi-3.2.1/include
> 
> definitely some problem w/ the ruby file... how can I debug it?

If this was a clean install then perhaps pkg-config wasn't present yet at the time of the error and this might be a dependency problem?

As far as I can tell from the pkg_config() method in /usr/lib/ruby/2.4.0/mkmf.rb ruby calls "pkg-config --cflags-only-I libffi" but I assume that works fine too if --cflags works. It also tries to run "pkg-config --exists libffi" first. Ah, and it probes for libffi-config initially.
Comment 4 Alex Turbov 2018-06-17 13:54:07 UTC
(In reply to Hans de Graaff from comment #3)
> If this was a clean install then perhaps pkg-config wasn't present yet at the
> time of the error and this might be a dependency problem?

Yes, that is a clean install, but `pkg-config` already installed and seem work fine...

> As far as I can tell from the pkg_config() method in
> /usr/lib/ruby/2.4.0/mkmf.rb ruby calls "pkg-config --cflags-only-I libffi"
> but I assume that works fine too if --cflags works. It also tries to run
> "pkg-config --exists libffi" first. Ah, and it probes for libffi-config
> initially.

Both are work for me:

# pkg-config --cflags-only-I libffi
-I/usr/lib64/libffi-3.2.1/include

# pkg-config --exists libffi; echo $?
0
Comment 5 Alex Turbov 2018-06-17 14:10:52 UTC
I've run the build command under `strace` and see it properly found `pkg-config` and run it w/ the mentioned options:

cz.log.30616:2032:stat("/usr/bin/pkg-config", {st_mode=S_IFREG|0755, st_size=193328, ...}) = 0
cz.log.30616:2033:stat("/usr/bin/pkg-config", {st_mode=S_IFREG|0755, st_size=193328, ...}) = 0
cz.log.30616:2034:access("/usr/bin/pkg-config", X_OK)     = 0
cz.log.30618:10:lstat("/usr/bin/pkg-config", {st_mode=S_IFREG|0755, st_size=193328, ...}) = 0
cz.log.30618:11:openat(AT_FDCWD, "/usr/bin/pkg-config", O_RDONLY|O_CLOEXEC) = 10
cz.log.30618:12:execve("/usr/bin/pkg-config", ["pkg-config", "--exists", "libffi"], 0x7f45964e2010 /* 378 vars */) = 0
cz.log.30619:10:lstat("/usr/bin/pkg-config", {st_mode=S_IFREG|0755, st_size=193328, ...}) = 0
cz.log.30619:11:openat(AT_FDCWD, "/usr/bin/pkg-config", O_RDONLY|O_CLOEXEC) = 12
cz.log.30619:12:execve("/usr/bin/pkg-config", ["pkg-config", "--libs", "libffi"], 0x7f45964e2010 /* 378 vars */) = 0

but for some reason don't use the results :(
Comment 6 Hans de Graaff gentoo-dev Security 2018-06-20 19:38:41 UTC
(In reply to Alex Turbov from comment #5)

> cz.log.30619:12:execve("/usr/bin/pkg-config", ["pkg-config", "--libs",
> "libffi"], 0x7f45964e2010 /* 378 vars */) = 0
> 
> but for some reason don't use the results :(

I assume this was the full log matching pkg-config.

After this call it should issue the 'pkg-config --cflags-only-I libffi' call, but it looks like it does not. At this point it tries to compile a conftest.c file with the flags returned by the --libs call to verify that this works. So this seems to fail.

There should also be a mkmf.log file in the ext/ffi_c directory. That shows which steps have been taken and may provide more information.
Comment 7 Aidan Harris 2018-06-20 21:13:19 UTC
Created attachment 536632 [details]
mkmf.log

I just hit this myself when upgrading ruby. I believe this issue is with gcc 8 (apparently it's enabled more warnings by default now?). It builds fine for me with gcc 7.
Comment 8 Hans de Graaff gentoo-dev Security 2018-06-25 18:04:07 UTC
Alex, are you also using gcc 8?
Comment 9 Alex Turbov 2018-06-25 18:14:23 UTC
(In reply to Hans de Graaff from comment #8)
> Alex, are you also using gcc 8?

Yes, I do. I tried to switch to modern profile and rebuild my system from scratch...
Comment 10 Georgy Yakovlev archtester gentoo-dev 2018-07-08 07:26:43 UTC
Created attachment 538736 [details, diff]
patch for dev-lang/ruby-2.4.4

I did some troubleshooting and this does not happen with ruby25 at all.

Warnings like below cause the issues with ruby-2.4

/usr/include/ruby-2.4.0/ruby/ruby.h:631:1: warning: ‘const’ attribute on function returning ‘void’ [-Wattributes]
 CONSTFUNC(void rb_secure_update(VALUE));

like described in comment 6

here's the upstream commit that fixes that 

https://github.com/ruby/ruby/commit/027b576b31cd12bad575b3a39476726273f58c41#diff-d25389b5dda13be5e80e89f60e1cc716


I've attached this commit as a patch for dev-lang/ruby-2.4.4
Can confirm that with the patch ruby-2.4.4 builds fine and dev-ruby/ffi builds fine with gcc-8 as well.
Comment 11 Hans de Graaff gentoo-dev Security 2018-07-16 07:37:18 UTC
This has now been fixed in ruby-2.4.4-r1.
Comment 12 Hans de Graaff gentoo-dev Security 2019-02-24 08:24:52 UTC
*** Bug 607524 has been marked as a duplicate of this bug. ***