0

I installed redmine from ports on my FreeBSD 11.3 Now trying to access it from browser and it crashes. error log displays the following.

    /usr/local/lib/ruby/gems/2.6/gems/activesupport-4.2.11.1/lib/active_support/core_ext/object/duplicable.rb:111: warning: BigDecimal.new is deprecated; use BigDecimal() method instead.
    /usr/local/lib/ruby/gems/2.6/gems/mysql2-0.4.10/lib/mysql2/mysql2.so: [BUG] Segmentation fault at 0x0000000000000000
    ruby 2.6.6p146 (2020-03-31 revision 67876) [amd64-freebsd11]
-- Control frame information -----------------------------------------------
c:0027 p:-4313666350 s:0131 e:000130 TOP    [FINISH]
c:0026 p:---- s:0128 e:000127 CFUNC  :require
c:0025 p:0261 s:0123 e:000122 TOP    /usr/local/lib/ruby/gems/2.6/gems/mysql2-0.4.10/lib/mysql2.rb:31 [FINISH]
c:0024 p:---- s:0119 e:000118 CFUNC  :require
c:0023 p:0033 s:0114 e:000113 BLOCK  /usr/local/lib/ruby/gems/2.6/gems/bundler-2.0.2/lib/bundler/runtime.rb:81 [FINISH]

the output is much longer, I shortified it, this is the top most error in the stack. I'm not sure which community it would be better to address this question so I decided to ask here first.

heximal
  • 10,327
  • 5
  • 46
  • 69
  • This looks really bad! [BUG] Segmentation fault at 0x0000000000000000 can you try upgrading mysql and also upgrading mysql gem, or downgrading if you are already on latest? – Aleksandar Pavić May 06 '20 at 11:20

2 Answers2

5

I faced a similar issue today on ubuntu 20.04 and msql2 -v 0.5.1. Solution to the problem:

sudo apt remove libmysqlclient-dev
sudo apt install libmariadbclient-dev
gem install mysql2 -v '0.5.1' 

here it is described in more detail: https://github.com/brianmario/mysql2/issues/1075

or for later versions:

sudo apt remove libmariadbd-dev
sudo apt install libmariadbd-dev
gem install mysql2 -v 'your version' 

Viktor Ivliiev
  • 1,015
  • 4
  • 14
  • 21
  • This issue was experienced on the ubuntu 20.04 machine with ruby 2.7.2 and mysq2 0.5.3 gem. @Vitya solution worked. Thank You! – Anton Topchii Jan 11 '21 at 12:26
  • Another option is to use `rbenv` rather than `rvm` – Viktor Ivliiev Aug 17 '22 at 10:18
  • 1
    @ViktorIvliiev just FYI, I have an Ubuntu 20.04 ARM64 image as a virtual machine with VMWare on MacOS Ventura, I installed **Ruby 2.3.1** with **Rbenv** but I still have that problem and your solution worked like a charm. Thanks! – alexventuraio Feb 27 '23 at 21:11
  • @alexventuraio, Yes, this problem happens every time the version of this gem is upgraded, but with rbenv I have these problems less often. In recent versions, after an unsuccessful `bundle`, they themselves began to write which extensions need to be additionally installed, but unfortunately sometimes you have to look for outdated versions of extension packages, since, for example, on ubuntu 22, sometimes the necessary extension packages are marked as outdated =( – Viktor Ivliiev Feb 28 '23 at 09:34
1

libmariadbclient-dev didn't exist on ubuntu 22 for me : had to install libmariadbd-dev instead and re-install mysql2 gem.