archive (unofficial mirror)
 help / color / Atom feed
Subject: [ruby-core:95770] [Ruby master Bug#16331] fails to build with BSD make when any -j option is given (including -j 1)
Date: Sat, 09 Nov 2019 10:14:02 +0000 (UTC)
Message-ID: <> (raw)
In-Reply-To: <>

Issue #16331 has been updated by naruse (Yui NARUSE). (Koichiro Iwao) wrote:
> Now it turned out the build fails even `-j 1` is specified. Any value to `-j` option will fail.
> Not giving `-j` option goes fine.
> Further information from Yuichiro NAITO:
> > 最初にレースコンディションと言っていたのは誤りで
> > -j の有無で shell に渡すコマンドの範囲が異なるのが原因でした。
> > 基本的にはビルド手順を1行づつ shell に渡すのが本来の make の実装なのですが、
> > BSD make は -j オプションをつけると、ビルド手順が複数行ある場合にまとめて shell に渡すようになります。
> > そうすると、途中で exec があった場合、残りのコマンドが実行されなくなります。
> > Ruby の Makefile では行の最後のコマンドに exec 使うことで、
> > 最後の fork(2) 実行を省略しようという意図のように見えます。
> > 
> > 結局のところ BSD make の互換性問題のように思います。

It sounds Ruby hits the issue described in `make -B`:

Bug #16331: fails to build with BSD make when any -j option is given (including -j 1)

* Author: (Koichiro Iwao)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.6.5
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN
When building Ruby parallely with BSD make (FreeBSD make), it fails to build.
Reported by FreeBSD Ruby folks. Please keep in mind I didn't find out the root cause.

See also:

## How to reproduce
tar xf ruby-2.6.5.tar.gz
cd ruby-2.6.5
./configure --enable-shared --disable-readline --disable-libedit
make -j 8 # any value will cause build failure
configuring -test-/st/numhash
configuring -test-/st/update
--- enc ---
ld: error: unable to find library -lruby
cc: error: linker command failed with exit code 1 (use -v to see invocation)
--- ---
configuring -test-/string
configuring -test-/struct
configuring -test-/symbol
--- enc ---
*** [.ext/x86_64-freebsd12.1/enc/] Error code 1

## BSD make without -j option: success
cd ruby-2.6.5
make distclean
./configure --enable-shared --disable-readline --disable-libedit
`ruby' is up to date.
*** Following extensions are not compiled:
	Could not be configured. It will not be installed.
	/home/sair/tmp/ruby-2.6.5/ext/readline/extconf.rb:52: readline not found
	Check ext/readline/mkmf.log for more details.
	Could not be configured. It will not be installed.
	Check ext/gdbm/mkmf.log for more details.
*** Fix the problems, then remove these directories and try again if you want.
making enc
making trans
`trans' is up to date.
making encs
Generating RDoc documentation

## Using GNU make: success

cd ruby-2.6.5
export MAKE=gmake # GNU make
make distclean
./configure --enable-shared --disable-readline --disable-libedit
$MAKE -j 8

ruby-bsdmake.log (13.9 KB)


  parent reply index

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <>
2019-11-07  8:04 ` [ruby-core:95741] [Ruby master Bug#16331] fails to build with BSD make possibly due to race condition meta
2019-11-08  3:31 ` [ruby-core:95752] " meta
2019-11-08  8:37 ` [ruby-core:95755] [Ruby master Bug#16331] fails to build with BSD make when any -j option is given (including -j 1) meta
2019-11-09 10:14 ` naruse [this message]
2019-11-10  0:27 ` [ruby-core:95771] " nobu
2019-12-04 17:28 ` [ruby-core:96112] " yasu
2019-12-22 10:02 ` [ruby-core:96404] " yasu
2019-12-22 12:38 ` [ruby-core:96407] " nobu
2020-01-27  6:37 ` [ruby-core:97003] " meta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link archive (unofficial mirror)

Archives are clonable: git clone --mirror

Example config snippet for mirrors

Newsgroups are available over NNTP:

 note: .onion URLs require Tor:

AGPL code for this site: git clone