Project

General

Profile

Bug #12179

Build failure due to VPATH expansion

Added by rhenium (Kazuki Yamaguchi) over 3 years ago. Updated over 3 years ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:74345]

Description

On my environment (GNU Make 4.1), I can reproduce in this way:

cd /tmp
svn co http://svn.ruby-lang.org/repos/ruby/trunk ruby-src
cd ruby-src
autoconf && ./configure
mkdir -p /tmp/.ext/.timestamp/
touch /tmp/.ext/.timestamp/.RUBYARCHDIR.-.-test-.-.fatal.time
make V=1

results in:

...
make[2]: Entering directory '/tmp/ruby-src/ext/-test-/fatal'
rm -f ../../../.ext/x86_64-linux/-test-/fatal/rb_fatal.so
gcc -shared -o ../../../.ext/x86_64-linux/-test-/fatal/rb_fatal.so rb_fatal.o -L. -L../../.. -L. -fstack-protector -rdynamic -Wl,-export-dynamic    -lpthread -lgmp -ldl -lcrypt -lm   -lc
/usr/bin/ld: cannot open output file ../../../.ext/x86_64-linux/-test-/fatal/rb_fatal.so: No such file or directory
collect2: error: ld returned 1 exit status
Makefile:260: recipe for target '../../../.ext/x86_64-linux/-test-/fatal/rb_fatal.so' failed
make[2]: *** [../../../.ext/x86_64-linux/-test-/fatal/rb_fatal.so] Error 1
make[2]: Leaving directory '/tmp/ruby-src/ext/-test-/fatal'
exts.mk:88: recipe for target 'ext/-test-/fatal/all' failed
...

This error happens because /tmp/ruby-src/.ext/x86_64-linux/-test-/fatal is not properly created.

This is because of the VPATH set in ext/-test-/fatal/Makefile:

srcdir = $(top_srcdir)/ext/-test-/fatal
topdir = ../../..
hdrdir = $(top_srcdir)/include
arch_hdrdir = $(extout)/include/$(arch)
VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby

extout = $(topdir)/.ext
TIMESTAMP_DIR = $(extout)/.timestamp

$(TIMESTAMP_DIR)/.RUBYARCHDIR.-.-test-.-.fatal.time:
    $(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR)
    $(Q) $(TOUCH) $@

$(RUBYARCHDIR)/$(DLLIB): $(OBJS) Makefile $(TIMESTAMP_DIR)/.RUBYARCHDIR.-.-test-.-.fatal.time
    $(ECHO) linking shared-object -test-/fatal/$(DLLIB)
    ...

$(TIMESTAMP_DIR)/.RUBYARCHDIR.-.-test-.-.fatal.time target should create the directory prior to linking, but it doesn't work.
Since the Makefile has VPATH, make wrongly finds $(TIMESTAMP_DIR)/.RUBYARCHDIR.-.-test-.-.fatal.time at $(hdrdir)/ruby, that is /tmp/.ext/.timestamp/.RUBYARCHDIR.-.-test-.-.fatal.time.

History

Updated by nobu (Nobuyoshi Nakada) over 3 years ago

Seems there is no way to tell make not to use VPATH for a particular target.

Also available in: Atom PDF