Truffleruby: gem install mysql2 fails

Created on 12 Jul 2018  路  7Comments  路  Source: oracle/truffleruby

using:
Ubuntu 16.04
truffleruby-1.0.0-rc3

truffleruby was installed by rvm 1.29.4

gem install mysql2
Building native extensions.  This could take a while...
ERROR:  Error installing mysql2:
    ERROR: Failed to build gem native extension.

    current directory: /home/jenko/.rvm/gems/truffleruby-1.0.0-rc3/gems/mysql2-0.5.2/ext/mysql2
/home/jenko/.rvm/rubies/truffleruby-1.0.0-rc3/bin/truffleruby -r ./siteconf20180711-3312-e899hw.rb extconf.rb
checking for rb_absint_size()... yes
checking for rb_absint_singlebit_p()... yes
checking for rb_wait_for_single_fd()... yes
-----
Using mysql_config at /usr/bin/mysql_config
-----
checking for mysql.h... yes
checking for errmsg.h... yes
checking for SSL_MODE_DISABLED in mysql.h... yes
checking for SSL_MODE_PREFERRED in mysql.h... yes
checking for SSL_MODE_REQUIRED in mysql.h... yes
checking for SSL_MODE_VERIFY_CA in mysql.h... yes
checking for SSL_MODE_VERIFY_IDENTITY in mysql.h... yes
checking for MYSQL.net.vio in mysql.h... yes
checking for MYSQL.net.pvio in mysql.h... no
checking for MYSQL_ENABLE_CLEARTEXT_PLUGIN in mysql.h... yes
checking for SERVER_QUERY_NO_GOOD_INDEX_USED in mysql.h... yes
checking for SERVER_QUERY_NO_INDEX_USED in mysql.h... yes
checking for SERVER_QUERY_WAS_SLOW in mysql.h... yes
checking for MYSQL_OPTION_MULTI_STATEMENTS_ON in mysql.h... yes
checking for MYSQL_OPTION_MULTI_STATEMENTS_OFF in mysql.h... yes
checking for my_bool in mysql.h... yes
-----
Setting rpath to /usr/lib/x86_64-linux-gnu
-----
creating Makefile

current directory: /home/jenko/.rvm/gems/truffleruby-1.0.0-rc3/gems/mysql2-0.5.2/ext/mysql2
make "DESTDIR=" clean

current directory: /home/jenko/.rvm/gems/truffleruby-1.0.0-rc3/gems/mysql2-0.5.2/ext/mysql2
make "DESTDIR="
compiling client.c
compiling infile.c
compiling mysql2_ext.c
compiling result.c
compiling statement.c
linking shared-object mysql2/mysql2.su
/home/jenko/.rvm/rubies/truffleruby-1.0.0-rc3/lib/cext/linker.rb:39:in `main': Unknown argument: -Wl,-rpath,/usr/lib/x86_64-linux-gnu (RuntimeError)
    from /home/jenko/.rvm/rubies/truffleruby-1.0.0-rc3/lib/cext/linker.rb:108:in `<main>'
Makefile:226: recipe for target 'mysql2.su' failed
make: *** [mysql2.su] Error 1

make failed, exit code 2

Gem files will remain installed in /home/jenko/.rvm/gems/truffleruby-1.0.0-rc3/gems/mysql2-0.5.2 for inspection.
Results logged to /home/jenko/.rvm/gems/truffleruby-1.0.0-rc3/extensions/x86_64-linux/2.4.0/mysql2-0.5.2/gem_make.out
bug cexts

Most helpful comment

I can confirm both mysql2 and pg succeed for gem install now, so I will close this issue.

All 7 comments

Thanks for reporting this. Our linker script didn't handle the -Wl argument. I've managed to reproduce the problem (with a different gem) and have a fix that I'm running through our CI at the moment.

This is also occurring when trying to install the pg gem, for anyone that comes across this later. Thanks for fixing it.

Any news ?

鈺扳攢 $ ruby --version
truffleruby 1.0.0-rc2, like ruby 2.4.4, GraalVM CE Native [x86_64-linux]
 鈺扳攢 $ rvm --version
rvm 1.29.4 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]

current mysql2 still not worked

Fetching: mysql2-0.5.2.gem (100%)                                                                                                                                                             
Building native extensions.  This could take a while...                                                                                                                                       
ERROR:  Error installing mysql2:                                                                                                                                                              
        ERROR: Failed to build gem native extension.                                                                                                                                          

    current directory: /home/zw963/.rvm/gems/truffleruby-1.0.0-rc2@mysql2/gems/mysql2-0.5.2/ext/mysql2
