sonic-pi-net / sonic-pi

Code. Music. Live.
https://sonic-pi.net
Other
10.83k stars 922 forks source link

Building with ruby 2.7 fails #2179

Closed anatol closed 2 years ago

anatol commented 4 years ago

I am trying to build the project with ruby 2.7 and it fails:

osc.erl:15: Warning: export_all flag enabled - all functions will be exported
pi_server.erl:15: Warning: export_all flag enabled - all functions will be exported
pi_server.erl:57: Warning: variable 'T' is unused
pi_server.erl:59: Warning: variable 'Rest' is unused
pi_server.erl:170: Warning: variable 'Tag' is unused
Clearing ../../server/ruby/bin/../rb-native/2.7.0
Creating ../../server/ruby/bin/../rb-native/2.7.0
Compiling native extension in /build/sonic-pi/src/sonic-pi-3.1.0/app/server/ruby/vendor/atomic/ext
atomic_reference.c: In function ‘ir_alloc’:
atomic_reference.c:27:5: warning: ‘rb_data_object_alloc’ is deprecated: by rb_data_object_wrap [-Wdeprecated-declarations]
   27 |     return rb_data_object_alloc(klass, (void *) Qnil, ir_mark, NULL);
      |     ^~~~~~
In file included from /usr/include/ruby-2.7.0/ruby.h:33,
                 from atomic_reference.c:13:
/usr/include/ruby-2.7.0/ruby/ruby.h:1454:1: note: declared here
 1454 | rb_data_object_alloc(VALUE klass, void *data, RUBY_DATA_FUNC dmark, RUBY_DATA_FUNC dfree)
      | ^~~~~~~~~~~~~~~~~~~~
Copying /build/sonic-pi/src/sonic-pi-3.1.0/app/server/ruby/vendor/atomic/ext/atomic_reference.so to ../../server/ruby/bin/../rb-native/2.7.0/
Compiling native extension in /build/sonic-pi/src/sonic-pi-3.1.0/app/server/ruby/vendor/interception/ext
make: *** No rule to make target 'clean'.  Stop.
Compiling native extension in /build/sonic-pi/src/sonic-pi-3.1.0/app/server/ruby/vendor/fast_osc-0.0.12/ext/fast_osc
fast_osc_wrapper.c: In function ‘ruby_time_to_osc_timetag’:
fast_osc_wrapper.c:57:80: warning: ISO C99 requires at least one argument for the "..." in a variadic macro
   57 |       floattime = JAN_1970 + NUM2DBL(rb_funcall(rubytime, rb_intern("to_f"), 0));
      |                                                                                ^
Copying /build/sonic-pi/src/sonic-pi-3.1.0/app/server/ruby/vendor/fast_osc-0.0.12/ext/fast_osc/fast_osc.so to ../../server/ruby/bin/../rb-native/2.7.0/
Compiling native extension in /build/sonic-pi/src/sonic-pi-3.1.0/app/server/ruby/vendor/did_you_mean-0.10.0/ext/did_you_mean
Copying /build/sonic-pi/src/sonic-pi-3.1.0/app/server/ruby/vendor/did_you_mean-0.10.0/ext/did_you_mean/method_receiver.so to ../../server/ruby/bin/../rb-native/2.7.0/did_you_mean
/build/sonic-pi/src/sonic-pi-3.1.0/app/server/ruby/vendor/did_you_mean-0.10.0/lib/did_you_mean/version.rb:2: warning: already initialized constant DidYouMean::VERSION
/usr/lib/ruby/2.7.0/did_you_mean/version.rb:2: warning: previous definition of VERSION was here
/build/sonic-pi/src/sonic-pi-3.1.0/app/server/ruby/vendor/did_you_mean-0.10.0/lib/did_you_mean/jaro_winkler.rb:63: warning: already initialized constant DidYouMean::JaroWinkler::WEIGHT
/usr/lib/ruby/2.7.0/did_you_mean/jaro_winkler.rb:63: warning: previous definition of WEIGHT was here
/build/sonic-pi/src/sonic-pi-3.1.0/app/server/ruby/vendor/did_you_mean-0.10.0/lib/did_you_mean/jaro_winkler.rb:64: warning: already initialized constant DidYouMean::JaroWinkler::THRESHOLD
/usr/lib/ruby/2.7.0/did_you_mean/jaro_winkler.rb:64: warning: previous definition of THRESHOLD was here
/build/sonic-pi/src/sonic-pi-3.1.0/app/server/ruby/vendor/kramdown/lib/kramdown/options.rb:104:in `strip!': can't modify frozen String: "" (FrozenError)
    from /build/sonic-pi/src/sonic-pi-3.1.0/app/server/ruby/vendor/kramdown/lib/kramdown/options.rb:104:in `parse'
    from /build/sonic-pi/src/sonic-pi-3.1.0/app/server/ruby/vendor/kramdown/lib/kramdown/options.rb:82:in `block in merge'
    from /build/sonic-pi/src/sonic-pi-3.1.0/app/server/ruby/vendor/kramdown/lib/kramdown/options.rb:80:in `each'
    from /build/sonic-pi/src/sonic-pi-3.1.0/app/server/ruby/vendor/kramdown/lib/kramdown/options.rb:80:in `merge'
    from /build/sonic-pi/src/sonic-pi-3.1.0/app/server/ruby/vendor/kramdown/lib/kramdown/parser/base.rb:53:in `initialize'
    from /build/sonic-pi/src/sonic-pi-3.1.0/app/server/ruby/vendor/kramdown/lib/kramdown/parser/kramdown.rb:65:in `initialize'
    from /build/sonic-pi/src/sonic-pi-3.1.0/app/server/ruby/vendor/kramdown/lib/kramdown/parser/base.rb:66:in `new'
    from /build/sonic-pi/src/sonic-pi-3.1.0/app/server/ruby/vendor/kramdown/lib/kramdown/parser/base.rb:66:in `parse'
    from /build/sonic-pi/src/sonic-pi-3.1.0/app/server/ruby/vendor/kramdown/lib/kramdown/document.rb:107:in `initialize'
    from ../../server/ruby/bin/i18n-tool.rb:210:in `new'
    from ../../server/ruby/bin/i18n-tool.rb:210:in `block (2 levels) in <main>'
    from ../../server/ruby/bin/i18n-tool.rb:199:in `each'
    from ../../server/ruby/bin/i18n-tool.rb:199:in `block in <main>'
    from ../../server/ruby/bin/i18n-tool.rb:171:in `each'
    from ../../server/ruby/bin/i18n-tool.rb:171:in `<main>'

