Issue #15154 has been reported by kernigh (George Koehler).

----------------------------------------
Bug #15154: OpenBSD make(1) can't build node_name.inc
https://bugs.ruby-lang.org/issues/15154

* Author: kernigh (George Koehler)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.6.0dev (2018-09-24 trunk 64826) [x86_64-openbsd6.3]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
The [make(1)](https://man.openbsd.org/make) command in OpenBSD can't build node_name.inc of Ruby trunk in an out-of-source build.  GNU make works.  OpenBSD make misses node.h in the source directory, and tries to use node.h in the build directory:

~~~
$ gmake
...
$ rm node_name.inc
$ make node_name.inc
/bin/sh: cannot open node.h: No such file or directory
*** Error 1 in /home/kernigh/park/ruby-build (Makefile:1627 'node_name.inc': @ r
uby25 --disable=gems -n ../ruby/tool/node_name.rb < node.h >...)
~~~

This seems to be a quirk or bug of OpenBSD make.  Other make tools would search VPATH for node.h.  OpenBSD make doesn't search VPATH because node.h depends on another file.  Makefile shows node.h depending on node_name.rb:

~~~
node.h: $(srcdir)/tool/node_name.rb
# This dependency is not really correct, but $? should not include
# node_name.rb in the following recipe.
node_name.inc: node.h
        $(ECHO) generating $@
        $(Q) $(BASERUBY) -n $(srcdir)/tool/node_name.rb < $? > $@
~~~

To fix the build with OpenBSD make, I edit the recipe in common.mk, to use $(srcdir)/node.h instead of $?.  I attach a git diff of this fix.

The quirk or bug of OpenBSD make might come from [src/usr.bin/make/suff.c](http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/make/suff.c?rev=1.92&content-type=text/x-cvsweb-markup), where SuffFindNormalDeps() checks OP_NOP(gn->type), so it searches VPATH only if the file has no prerequisites, is "not on the lhs of a dependency operator".  Other BSDs use NetBSD bmake, where SuffFindNormalDeps() removes this check, so OpenBSD make might be the only make tool with this issue.

I run OpenBSD 6.3 on amd64.  I have OpenBSD packages of `autoconf%2.69 bison git gmp metaauto ruby%2.5`. I did `export AUTOCONF_VERSION=2.69` for metaauto.  I put the git checkout in ~/park/ruby, and I configured Ruby in ~/park/ruby-build using

~~~
../ruby/configure --prefix=$HOME/prefix --with-baseruby=ruby25 \
    CC=cc CXX=c++ CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib
~~~

---Files--------------------------------
ruby-node-openbsd.diff (816 Bytes)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>