/home/zw963/.rvm/rubies/truffleruby-1.0.0-rc2/bin/truffleruby -r ./siteconf20180819-31520-1369s86.rb extconf.rb
checking for rb_absint_size()... yes
checking for rb_absint_singlebit_p()... yes
checking for rb_wait_for_single_fd()... yes
-----
Using mysql_config at /usr/bin/mysql_config
-----
checking for mysql.h... yes
checking for errmsg.h... yes
checking for SSL_MODE_DISABLED in mysql.h... yes
checking for SSL_MODE_PREFERRED in mysql.h... yes
checking for SSL_MODE_REQUIRED in mysql.h... yes
checking for SSL_MODE_VERIFY_CA in mysql.h... yes
checking for SSL_MODE_VERIFY_IDENTITY in mysql.h... yes
checking for MYSQL.net.vio in mysql.h... yes
checking for MYSQL.net.pvio in mysql.h... no
checking for MYSQL_ENABLE_CLEARTEXT_PLUGIN in mysql.h... yes
checking for SERVER_QUERY_NO_GOOD_INDEX_USED in mysql.h... yes
checking for SERVER_QUERY_NO_INDEX_USED in mysql.h... yes
checking for SERVER_QUERY_WAS_SLOW in mysql.h... yes
checking for MYSQL_OPTION_MULTI_STATEMENTS_ON in mysql.h... yes
checking for MYSQL_OPTION_MULTI_STATEMENTS_OFF in mysql.h... yes
checking for my_bool in mysql.h... yes
-----
Setting rpath to /usr/lib/x86_64-linux-gnu
-----
creating Makefile

current directory: /home/zw963/.rvm/gems/truffleruby-1.0.0-rc2@mysql2/gems/mysql2-0.5.2/ext/mysql2
make "DESTDIR=" clean

current directory: /home/zw963/.rvm/gems/truffleruby-1.0.0-rc2@mysql2/gems/mysql2-0.5.2/ext/mysql2
make "DESTDIR="
compiling client.c
compiling infile.c
compiling mysql2_ext.c
compiling result.c
compiling statement.c
linking shared-object mysql2/mysql2.su
/home/zw963/.rvm/rubies/truffleruby-1.0.0-rc2/lib/cext/linker.rb:39:in `main': Unknown argument: -Wl,-rpath,/usr/lib/x86_64-linux-gnu (RuntimeError)
        from /home/zw963/.rvm/rubies/truffleruby-1.0.0-rc2/lib/cext/linker.rb:108:in `<main>'
Makefile:226: recipe for target 'mysql2.su' failed
make: *** [mysql2.su] Error 1

make failed, exit code 2

Gem files will remain installed in /home/zw963/.rvm/gems/truffleruby-1.0.0-rc2@mysql2/gems/mysql2-0.5.2 for inspection.
Results logged to /home/zw963/.rvm/gems/truffleruby-1.0.0-rc2@mysql2/extensions/x86_64-linux/2.4.0/mysql2-0.5.2/gem_make.out

*** LOCAL GEMS ***

pg not worked too

linking shared-object pg_ext.su
/home/zw963/.rvm/rubies/truffleruby-1.0.0-rc2/lib/cext/linker.rb:39:in `main': Unknown argument: -Wl,-rpath,/home/zw963/Dropbox/linux/utils/dockerinit/pg_client/lib (RuntimeError)
        from /home/zw963/.rvm/rubies/truffleruby-1.0.0-rc2/lib/cext/linker.rb:108:in `<main>'
Makefile:226: recipe for target 'pg_ext.su' failed
make: *** [pg_ext.su] Error 1

@zw963 You use a fairly old release of TruffleRuby, namely 1.0.0-rc2 instead of the latest 1.0.0-rc5.
The fix by @aardvark179 was now integrated, but is not part of 1.0.0-rc5, it will be part of the next release (planned beginning of September).

I can confirm both mysql2 and pg succeed for gem install now, so I will close this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hsbt picture hsbt  路  28Comments

petenorth picture petenorth  路  20Comments

ashishbista picture ashishbista  路  23Comments

ylluminarious picture ylluminarious  路  27Comments

chrisseaton picture chrisseaton  路  23Comments