Sonic-pi: Rugged fails to compile with latest ruby

Created on 21 May 2018  Â·  19Comments  Â·  Source: sonic-pi-net/sonic-pi

Currently, with ruby 2.5.1 the rugged component fails to compile:

Compiling native extension in /build/sonic-pi/src/sonic-pi-3.1.0/app/server/ruby/vendor/rugged-0.26.0/ext/rugged                                                                          
In file included from /usr/include/ruby-2.5.0/ruby.h:33,                                                                                                                                  
                 from rugged.h:16,                                                                                                                                                        
                 from rugged_blame.c:8:                                                                                                                                                   
In function ‘rb_git_blame_each.part.0’,                                                                                                                                                   
    inlined from ‘rb_git_blame_each’:                                                                                                                                                     
/usr/include/ruby-2.5.0/ruby/ruby.h:1779:3: error: call to ‘rb_varargs_bad_length’ declared with attribute error:  argument length doesn't match                                          
   rb_varargs_bad_length(argc, vargc)), \                                                                                                                                                 
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                                                     
/usr/include/ruby-2.5.0/ruby/ruby.h:2474:6: note: in expansion of macro ‘rb_varargs_argc_check’                                                                                           
      rb_varargs_argc_check(rb_funcall_argc, rb_funcall_nargs), \                                                                                                                         
      ^~~~~~~~~~~~~~~~~~~~~                                                                                                                                                               
rugged_blame.c:246:10: note: in expansion of macro ‘rb_funcall’                                                                                                                           
   return rb_funcall(self, rb_intern("to_enum"), 1, CSTR2SYM("each"), self);                                                                                                              
          ^~~~~~~~~~                                                                                                                                                                      
make: *** [Makefile:242: rugged_blame.o] Error 1                                                        

This seems to be the related ruby upstream bug.

As these compilation steps are not hooked into a build system, this leads to errors only later in the build (when the documentation is about to be built).

Most helpful comment

Thanks for the reference to the patch @bmwiedemann, manually applying to the vendored version of rugged on Fedora 28 (ruby2.5.1p57) works to resolve this error locally.

I image the vendored dependency should be updated at some point to incorporate the fix but until then it can be applied by downloading this patch:

https://gist.github.com/movitto/adeb3f3eee9aaaaf52dfc860d37c18be

and simply running git apply ruby-2.5.patch in the top level sonic-pi directory

All 19 comments

The same issue was reported for the aur-package.

I have the same problem. It's possible donwgrade ruby 2.5 to ruby 2.4, install sonic-pi and upgrade ruby to 2.5 ?

@MoiRouhs In theory, maybe. Not on Arch Linux though.
@samaaron is there a fix in sight?

Consider how you're mentioning Arch, I'm guessing you're using the aur-package? That version is linked to the current latest release of sonic pi: 3.1.

