do_mysql build error on RH EL5.2

56 views
Skip to first unread message

Chris Cummer

unread,
Jan 27, 2009, 7:24:49 PM1/27/09
to DataMapper
Hello

I'm attempting to install do_mysql onto a machine running Red Hat
Enterprise Linux 5.2 and it fails in it's attempt to locate the
my_config_i386.h file (see output, below). That file doesn't appear to
be part of this linux distro though it does contain:

/usr/include/mysql/my_config.h
/usr/include/mysql/my_config_x86_64.h

And the server is up-to-date with the following:

mysql.i386 5.0.58-1.el5.art
installed
mysql-connector-odbc.i386 3.51.12-2.2
installed
mysql-devel.i386 5.0.58-1.el5.art
installed
mysql-libs.i386 5.0.58-1.el5.art
installed
mysql-server.i386 5.0.58-1.el5.art
installed

Anyone have any suggestions about this? It's the last hurdle in
deploying our Merb app.

Cheers
Chris


------------------------------

chris@dreambank ~]# gem install do_mysql
Building native extensions. This could take a while...
ERROR: Error installing do_mysql:
ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb install do_mysql
checking for mysql.h... yes
checking for main() in -lmysqlclient... yes
checking for mysql_query()... yes
checking for mysql_ssl_set()... yes
creating Makefile

make
gcc -I. -I. -I/usr/lib/ruby/1.8/i686-linux -I. -DHAVE_MYSQL_H -
DHAVE_MYSQL_QUERY -DHAVE_MYSQL_SSL_SET -D_FILE_OFFSET_BITS=64 -I/usr/
include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-
protector --param=ssp-buffer-size=4 -m32 -fasynchronous-unwind-tables -
D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-
aliasing -fwrapv -fPIC -g -O2 -Wall -c do_mysql_ext.c
In file included from /usr/include/mysql/my_global.h:83,
from do_mysql_ext.c:6:
/usr/include/mysql/my_config.h:15:28: error: my_config_i386.h: No such
file or directory
In file included from do_mysql_ext.c:6:
/usr/include/mysql/my_global.h:592: error: expected '=', ',', ';',
'asm' or '__attribute__' before 'size_socket'
In file included from do_mysql_ext.c:6:
/usr/include/mysql/my_global.h:725:1: warning: "strtok_r" redefined
In file included from /usr/include/string.h:417,
from /usr/lib/ruby/1.8/i686-linux/ruby.h:44,
from do_mysql_ext.c:1:
/usr/include/bits/string2.h:1197:1: warning: this is the location of
the previous definition
make: *** [do_mysql_ext.o] Error 1


Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/
do_mysql-0.9.11 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/do_mysql-0.9.11/ext/
do_mysql_ext/gem_make.out

dbussink

unread,
Jan 28, 2009, 5:32:47 AM1/28/09
to DataMapper
On Jan 28, 1:24 am, Chris Cummer <chriscum...@gmail.com> wrote:

> I'm attempting to install do_mysql onto a machine running Red Hat
> Enterprise Linux 5.2 and it fails in it's attempt to locate the
> my_config_i386.h file (see output, below). That file doesn't appear to
> be part of this linux distro though it does contain:
>
> /usr/include/mysql/my_config.h
> /usr/include/mysql/my_config_x86_64.h

Could you clone the DO repository and remove the my_global.h include
in do_mysql/ext/do_mysql_ext/do_mysql_ext.c

Does the compilation work in that case? It still seems to compile here
when removing that option, so I guess this should fix it.

--
Regards,

Dirkjan Bussink

Chris Cummer

unread,
Jan 28, 2009, 4:42:55 PM1/28/09
to DataMapper
Certainly, I'd be happy to give that a try. Where do I find the
repository?

Chris Cummer

unread,
Jan 28, 2009, 5:01:51 PM1/28/09
to DataMapper
Ok, I have a copy on the machine with that header include removed. How
do I now tell it to compile that specific version?


On Jan 28, 2:32 am, dbussink <d.buss...@gmail.com> wrote:

Chris Cummer

unread,
Jan 28, 2009, 7:22:34 PM1/28/09
to DataMapper
Ok, I think I'm getting closer (the silence is instructive ;). After
removing that line and running make the compiler produced:

