Home > Enterprise >  redmine install failure, ruby 3.0.4, mysql2 (0.5.4) "undefined method 'split'" &
redmine install failure, ruby 3.0.4, mysql2 (0.5.4) "undefined method 'split'" &

Time:05-22

Building a new system:

  ubuntu 20.04
  mysql 5.7.38
  ruby-install and chruby
    ruby 3.0.4
  redmine 5.0.0

In user account, attempting to install redmine 5.0.0:

bundle install
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /home/test_user/.gem/ruby/3.0.4/gems/mysql2-0.5.4/ext/mysql2
/opt/rubies/ruby-3.0.4/bin/ruby -I /opt/rubies/ruby-3.0.4/lib/ruby/3.0.0 -r ./siteconf20220520-28025-uxnsbe.rb
extconf.rb
...
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers.  Check the mkmf.log file for more details.  You may need configuration options.
Provided configuration options:
...
/opt/rubies/ruby-3.0.4/lib/ruby/3.0.0/mkmf.rb:1050:in `block in find_library': undefined method `split' for
nil:NilClass (NoMethodError)
 ...

Checking the log, I see the following errors:

conftest.c: In function ‘t’:
conftest.c:14:57: error: ‘rb_wait_for_single_fd’ undeclared (first use in this function)
   14 | int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_wait_for_single_fd; return !p; }

conftest.c: In function ‘t’:
conftest.c:16:57: error: ‘rb_enc_interned_str’ undeclared (first use in this function); did you mean ‘rb_interned_str’?
   16 | int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_enc_interned_str; return !p; }

I have the following mysql stuff installed:

$ apt list --installed | grep mysql
libmysqlclient20/unknown,now 5.7.38-1ubuntu18.04 amd64 [installed]
mysql-apt-config/unknown,now 0.8.22-1 all [installed]
mysql-client/unknown,now 5.7.38-1ubuntu18.04 amd64 [installed,upgradable to: 8.0.29-0ubuntu0.20.04.3]
mysql-common/focal,now 5.8 1.0.5ubuntu2 all [installed,automatic]
mysql-community-client/unknown,now 5.7.38-1ubuntu18.04 amd64 [installed,automatic]
mysql-community-server/unknown,now 5.7.38-1ubuntu18.04 amd64 [installed]
mysql-server/unknown,now 5.7.38-1ubuntu18.04 amd64 [installed,upgradable to: 8.0.29-0ubuntu0.20.04.3]

I am a bit confused; there are errors reported from the ruby installation (mkmf.rb, no method 'split'), and from the redmine code (undeclared functions).

I realize this is a new-ish ruby and a new-ish redmine, and an old-ish mysql; not sure if that is the issue or not. I'd like to stick with mysql 5.7 to avoid the upgrade of data I need to migrate for now.

CodePudding user response:

You are missing one of the MySQL development packages. For others stumbling upons this problem the candidates are:

default-libmysqld-dev 
default-libmysqlclient-dev

Or sometimes just direct packages:

libmysqld-dev 
libmysqlclient-dev

In this particular case it turned out to be default-libmysqlclient-dev.

  • Related