I've got mysql and mysql-devel installed (v 5.0.77 64 bit) on CentOS 5.
I've installed all sorts of gems, but I get the below. Any thoughts?
gem install mysql -v 2.8.1 -- --with-mysql-config=/usr/bin/mysql_config
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb --with-mysql-config=/usr/bin/mysql_config
checking for mysql_ssl_set()... no
checking for rb_str_set_len()... no
checking for rb_thread_start_timer()... no
checking for mysql.h... no
checking for mysql/mysql.h... no
*** 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.
mkmf.log has this:
find_library: checking for mysql_query() in -lmysqlclient...
-------------------- no
"gcc -o conftest -I. -I/usr/lib64/ruby/1.8/x86_64-linux -I. -I/usr/
local/include -O2 -g -m64 -mtune=generic -Wall -fPIC conftest.c -
L"." -L"/usr/lib64" -L"/usr/local/lib" -L. -rdynamic -Wl,-export-
dynamic -lruby-static -lmysqlclient -lpthread -ldl -lcrypt -lm -
lc"
conftest.c: In function ‘t’:
conftest.c:3: error: ‘mysql_query’ undeclared (first use in this
function)
conftest.c:3: error: (Each undeclared identifier is reported only once
conftest.c:3: error: for each function it appears in.)
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { void ((*volatile p)()); p = (void ((*)()))mysql_query;
return 0; }
/* end */
> It will never work if it can't find mysql.h I'm wondering if you're
> pointing to the right mysql_config.
>
> Run:
> /usr/bin/mysql_config --include
>
> Then see if there's a mysql.h in the directory that is returned. If
> not then my guess is that mysql-devel installed a different
> mysql_config and you need to point to that so that it references the
> right include location for the headers.
Thanks, but that's not it:
[root@localhost tmp]# /usr/bin/mysql_config --include
-I/usr/include/mysql
[root@localhost tmp]# ls /usr/include/mysql
chardefs.h keymaps.h my_config.h my_global.h
mysql_com.h mysql_time.h readline.h sql_common.h
tilde.h
decimal.h m_ctype.h my_config_x86_64.h my_list.h
mysqld_ername.h mysql_version.h rlmbutil.h sql_state.h
typelib.h
errmsg.h m_string.h my_dbug.h my_net.h
mysqld_error.h my_sys.h rlprivate.h sslopt-case.h
xmalloc.h
history.h my_alloc.h my_dir.h my_no_pthread.h
mysql_embed.h my_xml.h rlshell.h sslopt-longopts.h
keycache.h my_attribute.h my_getopt.h my_pthread.h
mysql.h raid.h rltypedefs.h sslopt-vars.h
Regards,
Guyren G Howe
Relevant Logic LLC
guyren-at-relevantlogic.com ~ http://relevantlogic.com ~ +1 512 784 3178
Ruby/Rails, REALbasic, PHP programming
PostgreSQL, MySQL database design and consulting
Technical writing and training
Read my book, Real OOP with REALbasic: <http://relevantlogic.com/oop-book/about-the-oop-book.php
>
Not sure about CentOS but whenever I get an extconf.rb error in Ubuntu the fix is:
sudo apt-get install ruby<version>-dev
Again not sure if that will solve your problem on CentOS just throwing it out there (thinking out loud).
On Thu, Oct 29, 2009 at 11:34 PM, Guyren G Howe <guy...@gmail.com> wrote:
On Oct 29, 2009, at 9:58 , Jason King wrote:
> It will never work if it can't find mysql.h I'm wondering if you're
> pointing to the right mysql_config.
>
> Run:
> /usr/bin/mysql_config --include
>
> Then see if there's a mysql.h in the directory that is returned. If
> not then my guess is that mysql-devel installed a different
> mysql_config and you need to point to that so that it references the
> right include location for the headers.
> You want to look in the gem extension's build directory for the actual
> output file from "configure". When it is testing something like
> "looking for mysql.h", what it is really doing is trying to compile a
> very simple C program that uses "include <mysql.h>" or equivalent.
> Although the "configure" program only outputs yes or no when it is
> run, it will also generally leave a log with the actual compiler
> error, and possibly the test code and command. With that you can
> figure out if the Ruby setup is at fault, or if you have some other,
> possibly unrelated compiler issue.
Many thanks for your help.
But please define "the gem extension's build directory" and how I
determine what that is.
Where are you getting your ruby-enterprise-1.8.6 from? Did you compile
from source? The current REE is 1.8.7 and when compiling from the
script that comes in the tarball always builds the mysql gem as part
of the install (along with rails and pg gems). I don't recall having
issues with the mysql gem builds on my RHEL5 systems - but so far
those have all been 32 bit systems. I am about to try some 64 bit
systems so can report back if we have problems and what their
resolution is.
If building from the newest REE 1.8.7 source does not fix your install
issues, can you send more details of what mysql stuff you have
installed and how. e.g. are these the stock RHEL MySQL rpms or did you
install either from source or from third party rpms.
--
Cynthia Kiser
c...@caltech.edu
> Where are you getting your ruby-enterprise-1.8.6 from? Did you compile
> from source? The current REE is 1.8.7 and when compiling from the
> script that comes in the tarball always builds the mysql gem as part
> of the install (along with rails and pg gems). I don't recall having
> issues with the mysql gem builds on my RHEL5 systems - but so far
> those have all been 32 bit systems. I am about to try some 64 bit
> systems so can report back if we have problems and what their
> resolution is.
>
> If building from the newest REE 1.8.7 source does not fix your install
> issues, can you send more details of what mysql stuff you have
> installed and how. e.g. are these the stock RHEL MySQL rpms or did you
> install either from source or from third party rpms.
I installed ruby-enterprise from a rpm I downloaded from:
http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
I guess I could try installing from source. But there's no obvious
reason why the source install of the mysql gem through the ruby-
enterprise source should work any better than what I'm trying to do
now. And just reinstalling ruby-enterprise a different way in case
that manages to work seems a bit like the sort of flailing about madly
in case something works that I'd rather avoid.
Is there no other suggestion about diagnostics I might perform on my
build process to determine why it's failing?
1st:
% ruby extconf.rb
or
% ruby extconf.rb --with-mysql-dir=/usr/local/mysql
or
% ruby extconf.rb --with-mysql-config
then
% make
extconf.rb has following options: