"use of undeclared identifier 'RUBY_FUNCTION_NAME_STRING'" when trying to install ruby 3.2.6 & 3.3.7, but 3.4.1 works without issue.
Hi all,
Trying to figure out what's going on with my ruby install on a fresh M3 MacBook Air.
Whenever I try to install 3.2.2 (Currently used in my project), 3.2.6, 3.3.7, or 3.4.1 I get the same error when installing,,,
In file included from debug.c:27: ./vm_callinfo.h:216:16: error: use of undeclared identifier 'RUBY_FUNCTION_NAME_STRING' 216 | if (debug) rp(ci);
I've tried removing and reinstalling CommandLineTools, a number of PATH updates, brew installing dependencies but nothing seems to work. Its the first time I'm installing Ruby-install on a M-series chip, but generally on my previous intel machines (unsure if its related to arch but worth noting) Ruby-install just works.
I was planning to try and install openssl1.1 but look like this has been disabled
brew install [email protected] ==> Downloading https://formulae.brew.sh/api/formula.jws.json ==> Downloading https://formulae.brew.sh/api/cask.jws.json Error: [email protected] has been disabled because it is not supported upstream! It was disabled on 2024-10-24.
so I can't verify if that fixes it, currently have OpenSSL 3.4.0.
What's also strange is that when I tried installing 3.4.1, it worked. My plan currently is to just upgrade my project to this new version but I'm trying to understand what's happening and how to fix it for any future occurrences.
Please let me know what else I can provide to help understand/troubleshoot this issue.
I had a similar issue on a fresh install. I did some brew installs and it seemed to fix it. I first confirmed it was not a ruby-install issue by trying to install without ruby-install. I had the same issues.
I'm not totally sure which brew packages were needed for the fix, but the last one that got it working was gdbm.
What does brew list give you?
Having the same issue on a MacBook Air M1 running macOS Sequoia 15.3.1 when trying to install 3.1.2. No issues with 3.4.1 as well.
compiling compile.c
compiling cont.c
compiling complex.c
compiling debug.c
compiling debug_counter.c
In file included from compile.c:40:
./vm_callinfo.h:175:9: error: use of undeclared identifier 'RUBY_FUNCTION_NAME_STRING'
175 | rp(ci);
| ^
./internal.h:94:72: note: expanded from macro 'rp'
94 | #define rp(obj) rb_obj_info_dump_loc((VALUE)(obj), __FILE__, __LINE__, RUBY_FUNCTION_NAME_STRING)
| ^
In file included from compile.c:40:
./vm_callinfo.h:216:16: error: use of undeclared identifier 'RUBY_FUNCTION_NAME_STRING'
216 | if (debug) rp(ci);
| ^
./internal.h:94:72: note: expanded from macro 'rp'
94 | #define rp(obj) rb_obj_info_dump_loc((VALUE)(obj), __FILE__, __LINE__, RUBY_FUNCTION_NAME_STRING)
| ^
In file included from debug.c:27:
./vm_callinfo.h:175:9: error: use of undeclared identifier 'RUBY_FUNCTION_NAME_STRING'
175 | rp(ci);
| ^
./internal.h:94:72: note: expanded from macro 'rp'
94 | #define rp(obj) rb_obj_info_dump_loc((VALUE)(obj), __FILE__, __LINE__, RUBY_FUNCTION_NAME_STRING)
| ^
In file included from debug.c:27:
./vm_callinfo.h:216:16: error: use of undeclared identifier 'RUBY_FUNCTION_NAME_STRING'
216 | if (debug) rp(ci);
| ^
./internal.h:94:72: note: expanded from macro 'rp'
94 | #define rp(obj) rb_obj_info_dump_loc((VALUE)(obj), __FILE__, __LINE__, RUBY_FUNCTION_NAME_STRING)
| ^
2 errors generated.
compiling dir.c
make: *** [debug.o] Error 1
make: *** Waiting for unfinished jobs....
2 errors generated.
make: *** [compile.o] Error 1
!!! Compiling ruby 3.1.2 failed!
My brew list:
==> Formulae
autoconf ca-certificates jemalloc m4 ruby-install
automake chruby libffi openssl@3 xz
bison gmp libyaml readline zlib
==> Casks
I'm able to install 3.1.2 on a Raspberry Pi 3 Model B Plus Rev 1.3 (aarch64) running Debian GNU/Linux 12.9 (bookworm).
I was able to compile/install manually without error as documented in https://github.com/postmodern/chruby/wiki/Ruby:
cd ruby-3.1.2
./configure \
--prefix="$HOME/.rubies/ruby-3.1.2" \
--with-gmp-dir="$(brew --prefix gmp)" \
--with-libyaml-dir="$(brew --prefix libyaml)" \
--with-openssl-dir="$(brew --prefix openssl)" \
--with-readline-dir="$(brew --prefix readline)" \
--with-zlib-dir="$(brew --prefix zlib)" \
--with-opt-dir="$(brew --prefix jemalloc)" \
--with-jemalloc
make
make install
@joetor5 ruby-install doesn't use the other --with-*-dir= options but instead passes in a single --with-opt-dir=DIR1:DIR2:... option. This might be another bug in CRuby's ./configure not setting the --with-*-dir options based on values already passed in via --with-opt-dir. I'll probably also need to adjust the logic in configure_ruby to use the named --with-*-dir= options.
The fact that 3.4.1 works, implies this issue was eventually fixed upstream.
I am running into the same exact issue on macOS 15.4 when trying to install any 3.2.x or 3.3.x versions, but it installed just fine with 3.4.2.
Is there a solution on the way for any of the older versions or do I need to manually compile and install those?
As mentioned in a previous comment, brew install gdbm seemed to clear things up for me with ruby 3.2.4. No idea why 🤷♂
As mentioned in a previous comment,
brew install gdbmseemed to clear things up for me with ruby 3.2.4. No idea why 🤷♂
This worked for me installing 3.3.8. All is well with the world again. :D
@aedwardg
As mentioned in a previous comment,
brew install gdbmseemed to clear things up for me with ruby 3.2.4. No idea why 🤷♂
This is odd, because gdbm was supposed to have been dropped as a required dependency in 3.1.0. See #483
I'm experimenting with switching from a single --with-opt-dir option to individual --with-*-dir options for Homebrew or MacPorts dependencies. This should fix the issue of not being able to compile older Ruby version (< 3.4.0) on macOS. While I don't currently have a local macOS system to test compiling older Rubies on, you can test the branch locally: https://github.com/postmodern/ruby-install/compare/switch-to-using-with-dir-options
Another data point for brew install gdbm fixing things - without it I had to do:
ruby-install ruby 3.2.8 -- rb_cv_function_name_string=__func__
I was having the same error trying to install 3.2.2. Ran brew install gdbm, brew told me it was already installed, so I ran brew reinstall gdbm then ruby-install 3.2.2 and it finally worked