ruby gem install mysql compile error

Discussion in 'Ruby' started by Aj Mccauley, Mar 3, 2010.

  1. Aj Mccauley

    Aj Mccauley Guest

    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/.
    Aj Mccauley, Mar 3, 2010
    #1
    1. Advertising

  2. Aj Mccauley

    Luis Lavena Guest

    On Mar 3, 8:02 pm, Aj Mccauley <> 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
    Luis Lavena, Mar 3, 2010
    #2
    1. Advertising

  3. Aj Mccauley

    Guest

    On Wed, Mar 3, 2010 at 2:02 PM, Aj Mccauley <> 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?
    , Mar 3, 2010
    #3
  4. Aj Mccauley

    AJ McCauley Guest


    > 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/.
    AJ McCauley, Mar 3, 2010
    #4
  5. Aj Mccauley

    AJ McCauley Guest

    >> 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/.
    AJ McCauley, Mar 4, 2010
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    7
    Views:
    4,777
  2. Clifford Heath
    Replies:
    7
    Views:
    290
    Shanti Braford
    Jun 9, 2006
  3. Mark Meijer

    mySQL Ruby Gem and MAMP mySQL

    Mark Meijer, Feb 2, 2008, in forum: Ruby
    Replies:
    3
    Views:
    159
    louis
    Feb 3, 2008
  4. Greg Donald
    Replies:
    2
    Views:
    176
    Greg Donald
    Mar 28, 2009
  5. Iñaki Baz Castillo
    Replies:
    1
    Views:
    144
    Iñaki Baz Castillo
    Feb 28, 2011
Loading...

Share This Page