
Issue #20241 has been reported by kjtsanaktsidis (KJ Tsanaktsidis). ---------------------------------------- Bug #20241: Makefile rule for BUILTIN_ENCOBJS https://bugs.ruby-lang.org/issues/20241 * Author: kjtsanaktsidis (KJ Tsanaktsidis) * Status: Open * Priority: Normal * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- When I build Ruby out-of-source (e.g. in a `build/` subdirectory) by running `mkdir build && cd build && ../configure <args> && make`, the build fails because GCC tries to write `build/enc/ascii.o` but the `build/enc` subdirectory does not exist. If I run `make --debug` from this point, this is the chain of rules causing this to happen: ``` kj@kj-thinkpad build % make --debug V=1 GNU Make 4.4.1 Built for x86_64-redhat-linux-gnu Copyright (C) 1988-2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Reading makefiles... Updating makefiles.... Updating goal targets.... File 'all' does not exist. File 'main' does not exist. File 'exts' does not exist. File 'build-ext' does not exist. File 'exts.mk' does not exist. File 'ext/configure-ext.mk' does not exist. File 'miniruby' does not exist. File 'enc/ascii.o' does not exist. Must remake target 'enc/ascii.o'. gcc -DVM_CHECK_MODE=1 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-strict-overflow -fvisibility=hidden -fexcess-precision=standard -DRUBY_EXPORT -fPIE -I. -I.ext/include/x86_64-linux -I../include -I.. -I../prism -I../enc/unicode/15.0.0 -o enc/ascii.o -c ../enc/ascii.c Assembler messages: Fatal error: can't create enc/ascii.o: No such file or directory make: *** [Makefile:448: enc/ascii.o] Error 1 ``` I don't know when exactly this started - it could simply be that by random chance my machine did used to run other rules first which did create `enc/`, and now doesn't, since make rules are not a total order. I'm not sure exactly what the right way to fix this. I think in a "standard GNU autotools project", the right way for these subdirs to be created is for each of them to have their own Makefile.in. That way, ./configure would create the subdirectory in the build dir and template out the Makefile.in into e.g. `build/enc/Makefile`. However, we don't use recursive make, so we don't call `AC_CONFIG_FILES([enc/Makefile])` or anything like that. (There is actually an `enc/Makefile.in`, but it's templated by a Ruby script, not by autoconf). Has anybody else noticed this? -- https://bugs.ruby-lang.org/