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
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?
(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?
(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.
(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
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 :(
(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.
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.
Alex, are you also using gcc 8?
(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...
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.
This has now been fixed in ruby-2.4.4-r1.
*** Bug 607524 has been marked as a duplicate of this bug. ***