gcc -I. -I. -I/usr/lib/ruby/1.8/i686-linux -I. -DHAVE_MYSQL_H -
DHAVE_MYSQL_QUERY -DHAVE_MYSQL_SSL_SET -D_FILE_OFFSET_BITS=64 -I/usr/
include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-
protector --param=ssp-buffer-size=4 -m32 -fasynchronous-unwind-tables -
D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-
aliasing -fwrapv -fPIC -g -O2 -Wall -c do_mysql_ext.c
do_mysql_ext.c:42: warning: 'ID_NEW_RATIONAL' defined but not used
gcc -shared -o do_mysql_ext.so do_mysql_ext.o -L. -L/usr/lib -Wl,-R/
usr/lib -L. -rdynamic -Wl,-export-dynamic -lmysqlclient -rdynamic -
L/usr/lib/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -L/usr/lib -lssl -
lcrypto -ldl -lcrypt -lm -lc

and the directory now contains:

-rwxr-xr-x 1 root root 25405 Jan 28 19:20 do_mysql_ext.c
-rwxr-xr-x 1 root root 54786 Jan 28 19:20 do_mysql_ext.so
-rw-r--r-- 1 root root 2035 Jan 28 19:20 extconf.rb
-rw-r--r-- 1 root root 1333 Jan 28 19:20 gem_make.out
-rw-r--r-- 1 root root 4237 Jan 28 19:20 Makefile
-rw-r--r-- 1 root root 5193 Jan 28 19:20 mkmf.log

which looks promising. I'm not clear on what to do with those now
however. Thoughts?

Cheers
Chris


On Jan 28, 2:32 am, dbussink <d.buss...@gmail.com> wrote:

Dan Kubb (dkubb)

unread,
Jan 28, 2009, 9:24:03 PM1/28/09
to DataMapper
Chris,

> Ok, I think I'm getting closer (the silence is instructive ;). After
> removing that line and running make the compiler produced:

Usually the simplest thing you can do is run "rake compile spec" and
see if it compiles and passes all the specs.

Also, "rake -T" shows you a list of all available tasks you can run.

--

Dan
(dkubb)

Chris Cummer

unread,
Jan 29, 2009, 12:01:08 AM1/29/09
to DataMapper
Thanks for the pointer Dan! Whether this ultimately works at all, I'm
learning a good chunk and that's interesting. Running 'rake compile
spec' aborts on line 62 of the Rakefile when it can't fine the
constant HOE on this line:

Rake::ExtensionTask.new('do_mysql_ext', HOE.spec)

which I take to mean a new instance of Hoe that defines the rake
tasks. Looks to me like there's no gemspec file since the directory
defined in this include at the top of the Rakefile doesn't exist:

require 'spec/rake/spectask'

'spec' contains a few other entries but no 'rake' directory. Any
thoughts on why that directory wouldn't exist?

Thanks to anyone adding pointers and suggestions!

Cheers
Chris

Dirkjan Bussink

unread,
Jan 29, 2009, 1:33:46 AM1/29/09
to datam...@googlegroups.com

On 29 Jan 2009, at 06:01, Chris Cummer wrote:

>
> Thanks for the pointer Dan! Whether this ultimately works at all, I'm
> learning a good chunk and that's interesting. Running 'rake compile
> spec' aborts on line 62 of the Rakefile when it can't fine the
> constant HOE on this line:
>
> Rake::ExtensionTask.new('do_mysql_ext', HOE.spec)
>
> which I take to mean a new instance of Hoe that defines the rake
> tasks. Looks to me like there's no gemspec file since the directory
> defined in this include at the top of the Rakefile doesn't exist:
>
> require 'spec/rake/spectask'
>
> 'spec' contains a few other entries but no 'rake' directory. Any
> thoughts on why that directory wouldn't exist?
>
> Thanks to anyone adding pointers and suggestions!

For running the specs you need Hoe and RSpec installed. You can
install them through rubygems, just do a gem install hoe rspec.

But if removing that line fixes compilation, I'm pretty sure it will
all work from there on. You can also do a rake install from the
checkout, which will install the gem for you. Then you can easily try
to run your application and see whether it works.

