From: Aj Mccauley on
I am having an issue installing the mysql gem on my fedora 11 ruby
1.9.1p376 installation.

mysql is installed and working. When I try to run sudo gem install mysql
I get the following message:

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

/usr/local/bin/ruby19 extconf.rb
checking for mysql_ssl_set()... yes
checking for rb_str_set_len()... yes
checking for rb_thread_start_timer()... no
checking for mysql.h... yes
creating Makefile

make
gcc -I. -I/usr/local/include/ruby19-1.9.1/x86_64-linux
-I/usr/local/include/ruby19-1.9.1/ruby/backward
-I/usr/local/include/ruby19-1.9.1 -I. -DHAVE_MYSQL_SSL_SET
-DHAVE_RB_STR_SET_LEN -DHAVE_MYSQL_H -I/usr/local -I/usr/include/mysql
-g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
-D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC -DUNIV_LINUX
-fPIC -O2 -g -Wall -Wno-parentheses -o mysql.o -c mysql.c
gcc -shared -o mysql_api.so mysql.o -L. -L/usr/local/lib
-Wl,-R/usr/local/lib -L. -L/usr/local -rdynamic -Wl,-export-dynamic
-rdynamic -L/usr/lib64/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -lssl
-lcrypto -lpthread -lrt -ldl -lcrypt -lm -lc
/usr/bin/ld: /usr/local/lib/libssl.a(t1_srvr.o): relocation R_X86_64_32
against `.data' can not be used when making a shared object; recompile
with -fPIC
/usr/local/lib/libssl.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [mysql_api.so] Error 1


Gem files will remain installed in
/usr/local/lib/ruby19/gems/1.9.1/gems/mysql-2.8.1 for inspection.
Results logged to
/usr/local/lib/ruby19/gems/1.9.1/gems/mysql-2.8.1/ext/mysql_api/gem_make.out


I am not sure what I am doing wrong here any ideas would be appreciated.
I tried downloading the source and get the same error when I enter make.
--
Posted via http://www.ruby-forum.com/.

From: Luis Lavena on
On Mar 3, 8:02 pm, Aj Mccauley <ajmccau...(a)gmail.com> wrote:
> I am having an issue installing the mysql gem on my fedora 11 ruby
> 1.9.1p376 installation.
>
> mysql is installed and working. When I try to run sudo gem install mysql
> I get the following message:
>
> Building native extensions.  This could take a while...
> ERROR:  Error installing mysql:
>  ERROR: Failed to build gem native extension.
>
> /usr/local/bin/ruby19 extconf.rb
> checking for mysql_ssl_set()... yes
> checking for rb_str_set_len()... yes
> checking for rb_thread_start_timer()... no
> checking for mysql.h... yes
> creating Makefile
>
> make
> gcc -I. -I/usr/local/include/ruby19-1.9.1/x86_64-linux
> -I/usr/local/include/ruby19-1.9.1/ruby/backward
> -I/usr/local/include/ruby19-1.9.1 -I. -DHAVE_MYSQL_SSL_SET
> -DHAVE_RB_STR_SET_LEN -DHAVE_MYSQL_H -I/usr/local   -I/usr/include/mysql
> -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
> --param=ssp-buffer-size=4 -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
> -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC   -DUNIV_LINUX
> -fPIC  -O2 -g -Wall -Wno-parentheses  -o mysql.o -c mysql.c
> gcc -shared -o mysql_api.so mysql.o -L. -L/usr/local/lib
> -Wl,-R/usr/local/lib -L. -L/usr/local -rdynamic -Wl,-export-dynamic
> -rdynamic -L/usr/lib64/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -lssl
> -lcrypto  -lpthread -lrt -ldl -lcrypt -lm   -lc
> /usr/bin/ld: /usr/local/lib/libssl.a(t1_srvr.o): relocation R_X86_64_32
> against `.data' can not be used when making a shared object; recompile
> with -fPIC
> /usr/local/lib/libssl.a: could not read symbols: Bad value
> collect2: ld returned 1 exit status
> make: *** [mysql_api.so] Error 1
>
> Gem files will remain installed in
> /usr/local/lib/ruby19/gems/1.9.1/gems/mysql-2.8.1 for inspection.
> Results logged to
> /usr/local/lib/ruby19/gems/1.9.1/gems/mysql-2.8.1/ext/mysql_api/gem_make.ou t
>
> I am not sure what I am doing wrong here any ideas would be appreciated.
> I tried downloading the source and get the same error when I enter make.

Reading the error once again:

/usr/bin/ld: /usr/local/lib/libssl.a(t1_srvr.o): relocation
R_X86_64_32
against `.data' can not be used when making a shared object;
recompile
with -fPIC
/usr/local/lib/libssl.a: could not read symbols: Bad value

Seems clear to me: there is an issue with libssl (OpenSSL) installed
in your system.

I cannot provide more help because I'm not familiarized with Fedora,
but looks like like the library is not prepared to link with Ruby 1.9,
and is mentioning recompilation with -fPIC option.

Anyone encountered similar issue?

--
Luis Lavena
From: brabuhr on
On Wed, Mar 3, 2010 at 2:02 PM, Aj Mccauley <ajmccauley(a)gmail.com> wrote:
> I am having an issue installing the mysql gem on my fedora 11 ruby
> 1.9.1p376 installation.
>
> mysql is installed and working. When I try to run sudo gem install mysql
> I get the following message:
>
> /usr/bin/ld: /usr/local/lib/libssl.a(t1_srvr.o): relocation R_X86_64_32
> against `.data' can not be used when making a shared object; recompile
> with -fPIC
> /usr/local/lib/libssl.a: could not read symbols: Bad value
> collect2: ld returned 1 exit status
> make: *** [mysql_api.so] Error 1

/usr/local/lib/libssl.a
You built your own openssl rather than using the Fedora packages?

From: AJ McCauley on

> You built your own openssl rather than using the Fedora packages?

I did build openssl-0.9.8l from source. In hind sight, it would have
been a better idea to just use yum...
--
Posted via http://www.ruby-forum.com/.

From: AJ McCauley on
>> You built your own openssl rather than using the Fedora packages?
>
> I did build openssl-0.9.8l from source. In hind sight, it would have
> been a better idea to just use yum...

I just rebuilt the server and used the Fedora packaged openssl and it
seems to be working fine! Thanks for the help in pointing me in the
right direction.

--
Posted via http://www.ruby-forum.com/.