Bug #21917
closedUnable to build 4.0.1 on AIX 7.2
Description
I'm attempting to build Ruby 4.0.1 on AIX 7.2. We have had successful builds of previous versions of Ruby on this platform, but are starting to see an issue when using miniruby to build Ruby:
./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems -r./powerpc64-aix7.2.0.0-fake ./tool/rbinstall.rb --make="gmake" --dest-dir="" --extout=".ext" --ext-build-dir="./ext" --mflags="-j3 --jobserver-auth=fifo:/tmp//GMfifo9306586" --make-flags=" -j3 --jobserver-auth=fifo:/tmp//GMfifo9306586" --data-mode=0644 --prog-mode=0755 --installed-list .installed.list --mantype="man" --install=all --exclude=doc
/var/tmp/tmp.INfzUXAeGi/ruby-4.0.1/.ext/common/monitor.rb:10:in 'Kernel#require': false() function is unimplemented on this machine (NotImplementedError)
from /var/tmp/tmp.INfzUXAeGi/ruby-4.0.1/.ext/common/monitor.rb:10:in '<top (required)>'
from /var/tmp/tmp.INfzUXAeGi/ruby-4.0.1/lib/rubygems.rb:1452:in '<top (required)>'
from /var/tmp/tmp.INfzUXAeGi/ruby-4.0.1/lib/rubygems.rb:1452:in 'Kernel#eval'
from /var/tmp/tmp.INfzUXAeGi/ruby-4.0.1/lib/rubygems.rb:1452:in '<top (required)>'
from ./tool/rbinstall.rb:25:in 'Kernel#require'
from ./tool/rbinstall.rb:25:in '<main>'
I'm not sure where the NotImplementedError is coming from, and when looking at the truss output from miniruby, I see a ENOTTY when miniruby attempts to load monitor.so:
accessx("/var/tmp/tmp.INfzUXAeGi/ruby-4.0.1/.ext/powerpc64-aix7.2.0.0/monitor.so", 0, 0) = 0
statx("/", 0x0FFFFFFFFFFFA680, 176, 011) = 0
statx("/var", 0x0FFFFFFFFFFFA680, 176, 011) = 0
statx("/var/tmp", 0x0FFFFFFFFFFFA680, 176, 011) = 0
statx("/var/tmp/tmp.INfzUXAeGi", 0x0FFFFFFFFFFFA680, 176, 011) = 0
statx("/var/tmp/tmp.INfzUXAeGi/ruby-4.0.1", 0x0FFFFFFFFFFFA680, 176, 011) = 0
statx("/var/tmp/tmp.INfzUXAeGi/ruby-4.0.1/.ext", 0x0FFFFFFFFFFFA680, 176, 011) = 0
statx("/var/tmp/tmp.INfzUXAeGi/ruby-4.0.1/.ext/powerpc64-aix7.2.0.0", 0x0FFFFFFFFFFFA680, 176, 011) = 0
statx("/var/tmp/tmp.INfzUXAeGi/ruby-4.0.1/.ext/powerpc64-aix7.2.0.0/monitor.so", 0x0FFFFFFFFFFFA680, 176, 011) = 0
__ksetjmp(0x0000000110019F88, 0x09000000026845A8, 2, 0x000000011001A1D8, 0x0FFFFFFFFFFFB790, 0x0000000022242202, 0x000000011011A658, 0x09000
00000260348) = 0
statx("/var/tmp/tmp.INfzUXAeGi/ruby-4.0.1/.ext/powerpc64-aix7.2.0.0/monitor.so", 0x0FFFFFFFFFFFB800, 176, 0) = 0
kioctl(2, 22528, 0x0000000000000000, 0x0000000000000000) Err#25 ENOTTY
/var/tmp/tmp.INfzUXAeGi/ruby-4.0.1/.ext/common/monitor.rb:10:in 'Kernel#require': false() function is unimplemented on this machine (NotImpl
ementedError)
from /var/tmp/tmp.INfzUXAeGi/ruby-4.0.1/.ext/common/monitor.rb:10:in '<top (required)>'
from /var/tmp/tmp.INfzUXAeGi/ruby-4.0.1/lib/rubygems.rb:1452:in '<top (required)>'
from /var/tmp/tmp.INfzUXAeGi/ruby-4.0.1/lib/rubygems.rb:1452:in 'Kernel#eval'
from /var/tmp/tmp.INfzUXAeGi/ruby-4.0.1/lib/rubygems.rb:1452:in '<top (required)>'
from ./tool/rbinstall.rb:25:in 'Kernel#require'
from ./tool/rbinstall.rb:25:in '<main>'
monitor.so is present in the path that miniruby is looking for it.
Any pointers on where to start debugging this further or what changes in more recent versions of Ruby could have caused this would be greatly appreciated.
Thank you!
Updated by nobu (Nobuyoshi Nakada) 3 days ago
Probably this may help:
diff --git a/dln.c b/dln.c
index 2549f031835..01dfccd0534 100644
--- a/dln.c
+++ b/dln.c
@@ -506,6 +506,7 @@ static void *
dln_load_and_init(const char *file, const char *init_fct_name)
{
#if defined(_WIN32) || defined(USE_DLN_DLOPEN)
+# define DLN_IMPLEMENTED 1
void *handle = dln_open(file);
#ifdef RUBY_DLN_CHECK_ABI
@@ -523,6 +524,7 @@ dln_load_and_init(const char *file, const char *init_fct_name)
return handle;
#elif defined(_AIX)
+# define DLN_IMPLEMENTED 1
{
void (*init_fct)(void);
@@ -547,7 +549,7 @@ dln_load_and_init(const char *file, const char *init_fct_name)
void *
dln_load(const char *file)
{
-#if defined(_WIN32) || defined(USE_DLN_DLOPEN)
+#ifdef DLN_IMPLEMENTED
char *init_fct_name;
init_funcname(&init_fct_name, file);
return dln_load_and_init(file, init_fct_name);
@@ -560,7 +562,7 @@ dln_load(const char *file)
void *
dln_load_feature(const char *file, const char *fname)
{
-#if defined(_WIN32) || defined(USE_DLN_DLOPEN)
+#ifdef DLN_IMPLEMENTED
char *init_fct_name;
init_funcname(&init_fct_name, fname);
return dln_load_and_init(file, init_fct_name);
Updated by nobu (Nobuyoshi Nakada) 3 days ago
- Backport changed from 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN to 3.2: DONTNEED, 3.3: DONTNEED, 3.4: DONTNEED, 4.0: REQUIRED
Or, more simply:
diff --git a/dln.c b/dln.c
index 2549f031835..3725b95fbb7 100644
--- a/dln.c
+++ b/dln.c
@@ -89,7 +89,7 @@ dln_loaderror(const char *format, ...)
}
#endif
-#if defined(HAVE_DLOPEN) && !defined(_AIX) && !defined(_UNICOSMP)
+#if defined(HAVE_DLOPEN) && !defined(_UNICOSMP)
/* dynamic load with dlopen() */
# define USE_DLN_DLOPEN
#endif
Updated by nobu (Nobuyoshi Nakada) 3 days ago
- Status changed from Open to Closed
Updated by mhashizume (Michael Hashizume) 2 days ago
Thanks for the quick reply. Your second, more simple patch in https://bugs.ruby-lang.org/issues/21917#note-2 worked to resolve my build issue.
I also tried your commit 361644c0cce3235e9cc6724994c6b5711deb10b8 but the build fails with a different issue:
compiling strscan.c
installing default strscan libraries
strscan.c:621:1: error: static declaration of 'rb_reg_onig_match' follows non-static declaration
621 | rb_reg_onig_match(VALUE re, VALUE str,
| ^~~~~~~~~~~~~~~~~
In file included from strscan.c:12:
../.././include/ruby/re.h:149:14: note: previous declaration of 'rb_reg_onig_match' was here
149 | OnigPosition rb_reg_onig_match(VALUE re, VALUE str,
| ^~~~~~~~~~~~~~~~~
gmake[3]: Leaving directory '/var/tmp/tmp.DXpB2u0vTN/ruby-4.0.1/ext/strscan'
gmake[3]: *** [Makefile:269: strscan.o] Error 1
gmake[2]: *** [exts.mk:322: ext/strscan/all] Error 2
gmake[2]: *** Waiting for unfinished jobs....
linking shared-object stringio.so
gmake[3]: Leaving directory '/var/tmp/tmp.DXpB2u0vTN/ruby-4.0.1/ext/stringio'
linking shared-object ripper.so