|Summary:||devel/ruby-build: 20191030 or later cannot build MRI|
|Product:||Ports & Packages||Reporter:||Koichiro Iwao <meta>|
|Component:||Individual Port(s)||Assignee:||Koichiro Iwao <meta>|
|Severity:||Affects Only Me||CC:||meta, naito.yuichiro|
Description Koichiro Iwao 2019-11-01 05:31:29 UTC
==FOR THE RECORD== devel/ruby-build has not been updated to 20191030 but I'm trying to update it. Release note: https://github.com/rbenv/ruby-build/releases/tag/v20191030 20191030 fails to build Ruby. This might be caused by recent change of ruby-build. https://github.com/rbenv/ruby-build/pull/1368 compiling ./enc/iso_8859_13.c --- trans --- ld: error: unable to find library -lruby cc: error: linker command failed with exit code 1 (use -v to see invocation) *** [.ext/x86_64-freebsd12.1/enc/trans/transdb.so] Error code 1 make: stopped in /tmp/ruby-build.20191101142002.24843/ruby-2.6.4 1 error make: stopped in /tmp/ruby-build.20191101142002.24843/ruby-2.6.4 *** [trans] Error code 2 make: stopped in /tmp/ruby-build.20191101142002.24843/ruby-2.6.4 --- enc --- A failure has been detected in another branch of the parallel make make: stopped in /tmp/ruby-build.20191101142002.24843/ruby-2.6.4 *** [enc] Error code 2 make: stopped in /tmp/ruby-build.20191101142002.24843/ruby-2.6.4 --- .ext/include/x86_64-freebsd12.1/rb_mjit_min_header-2.6.4.h --- To record what I investigated and tried to fix it, I created this bug.
Comment 1 commit-hook 2019-11-05 00:54:51 UTC
A commit references this bug: Author: meta Date: Tue Nov 5 00:53:50 UTC 2019 New revision: 516763 URL: https://svnweb.freebsd.org/changeset/ports/516763 Log: devel/ruby-build: add a comment that mention bug 241633 PR: 241633 Changes: head/devel/ruby-build/Makefile
Comment 2 Yuichiro NAITO 2019-11-06 01:22:19 UTC
Created attachment 208899 [details] ruby-build.patch
Comment 3 Yuichiro NAITO 2019-11-06 01:24:00 UTC
I see same problem on my FreeBSD 12.1R machine with the latest ruby-build from GitHub. `rbenv install 2.6.` fails as same as this PR. For a quick work around, `ruby-build.patch` fixes this problem and ruby 2.6.5 is build successfully. But I don't understand why this patch works for now. It seems BSD make's problem but compiling Ruby from tarball with BSD make was succeeded.
Comment 4 Yuichiro NAITO 2019-11-06 01:27:36 UTC
I see same result on FreeBSD CURRENT r354344.
Comment 5 Koichiro Iwao 2019-11-06 02:09:14 UTC
(In reply to Yuichiro NAITO from comment #3) Above that block, it appears that ruby-build determiniing FreeBSD or not. https://github.com/rbenv/ruby-build/blob/v20191030/bin/ruby-build#L1319 I confirmed using gmake can build Ruby successfully. However, lang/ruby2 is built by /usr/bin/make with --enable-shared. I'm trying to find out why ruby-build + --enable-shared + /usr/bin/make fails.
Comment 6 Koichiro Iwao 2019-11-06 02:14:59 UTC
Created attachment 208900 [details] whole-ruby-build-log.log
Comment 7 Yuichiro NAITO 2019-11-07 01:59:28 UTC
I think it's kind of race condition. BSD make with parallel build fails and BSD make with single job builds successfully. I think GNU make has different job scheduling from BSD make. One of these will solve this PR. 1. use BSD make with -j 1 2. use GNU make 3. fix dependencies in Ruby's Makefile
Comment 8 Koichiro Iwao 2019-11-07 02:15:55 UTC
(In reply to Yuichiro NAITO from comment #7) I'm inclined to choose 2. 3 would be a best but it doesn't take effect on past released Ruby. 1 makes build slower.
Comment 9 Koichiro Iwao 2019-11-07 02:41:30 UTC
Created attachment 208930 [details] ruby-build-use-gmake As workaround, use gmake. I'll report to Ruby and ruby-build upstream later.
Comment 10 Koichiro Iwao 2019-11-07 13:04:45 UTC
Reported to Ruby upstream.
Comment 11 commit-hook 2019-11-07 13:07:21 UTC
A commit references this bug: Author: meta Date: Thu Nov 7 13:06:35 UTC 2019 New revision: 516970 URL: https://svnweb.freebsd.org/changeset/ports/516970 Log: devel/ruby-build: Update to 20191030 and use GNU make when building Ruby to avoid Ruby build failure. PR: 241633 Submitted by: Yuichiro NAITO <email@example.com>, myself Sponsored by: HAW International, Inc. Changes: head/devel/ruby-build/Makefile head/devel/ruby-build/distinfo head/devel/ruby-build/files/ head/devel/ruby-build/files/patch-bin_ruby-build
Comment 12 Koichiro Iwao 2019-11-07 13:24:02 UTC
Committed workaround, thanks!
Comment 13 Yuichiro NAITO 2019-11-08 03:20:45 UTC
In my investigation, There are two reasons about ruby build failure. First: It seems that it is not intended to call $(PRE_LIBRARY_UPDATE) in Ruby's Makefile, when libruby.so.26 is built. Comparing to libruby-static library build, Ruby's Makefile should be fixed like `Makefile.in.patch`. If $(PRE_LIBRARY_UPDATE) is not called, the build finished successfully. Second: $(PRE_LIBRARY_UPDATE) expands to "[ -n '' ] || exec rm -f ./.libruby-with-ext.time". The 'exec' behavior is different between with and without -j option in BSD make. With -j option, following commands after 'exec rm' are not executed. So libruby.so.26 is not build. Without -j option, following commands after 'exec rm' are executed normally. I'm not sure this behavior is a bug of BSD make. But it's enough to confuse me.
Comment 14 Yuichiro NAITO 2019-11-08 03:21:26 UTC
Created attachment 208958 [details] Makefile.in.patch
Comment 15 Koichiro Iwao 2019-11-08 09:57:09 UTC
If this issue is fixed in upstream, MAKE_JOBS_UNSAFE=yes in lang/ruby2 ports should be removed and can be built parallely.