Could you please help to understand how to fix the issue?

samaaron commented 4 years ago

Hi, we unfortunately don't have the resources to support Linux users at this point.

I can say that we have made no effort at this stage to work on Ruby 2.7 compatability. We do know that at least on macOS that Ruby 2.6.5 works, so it might be wise to work with that version for the time being.

anatol commented 4 years ago

it might be wise to work with that version for the time being

Arch Linux is adding 2.7 as its system ruby version. And we want to enable it for all applications we maintain in our repository. Adding multiple versions of ruby for sonic-pi and its dependencies creates a lot of mess actually and we would like to avoid it.

to work on Ruby 2.7 compatability

ruby 2.7 is mostly compatible with 2.6. The error above is likely due to ancient version of kramdown. If the dependency is updated then it most likely solve the compatibility problem.

The standard way to maintain bundled ruby dependencies is to use bundler. Is there any chance for you to merge https://github.com/samaaron/sonic-pi/pull/2110 and then bump the dependency versions?

samaaron commented 4 years ago

As far as I can see #2110 is not complete yet. Could you merge it locally and test? It would be good to get some feedback on its status.

anatol commented 4 years ago

@dvzrv do you have cycles to look at the bundler patch?

dvzrv commented 4 years ago

@anatol I'll try to devendor kramdown, i18n and whatever else is in the way, but I'm also more or less on holiday, so this will require some time. The build setup for sonic-pi is not really straight forward to patch

anatol commented 4 years ago

Here is my attempt to convert sonic-pi to bundler https://github.com/anatol/sonic-pi/tree/bundler . Tests that I ran with rake test pass.

The only caveat that I need to apply this patch https://github.com/xavriley/ruby-aubio/commit/5c0a96e9cc837b7ffdec430e6d39215ec93b3995 otherwise gem cannot find aubio shared library at my Linux system.

JohnAZoidberg commented 4 years ago

Ruby 2.4 is EOL in March (i.e. 2 weeks). Any progress on supporting 2.7?

samaaron commented 4 years ago

Yes, we have supported 2.7 for a while now :-)

What is failing for you?

JohnAZoidberg commented 4 years ago

Could you please create a new release, then?

On Linux the build process it not creating a binary (or even the build directory) for me and the instructions for how to build are outdated, unfortunately: https://github.com/samaaron/sonic-pi/blob/master/INSTALL-LINUX.md.

samaaron commented 4 years ago

I tagged v3.2.0 on Github on Monday.

Unfortunately I don't currently have the resources to make builds for or to support Linux in general.

There have been improvements in the build process and I'm hoping to sort them out some more, but help here would definitely be useful as I don't currently have a linux box (other than my servers).

samaaron commented 2 years ago

Closing due to inactivity.

We have completely overhauled the building and booting systems in the recently released v4 of Sonic Pi:

https://github.com/sonic-pi-net/sonic-pi/releases

Please do give v4 a try and feel free to create a new issue if you're still having problems. If there isn't a package available for your Linux distribution, then you should be able to self-compile using the following instructions:

https://github.com/sonic-pi-net/sonic-pi/blob/dev/BUILD-LINUX.md