mysql-gem icon indicating copy to clipboard operation
mysql-gem copied to clipboard

doesn't compile on debian testing 64bit with ruby 1.9.x

Open jarrettchisholm opened this issue 13 years ago • 12 comments

I think it has to do with openssl 1.0.0 being installed, where openssl 0.9.8 is required by the gem(?)...

I created a stackoverflow (http://stackoverflow.com/q/16205279/780281) and serverfault (http://serverfault.com/q/502575/153027) issue for it, and so far no luck...

As far as I can tell, all required dependencies (including dev packages) are installed.

Results when trying to install:

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

        /home/jarrett/.rvm/rubies/ruby-1.9.1-p431/bin/ruby extconf.rb
checking for mysql_ssl_set()... *** 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:
    --with-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/home/jarrett/.rvm/rubies/ruby-1.9.1-p431/bin/ruby
    --with-mysql-config
    --without-mysql-config
/home/jarrett/.rvm/rubies/ruby-1.9.1-p431/lib/ruby/1.9.1/mkmf.rb:364:in `try_do': The complier failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /home/jarrett/.rvm/rubies/ruby-1.9.1-p431/lib/ruby/1.9.1/mkmf.rb:417:in `try_link0'
    from /home/jarrett/.rvm/rubies/ruby-1.9.1-p431/lib/ruby/1.9.1/mkmf.rb:421:in `try_link'
    from /home/jarrett/.rvm/rubies/ruby-1.9.1-p431/lib/ruby/1.9.1/mkmf.rb:529:in `try_func'
    from /home/jarrett/.rvm/rubies/ruby-1.9.1-p431/lib/ruby/1.9.1/mkmf.rb:774:in `block in have_func'
    from /home/jarrett/.rvm/rubies/ruby-1.9.1-p431/lib/ruby/1.9.1/mkmf.rb:670:in `block in checking_for'
    from /home/jarrett/.rvm/rubies/ruby-1.9.1-p431/lib/ruby/1.9.1/mkmf.rb:276:in `block (2 levels) in postpone'
    from /home/jarrett/.rvm/rubies/ruby-1.9.1-p431/lib/ruby/1.9.1/mkmf.rb:250:in `open'
    from /home/jarrett/.rvm/rubies/ruby-1.9.1-p431/lib/ruby/1.9.1/mkmf.rb:276:in `block in postpone'
    from /home/jarrett/.rvm/rubies/ruby-1.9.1-p431/lib/ruby/1.9.1/mkmf.rb:250:in `open'
    from /home/jarrett/.rvm/rubies/ruby-1.9.1-p431/lib/ruby/1.9.1/mkmf.rb:272:in `postpone'
    from /home/jarrett/.rvm/rubies/ruby-1.9.1-p431/lib/ruby/1.9.1/mkmf.rb:669:in `checking_for'
    from /home/jarrett/.rvm/rubies/ruby-1.9.1-p431/lib/ruby/1.9.1/mkmf.rb:773:in `have_func'
    from extconf.rb:45:in `<main>'


Gem files will remain installed in /home/jarrett/.rvm/gems/ruby-1.9.1-p431/gems/mysql-2.9.1 for inspection.
Results logged to /home/jarrett/.rvm/gems/ruby-1.9.1-p431/gems/mysql-2.9.1/ext/mysql_api/gem_make.out

jarrettchisholm avatar Apr 25 '13 14:04 jarrettchisholm

@jarrettchisholm the gem depends on mysql installed and having ssl functionality.

Please provide the contents of mkmf.log around the lines of checking for mysql_ssl_set()...

luislavena avatar Apr 25 '13 14:04 luislavena

mkmf.log is empty when I look in it...

jarrettchisholm avatar Apr 25 '13 14:04 jarrettchisholm

@jarrettchisholm ah, I see this:

/home/jarrett/.rvm/rubies/ruby-1.9.1-p431/lib/ruby/1.9.1/mkmf.rb:364:in `try_do': The complier failed to generate an executable file. (RuntimeError)
You have to install development tools first.

Do you have gcc and all the development tools installed? Silly question since you're using RVM, but dunno if you're using precompiled binaries or not.

I'm not sure if you're using Ubuntu or what, but you check rvm requirements I believe will give you the list of things you need to install.

luislavena avatar Apr 25 '13 15:04 luislavena

all requirements are installed:

build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion

I've been unsuccessful so far, so I followed these instructions to get openssl 0.9.8 installed (http://stackoverflow.com/questions/13366409/undefined-symbol-sslv2-method-when-trying-to-run-thin-webserver and https://rvm.io/packages/openssl/), and then installed the mysql2 gem and used that instead. Seems to work with mysql2 ok. Still can't get the mysql gem to compile (even with openssl 0.9.8 installed locally through rvm).

jarrettchisholm avatar Apr 25 '13 20:04 jarrettchisholm

@jarrettchisholm did you build the version of Ruby you have installed? or is using the binary packages?

Also, is failing to find the compiler, which might be caused by something else interfering in your system.

Have you tried a newer version of Ruby? 1.9.1 seems long ago (and perhaps there is a bug we are not seeing)

Last but no least, in any of the links (or here) you have provided information of which distro (and version) are you using, neither which version of mysql and mysql dev packages you have installed.

luislavena avatar Apr 25 '13 20:04 luislavena

Built version of ruby. I've tried Ruby 1.9.1, 1.9.2, and 1.9.3.

aptitude versions mysql-client libmysqlclient-dev libmysql++-dev ruby-mysql libmysql-ruby
Package libmysql-ruby:                       
i   2.8.2+gem2deb-3                                                                                                             testing                                                                                                  500 

Package libmysql-ruby1.8:
p   2.8.2+gem2deb-3                                                                                                             testing                                                                                                  500 

Package libmysql-ruby1.9.1:
p   2.8.2+gem2deb-3                                                                                                             testing                                                                                                  500 

Package libmysqlclient-dev:
p A 5.5.30+dfsg-1.1                                                                                                             testing                                                                                                  500 
i A 5.5.30-rel30.2-500.squeeze                                                                                                  unstable                                                                                                 500 

Package libmysqlclient-dev:i386:
p   5.5.30+dfsg-1.1                                                                                                             testing                                                                                                  500 
p   5.5.30-rel30.2-500.squeeze                                                                                                  unstable                                                                                                 500 

Package mysql-client:
i   5.5.30+dfsg-1.1                                                                                                             testing                                                                                                  500 

Package mysql-client-5.5:
i A 5.5.30+dfsg-1.1                                                                                                             testing                                                                                                  500 

Package mysql-client-5.5:i386:
p   5.5.30+dfsg-1.1                                                                                                             testing                                                                                                  500 

Package ruby-mysql:
i   2.8.2+gem2deb-3                                                                                                             testing                                                                                                  500 

Package ruby-mysql:i386:
p   2.8.2+gem2deb-3                                                                                                             testing                                                                                                  500

jarrettchisholm avatar Apr 26 '13 19:04 jarrettchisholm

Ok, first thing first: you're trying to use libmysql-ruby package, but that doesn't work with Ruby installed by RVM.

I'm getting confused on what are you trying to accomplish and how are you trying to accomplish it.

You don't need any of the *-ruby packages since The ruby versions you have installed are not the ones provided by the OS packages.

Now, What mkmf is reporting when installing the gem is clear:

`try_do': The complier failed to generate an executable file. (RuntimeError)
You have to install development tools first.

It is failing to locate compilers and tools required to compile.

You said before you have all installed, but seems is not working.

Are you 100% sure that there is no mkmf.log file in the gem directory? There should be one at /home/jarrett/.rvm/gems/ruby-1.9.1-p431/gems/mysql-2.9.1/ext/mysql_api/mkmf.log

luislavena avatar Apr 26 '13 19:04 luislavena

Just trying to install the mysql gem.

Sorry, I posted some other libraries which might not be required - I basically chose a shotgun approach, and installed anything that might be ruby/mysql related.

I'm fairly convinced that it has to do with openssl 1.0.0 being installed on debian testing (to be the new 7 I believe), where openssl 0.9.8 is required by the gem (or one of its dependencies).

I've checked for the mkmf.log (at /home/jarrett/.rvm/gems/ruby-1.9.1-p431/gems/mysql-2.9.1/ext/mysql_api/mkmf.log), and it exists, it is just empty.

jarrettchisholm avatar Apr 26 '13 21:04 jarrettchisholm

I'm fairly convinced that it has to do with openssl 1.0.0 being installed on debian testing (to be the new 7 I believe), where openssl 0.9.8 is required by the gem (or one of its dependencies).

No, the gem doesn't require openssl, perhaps is a dependency of libmysqlclient, but is not directly linked to Ruby.

As I mentioned before: it is failing way early in the compile process, and is telling you there is no compiler available.

Can you try something? can you attempt to install other gem like mysql2? or even better, a complete unrelated one like json, RedCloth or rdiscount?

Let me know if that works, because from what I see above, it shouldn't (in theory).

luislavena avatar Apr 26 '13 21:04 luislavena

hey @luislavena, hmmm...maybe libmysqlclient does require it? Not sure...at any rate, I think something requires openssl - in particular, libssl 0.9.8 and libcrypto 0.9.8. That is what is happening in the compile stage - it is saying checking for mysql_ssl_set()... *** extconf.rb failed ***, which indicates the pre-compilation step failed, not due to missing compilers, but rather due to a missing library (in this case, an ssl library). At least, that's how I'm interpreting that error.

Installing mysql2, json, RedCloth, and rdiscount succeed just fine.

jarrettchisholm avatar Apr 26 '13 22:04 jarrettchisholm

I have the same issue with MariaDB on Debian 7. Very annoying and blocking ! Actually, I am using an embedded ruby version 2.2.0 which was compiled against openssl 1.0.0, but when trying to install mysql gem, it fails complaining about openssl! mysql2 installs just fine! No one on earth can give a workaround for this!

hanynowsky avatar Feb 27 '16 12:02 hanynowsky

/opt/sensu/embedded/bin/ruby -r ./siteconf20160227-46298-b83bim.rb extconf.rb checking for mysql_ssl_set() ... *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers.

hanynowsky avatar Feb 27 '16 12:02 hanynowsky