[ruby-talk:444556] Can't gem install websocket-driver on Ubuntu 22.04

Hi all, I am new to Ruby and just trying to get started with Rails; however I am having some difficulty getting things installed on my Ubuntu 22.04 machine. I installed build-essential and then installed rvm, and using rvm installed ruby-3.3.5. But when I tried to `gem install rails` things broke, and it seems to be isolated to the websocket-driver. I asked over on Github <https://github.com/faye/websocket-driver-ruby/issues/92> about but he suggested I ask on this mailing list instead. Here's the full output of what I see when I try and install it: ``` $ gem install websocket-driver Fetching websocket-driver-0.7.6.gem Fetching websocket-extensions-0.1.5.gem Successfully installed websocket-extensions-0.1.5 Building native extensions. This could take a while... ERROR: Error installing websocket-driver: ERROR: Failed to build gem native extension. current directory: /home/gmyers/.rvm/gems/ruby-3.3.5/gems/websocket-driver-0.7.6/ext/websocket-driver /home/gmyers/.rvm/rubies/ruby-3.3.5/bin/ruby extconf.rb creating Makefile current directory: /home/gmyers/.rvm/gems/ruby-3.3.5/gems/websocket-driver-0.7.6/ext/websocket-driver make DESTDIR\= sitearchdir\=./.gem.20240906-217707-s3rqfx sitelibdir\=./.gem.20240906-217707-s3rqfx clean current directory: /home/gmyers/.rvm/gems/ruby-3.3.5/gems/websocket-driver-0.7.6/ext/websocket-driver make DESTDIR\= sitearchdir\=./.gem.20240906-217707-s3rqfx sitelibdir\=./.gem.20240906-217707-s3rqfx compiling websocket_mask.c gcc: error: unrecognized command-line option ‘-fdeclspec’ gcc: error: unrecognized command-line option ‘-Wextra-tokens’; did you mean ‘-Wextra-semi’? gcc: error: unrecognized command-line option ‘-Wdivision-by-zero’; did you mean ‘-Wdiv-by-zero’? gcc: error: unrecognized command-line option ‘-Wshorten-64-to-32’ make: *** [Makefile:248: websocket_mask.o] Error 1 make failed, exit code 2 Gem files will remain installed in /home/gmyers/.rvm/gems/ruby-3.3.5/gems/websocket-driver-0.7.6 for inspection. Results logged to /home/gmyers/.rvm/gems/ruby-3.3.5/extensions/x86_64-linux/3.3.0/websocket-driver-0.7.6/gem_make.out ``` As far as I know, I have the latest gcc (it's version 11.4.0). Has anyone else encountered issues like this before? Any advice?

I see you already fixed your issue by installing clang and using that to build the gem. When you installed ruby with rvm did you build from source or install a binary? "By default RVM will try to download binary ruby package instead of compiling. If such package is not available normal compilation will be performed." I don't know which compiler they use for the prebuilt binary. Something like this may shed some light: ruby -rrbconfig -e 'puts RbConfig::CONFIG["CC"]'
participants (2)
-
Frank J. Cameron
-
Gordon Myers