From: "restless (Aleksey Kravchenko)" Date: 2012-05-12T04:07:26+09:00 Subject: [ruby-core:44999] [Ruby 1.8 - Bug #6424][Open] mkmf generates incorrect Makefile Issue #6424 has been reported by restless (Aleksey Kravchenko). ---------------------------------------- Bug #6424: mkmf generates incorrect Makefile https://bugs.ruby-lang.org/issues/6424 Author: restless (Aleksey Kravchenko) Status: Open Priority: Normal Assignee: Category: Target version: ruby -v: ruby 1.8.7 (2012-02-08 patchlevel 358) [x86_64-linux] The code to reproduce the bug: --- begin of extconf.rb --- require 'mkmf' create_makefile('test') --- end of extconf.rb --- --- begin of test.c --- /* empty ruby module */ --- end of test.c --- The steps to reproduce and error log: $ ruby extconf.rb $ make -j2 install DESTDIR=/tmp MAKEDIRS="sleep 1; echo do_mkdir; mkdir -p" sleep 1; echo do_mkdir; mkdir -p /tmp/usr/local/lib/site_ruby/1.8/x86_64-linux gcc -I. -I/usr/lib/ruby/1.8/x86_64-linux -I/usr/lib/ruby/1.8/x86_64-linux -I. -D_FORTIFY_SOURCE=2 -fPIC -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -Wall -fno-strict-aliasing -g -g -O2 -fPIC -c test.c gcc -shared -o test.so test.o -L. -L/tmp/usr/lib -L. -Wl,-z,relro -rdynamic -Wl,-export-dynamic -lruby1.8 -lpthread -lrt -ldl -lcrypt -lm -lc /usr/bin/install -c -m 0755 test.so /tmp/usr/local/lib/site_ruby/1.8/x86_64-linux /usr/bin/install: cannot create regular file `/tmp/usr/local/lib/site_ruby/1.8/x86_64-linux': No such file or directory make: *** [/tmp/usr/local/lib/site_ruby/1.8/x86_64-linux/test.so] Error 1 make: *** Waiting for unfinished jobs.... do_mkdir Expected: no error shall occur. The $(MAKEDIRS) mkdir command must be executed alwais before installing *.so file. Note: I've specified MAKEDIRS command with 'sleep' only to reproduce the concurrency bug. Originally it occurred on busy Debian build-server, running `make -j2 install` (in 2 parallel threads). The cause of the bug is incorrect dependency of 'install-so' in Makefile: --- part of generated Makefile --- install: install-so install-rb install-so: $(RUBYARCHDIR) install-so: $(RUBYARCHDIR)/$(DLLIB) $(RUBYARCHDIR)/$(DLLIB): $(DLLIB) $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR) ... $(RUBYARCHDIR): $(MAKEDIRS) $@ --- end of part of generated Makefile --- -- http://bugs.ruby-lang.org/