--
Regards,

Dirkjan Bussink

Chris Cummer

unread,
Jan 29, 2009, 3:32:26 AM1/29/09
to DataMapper
Hi Dirkjan

Both hoe and rspec are installed. What I'm running into is this
failure with 'rake install':

uninitialized constant HOE
/usr/lib/ruby/gems/1.8/gems/do_mysql-0.9.11/Rakefile:62

because it appears to me that the file included into Rakefile
('spectask') doesn't exist:

require 'spec/rake/spectask'

Is 'spec/rake/spectask' a file that should be there as part of the
original files, a file created by make or generated through another
means? My suspicion is that the only thing holding me back at this
point is the lack of that file but I'm not clear on why it isn't where
the Rakefile expects it to be.

Dirkjan Bussink

unread,
Jan 29, 2009, 3:40:16 AM1/29/09
to datam...@googlegroups.com
On Thu, Jan 29, 2009 at 9:32 AM, Chris Cummer <chris...@gmail.com> wrote:
> because it appears to me that the file included into Rakefile
> ('spectask') doesn't exist:
>
> require 'spec/rake/spectask'
>
> Is 'spec/rake/spectask' a file that should be there as part of the
> original files, a file created by make or generated through another
> means? My suspicion is that the only thing holding me back at this
> point is the lack of that file but I'm not clear on why it isn't where
> the Rakefile expects it to be.

This task should be supplied by RSpec, hence my suggestion for
installing that. On my OS X system it's located in
/Library/Ruby/Gems/1.8/gems/rspec-1.1.12/lib/spec/rake/spectask.rb

Do you have a similar file in your RSpec install too?

--
Regards,

Dirkjan Bussink

Chris Cummer

unread,
Jan 29, 2009, 3:51:22 AM1/29/09
to DataMapper
I do. Just to be sure I've changed the require line in the Rakefile to
take the absolute path:

require '/usr/lib/ruby/gems/1.8/gems/rspec-1.1.12/lib/spec/rake/
spectask.rb'

however it still fails with the HOE constant.


On Jan 29, 12:40 am, Dirkjan Bussink <d.buss...@gmail.com> wrote:

Chris Cummer

unread,
Jan 29, 2009, 3:59:50 AM1/29/09
to DataMapper
Interestingly, I also get the same HOE error when I run 'rake -T' in
the do_sqlite3-0.9.11' directory.

Dan Kubb (dkubb)

unread,
Jan 29, 2009, 4:00:44 AM1/29/09
to DataMapper
Chris,

> I do. Just to be sure I've changed the require line in the Rakefile to
> take the absolute path:
>
> require '/usr/lib/ruby/gems/1.8/gems/rspec-1.1.12/lib/spec/rake/
> spectask.rb'
>
> however it still fails with the HOE constant.

I was under the mistaken impression that you had checked out the
source using git and were working within that, not necessarily working
from the installed gem directory.

We probably should make it so that all the DO driver specs can be run
on installed gems, but in the meantime, checkout the source from git
using the following commands:

git clone git://github.com/datamapper/do.git
cd do/data_objects
sudo rake install
cd ../do_mysql
... remove the references to my_config.h in do_mysql ...
rake compile spec
sudo rake install

This will first install the edge version of DataObjects, and then will
compile and run the specs for do_mysql, and then install it. You will
want to remove all references to my_config.h from the do_mysql C libs
just prior to running the specs of course.

You can also hop into #datamapper on irc.freenode.net and there should
be a few people able to help you work through this problem.

--

Dan
(dkubb)

Chris Cummer

unread,
Jan 29, 2009, 4:04:59 AM1/29/09
to DataMapper
Ah! Ha! When I searched github for 'datamapper' it returned this as
the primary hit for it:

http://github.com/dm/datamapper/

which contains no info. I erroneously assumed then that you meant the
installed version on my machine. I will follow your instructions -
thanks Dan!

Chris Cummer

unread,
Jan 29, 2009, 5:53:48 AM1/29/09
to DataMapper
Thanks very much to Dirkjan and Dan for your help with this - it's all
working nicely now!

With regards,
Chris
Reply all
Reply to author
Forward
0 new messages