Check the commits since the release of 3.1: https://github.com/samaaron/sonic-pi/compare/v3.1.0...master and do ctrl+f on "ruby".
I think this issue might have been fixed already (and is part of the current up-to-date master branch), but is not part of 3.1 or the aur-package. So that should leave a few options:

  • Install from the master branch, instead of 3.1 (directly from here).
  • Get the aur-package owner to point to master instead of 3.1 (probably won't happen due to constant work/commits involved)
  • Wait until the next big release of sonic pi (3.2?) and then poke the aur-package to get it updated there too.

@samaaron: Any idea when 3.2 will be released? Thanks!

@lexmortis no, I'm building the package for Arch Linux' [community] repository (still stuck in testing).
This is referring to 3.1.0 (latest stable).
A new release will most likely break my FHS patches... -_-

@dvzrv @MoiRouhs Regarding downgrading to an older version of Ruby, compiling the AUR package, and then upgrading again:

I was able to manually remove Ruby 2.5 from my system, then install Ruby 2.3.3 from the Arch Linux Archive and compile Sonic Pi 3.1.0. It kinda-sort-of worked (occasionally I couldn't get it to start), but I wasn't able to get it to work at all with Ruby 2.5 - it wouldn't start.

Obviously this isn't a real fix, but if there's anyone who _needs Sonic Pi right now_ on their machine, this is an option that can be tried.

@jsaalfeld

The same issue was reported for the aur-package.

Looks like the maintained of that aur-package removed the package completely.

@dvzrv I hope you can pull it off to create a working proper Linux package.

@lexmortis well, I hope that, too! And I also wish reproducibility wasn't broken now :(

This package work ? the last update was made 2018-07-16 23:38 UTC

Getting somewhere!

On Manjaro (Arch fork) it installs without errors. Ran jackd & qjackctl, after that started sonic-pi but won't get past splash screen.

Checked the logs and found this:

cat ~/.sonic-pi/log/server-errors.log:

terminate called after throwing an instance of 'std::system_error'
  what():  Invalid argument
/usr/share/sonic-pi/server/vendor/sys-proctable-1.1.3/lib/linux/sys/proctable.rb:112: warning: constant ::Fixnum is deprecated

And now I'm stuck.

Not sure if it's related, but updated a bunch of packages (big Manjaro update), and now it works!

Command executed in order, all their own terminal to keep it running:

jackd -R -d alsa -d hw:1
qjackctl
sonic-pi

And after the splash screen, sonic-pi actually runs and works!

@lexmortis: The current Arch package should work (as it has been compiled before the minor version update of Ruby).

That being said: This issue is not about how to run sonic-pi on Manjaro, but that compiling with current ruby is broken. Please stop hijacking this issue by sidetracking it with arbitrary information.

@samaaron: I would very much appreciate a fix for current ruby instead of 'fixing the recommendation to use an older ruby version'. Breakage with a minor version release of the language in question should be addressed in a new release of sonic-pi directly and not prolonged by creating a fixed ruby dependency.

If there's no fix for this in the coming release I will abstain from further maintaining sonic-pi downstream because of the already high workload for it. Reproducibility is already broken since I reported this issue.

FWIW, starting from the current PKGBUILD for sonic-pi in community, with some modifications, had success in getting sonic-pi to work.

The short version is that using rugged-0.27.4 (or it may have been dae6f4b4be45d5eaf3325ee700100ebed1120375) plus some tweaking seems to do the trick.

May be sonic-pi can be updated?

Anyway, a bit more detailed version follows:

  1. clone arch linux's community repos (0357dcf102dffe7689d97000113c41a379c60fc6)
  2. invoked makepkg (expecting the failure) in community/sonic-pi/trunk
  3. modified things under src/sonic-pi-3.1.0 to use rugged-0.27.4 (something like: edit compile-extensions.rb and clone the rugged repos + git submodule {init,update})
  4. follow the steps in the build() portion of the PKGBUILD
  5. use makepkg --repackage to create the package
  6. install the package and try to start it (expecting failure)
  7. inspect ~/.sonic-pi/logs/* for various issues
  8. install reatlime-privileges (and do the corresponding addition of user to appropriate group if necessary - plus logging out and in)
  9. really should fix the patch for various paths, but to see things work, use sudo to create the directories /usr/share/sonic-pi/server/native/osmid and /usr/share/sonic-pi/server/erlang and create symlinks to /usr/bin{o2m,m2o} in the former and /usr/lib/sonic-pi/{osc,pi_server}.beam in the latter

In the setup here, also had to mess around w/ /etc/asound.conf and getting pulseaudio / jack issues settled, but IIUC, this type of thing is user-specific. (But FWIW, the Arch Wiki JACK Audio Connection Kit and PulseAudio/Troubleshooting pages had some helpful info.) On a side note, I can now use sonic-pi, but apparently not much else with sound, but presume this is because of configuration issues here. With some more work, sonic-pi, multiple other apps using audio, ALSA, JACK, and PulseAudio seem to be cooperating with each other now.

on debian testing I had to use ruby2.3 during build and runtime:

mkdir -p ../../server/native/ruby/bin/
ln -s `which ruby2.3` ../../server/native/ruby/bin/ruby

2.5 was not working.

Found the fix: https://github.com/libgit2/rugged/commit/6eeccfebb0af3084d963e8dd5d7fdb13b2907a04
some of the rb_funcall lines were declared with an arg count of 1 but then passed 2 args in.

Thanks for the reference to the patch @bmwiedemann, manually applying to the vendored version of rugged on Fedora 28 (ruby2.5.1p57) works to resolve this error locally.

I image the vendored dependency should be updated at some point to incorporate the fix but until then it can be applied by downloading this patch:

https://gist.github.com/movitto/adeb3f3eee9aaaaf52dfc860d37c18be

and simply running git apply ruby-2.5.patch in the top level sonic-pi directory

Thanks for the reference to the patch @bmwiedemann, manually applying to the vendored version of rugged on Fedora 28 (ruby2.5.1p57) works to resolve this error locally.

I image the vendored dependency should be updated at some point to incorporate the fix but until then it can be applied by downloading this patch:

https://gist.github.com/movitto/adeb3f3eee9aaaaf52dfc860d37c18be

and simply running git apply ruby-2.5.patch in the top level sonic-pi directory

This works on ubuntu-18.10 as well :-) thx! @movitto

I have now de-vendored rugged from sonic-pi and provide the ruby-rugged package for Arch Linux.
IMHO all of the gems should be de-vendored to circumvent situations like these.
It's much more useful and flexible (also for testing) to not vendor them, but to install them using gem (or via your system's package manager, where applicable).

I succeeded to compile sonic-pi on fedora with ruby-2.5.3. I had to replace the rugged installed version by rugged-0.28.0.
The binary works fine. I ran an example without problems.
The version of supercollider used is 3.10.2.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sbeaumont picture sbeaumont  Â·  3Comments

Tob027 picture Tob027  Â·  4Comments

josephwilk picture josephwilk  Â·  3Comments

chunseoklee picture chunseoklee  Â·  4Comments

datramt picture datramt  Â·  5Comments