3

I've been struggling with trying to upgrade rails 3.0 for about a week now.

I'm not entirely sure what the issue is but I was thinking it could be due to the fact that I have both rvm and rbenv.

I've followed the upgrade tutorial from gorails here: https://gorails.com/setup/osx/12-monterey

But whenever I run:

$ rbenv install 3.0.3

I get the following error:

In file included from compile.c:40:
./vm_callinfo.h:217:16: error: use of undeclared identifier 'RUBY_FUNCTION_NAME_STRING'
    if (debug) rp(ci);
               ^
./internal.h:95:72: note: expanded from macro 'rp'
#define rp(obj) rb_obj_info_dump_loc((VALUE)(obj), __FILE__, __LINE__, RUBY_FUNCTION_NAME_STRING)

Here is also a look at my error logs:

In file included from compile.c:40:
./vm_callinfo.h:217:16: error: use of undeclared identifier 'RUBY_FUNCTION_NAME_STRING'
    if (debug) rp(ci);
               ^
./internal.h:95:72: note: expanded from macro 'rp'
#define rp(obj) rb_obj_info_dump_loc((VALUE)(obj), __FILE__, __LINE__, RUBY_FUNCTION_NAME_STRING)
                                                                       ^
2 errors generated.
make: *** [compile.o] Error 1

I'm a junior dev who coded a majority of the time RoR but I truly do not understand this environment stuff, so if anyone has any resources that I could read up on that would help, it would be much appreciated. If I left out any crucial information, my apologies. Just let me know and I'll try to respond as quickly as possible

Jason FB
  • 4,752
  • 3
  • 38
  • 69
  • Could you try doing upgrading your ruby-install to rule out any openssl issue that many seem to have? `brew upgrade ruby-install` After this you could try `rbenv rehash` and `rbenv install 3.0.3` – Prateek Choudhary Mar 25 '22 at 03:32
  • Thanks for the response. I tried it but errors persisted. I tried @Piyush Awasthi method and it made the issues worse. – Travis Courtney Mar 25 '22 at 18:24

4 Answers4

5

The problem is caused by Xcode command line tools being outdated. Use the following script to force update Xcode command line tools.

sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
  • Please describe what this does and how it will fix the OP's problem. – Thomas Sep 23 '22 at 15:07
  • Worked for me, not sure why. For reference, I was running `rbenv install 2.7.6` on a mac using macOS Monterey version 12.6.1. – michotross Nov 19 '22 at 01:33
  • @Thomas xcode-select will install new toolchain libraries and new dynamic dependencies. And It should help to build new `sources` from `make` commands. By C/C++ compilators. – Bimawa Nov 22 '22 at 15:31
  • This may help you, but be aware that it removes all command line tools and it can take hours to reinstall all of them – Hayk Simonyan Dec 08 '22 at 10:24
  • Tried with macOS Monterey 12.6 and no luck. – josh Aug 23 '23 at 17:21
1

I tried

sudo xcode-select -s /Library/Developer/CommandLineTools

then install ruby again. Hope that work for you

  • I had this issue installing Ruby 3.2.2 on Monterey 12.6.7. Re-installing the command line tools did not work by itself. Only after running this command was I able to install it successfully. – Jesse Clark Aug 15 '23 at 11:56
0

Try this I hope that work for you

brew update
brew upgrade
brew install llvm
export PATH="/usr/local/opt/llvm/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/llvm/lib"
export CPPFLAGS="-I/usr/local/opt/llvm/include"
rbenv install 3.0.3
rbenv rehash
Piyush Awasthi
  • 368
  • 3
  • 13
  • uh oh... This made it even worse lol. `pps/bf_prefix.c:10:10: fatal error: 'stdio.h' file not found apps/s_socket.capps/s_cb.c:11:10: fatal error: 'stdio.h' file not found apps/apps.c:18:10: fatal error: 'stdio.h' file not found` Here's a piece of the error log but it reported 10 errors. I believe these are where the errors start – Travis Courtney Mar 25 '22 at 18:21
0

Finally found a solution. Essentially there was an OS update and with that some command tool updates that weren't showing up. After forcing the update for the command tools it updated to rub 3.0.3 without any issues.

  • 2
    How did you force the update for the command tools? I've tried to rerun it again, but it seems it's not responding for some reason. MacOS Monterey. – poslinski.net Jul 25 '22 at 13:38