Search code examples
mysqlrubyrubygemsredmine

mysql2 Segmentation fault at 0x0000000000000000


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.


Solution

  • 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'