I’m struggling to install the mysql native C bindig via “gem install
mysql” on Solaris 10. I paste the error-msg including my used parameters
below this post.
Did somebody run into the same problems and how does she/he solve it?
Any help/hint/tip is appreciated.
Cheers
derkaan
gem install mysql –
–with-mysql-config=/opt/csw/mysql5/bin/mysql_config
–with-mysql-include=/opt/csw/mysql5/include
–with-mysql-lib=/opt/csw/mysql5/lib --with-mysql-dir=/opt/csw/mysql5
Building native extensions. This could take a while…
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/opt/csw/bin/ruby extconf.rb install mysql –
–with-mysql-config=/opt/csw/mysql5/bin/mysql_config
–with-mysql-include=/opt/csw/mysql5/include
–with-mysql-lib=/opt/csw/mysql5/lib --with-mysql-dir=/opt/csw/mysql5
checking for mysql_ssl_set()… no
checking for mysql.h… yes
cc: unrecognized option `-KPIC’
cc: language ildoff not recognized
cc: conftest.c: linker input file unused because linking not done
creating Makefile
make
cc -I. -I. -I/opt/csw/lib/ruby/1.8/sparc-solaris2.8 -I. -DHAVE_MYSQL_H
-I/opt/csw/include -I/opt/csw/include -I/opt/csw/mysql5/include/mysql
-mt -D_FORTEC_ -xarch=v8 -D_FILE_OFFSET_BITS=64 -DHAVE_CURSES_H
-I/opt/csw/mysql5/include -DHAVE_RWLOCK_T -KPIC -xO3 -xarch=v8 -xspace
-xildoff -I/opt/csw/include -I/opt/csw/include -KPIC -c mysql.c
cc: unrecognized option -KPIC' cc: unrecognized option -KPIC’
cc: language ildoff not recognized
cc: mysql.c: linker input file unused because linking not done
ld -G -o mysql.so mysql.o -L’.’ -L’/opt/csw/lib’ -R’/opt/csw/lib’ -L.
-L/opt/csw/lib -L/opt/csw/lib -R /opt/csw/lib -L/opt/csw/lib -lruby
-L/opt/csw/lib/32 -L/opt/csw/mysql5/lib/mysql -lmysqlclient -lz
-lposix4 -lresolv -lc -lgen -lsocket -lnsl -lm -L/opt/csw/lib -lssl
-lcrypto -lrt -lpthread -ldl -lcrypt -lm -lc
ld: fatal: file mysql.o: open failed: No such file or directory
*** Error code 1
make: Fatal error: Command failed for target `mysql.so’
In my case it’s a 64-bit/32-bit conflict… are you on x86 or Sparc?
Do you have GNU cc, make, etc installed? Or the Sun complier?
In your case it looks like ‘cc’ which is probably the sun native
compiler, is choking on the options passed via the makefile. Install
gcc, if you don’t have it already, and then set the ‘CC’ environment
variable to the path to gcc. If that doesn’t work, try renaming your
cc and linking gcc to cc (though this is a hack you shouldn’t leave in
place). Also I’m finding that makefiles often don’t respect all the
configuration you have set up, especially the make files auto-
generated during compile, so you might have to navigate 3 directories
deep, muck about in the makefile, recompile, fail at the next library,
muck makefile, rinse, repeat.
Good luck, and please post back if you make it anywhere…
Do you have GNU cc, make, etc installed? Or the Sun complier?
Yes, all mentioned tools are installed
In your case it looks like ‘cc’ which is probably the sun native
compiler, is choking on the options passed via the makefile. Install
gcc, if you don’t have it already, and then set the ‘CC’ environment
variable to the path to gcc. If that doesn’t work, try renaming your
cc and linking gcc to cc (though this is a hack you shouldn’t leave in
place). Also I’m finding that makefiles often don’t respect all the
configuration you have set up, especially the make files auto-
generated during compile, so you might have to navigate 3 directories
deep, muck about in the makefile, recompile, fail at the next library,
muck makefile, rinse, repeat.
I tried it, but it doesn’t help…
Good luck, and please post back if you make it anywhere…
I’ll post the the solution if I solve the problem…
cc -I. -I. -I/opt/csw/lib/ruby/1.8/sparc-solaris2.8 -I. -DHAVE_MYSQL_H
-I/opt/csw/include -I/opt/csw/include -I/opt/csw/mysql5/include/mysql
-mt -D_FORTEC_ -xarch=v8 -D_FILE_OFFSET_BITS=64 -DHAVE_CURSES_H
-I/opt/csw/mysql5/include -DHAVE_RWLOCK_T -KPIC -xO3 -xarch=v8 -xspace
-xildoff -I/opt/csw/include -I/opt/csw/include -KPIC -c mysql.c
cc: unrecognized option -KPIC' cc: unrecognized option -KPIC’
cc: language ildoff not recognized
cc: mysql.c: linker input file unused because linking not done
The root of your current problem is that your compliler does not like
the options being fed to it.
I am about the last person you want to be discussing the internals and
options of compilers… my source-fu is weak. But Google tells me
“KPIC” isn’t a valid option to gcc, but it is to Sun’s cc. I think
the autoconfigure script is configuring for Sun cc, but you’re trying
to make with gcc.
Go into the gem source directory and make clean, and then configure
with CC=gcc as an option. If it still builds makefiles with KPIC then
you’ll need to go edit all the make files by hand… jPIC seems to be
the gcc approved alternative, at least according to Google.
Go into the gem source directory and make clean, and then configure
with CC=gcc as an option. If it still builds makefiles with KPIC then
you’ll need to go edit all the make files by hand… jPIC seems to be
the gcc approved alternative, at least according to Google.
The jPIC didn’t work for me. so I adjust my rbconfig.rb to use fPIC
after I read this Joyent-Post: http://discuss.joyent.com/viewtopic.php?id=12630
I also set my CC-Parameter to a newer gcc (-v == 3.4.5 on sparc) but
this also doesn’t solve the issue
mysql-gem-installation still can’t find the mysql.so:
make: Fatal error: Command failed for target `mysql.so’
The next error in your original post is "cc: language ildoff not
recognized "
This message doesn’t occur any more. This is what I got now:
gem install mysql –
–with-mysql-config=/opt/csw/mysql5/bin/mysql_config
–with-mysql-include=/opt/csw/mysql5/include
–with-mysql-lib=/opt/csw/mysql5/lib
Building native extensions. This could take a while…
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/opt/csw/bin/ruby extconf.rb install mysql –
–with-mysql-config=/opt/csw/mysql5/bin/mysql_config
–with-mysql-include=/opt/csw/mysql5/include
–with-mysql-lib=/opt/csw/mysql5/lib
checking for mysql_ssl_set()… no
checking for mysql.h… yes
gcc: language arch=v8 not recognized
gcc: conftest.c: linker input file unused because linking not done
creating Makefile
make
/opt/csw/gcc3/bin/gcc -I. -I. -I/opt/csw/lib/ruby/1.8/sparc-solaris2.8
-I. -DHAVE_MYSQL_H -I/opt/csw/include -I/opt/csw/include
-I/opt/csw/mysql5/include/mysql -mt -D_FORTEC_ -xarch=v8
-D_FILE_OFFSET_BITS=64 -DHAVE_CURSES_H -I/opt/csw/mysql5/include
-DHAVE_RWLOCK_T -fPIC -g -O2 -c mysql.c
gcc: language arch=v8 not recognized
gcc: mysql.c: linker input file unused because linking not done
/opt/csw/gcc3/bin/gcc -Wl, -G -o mysql.so mysql.o -L’.’ -L’/opt/csw/lib’
-Wl, -R’/opt/csw/lib’ -L. -L/opt/csw/lib -L/opt/csw/lib -R
/opt/csw/lib -L/opt/csw/lib -lruby -L/opt/csw/lib/32
-L/opt/csw/mysql5/lib/mysql -lmysqlclient -lz -lposix4 -lresolv -lc
-lgen -lsocket -lnsl -lm -L/opt/csw/lib -lssl -lcrypto -lrt -lpthread
-ldl -lcrypt -lm -lc
ld: fatal: file : open failed: No such file or directory
ld: fatal: file : open failed: No such file or directory
ld: fatal: File processing errors. No output written to mysql.so
collect2: ld returned 1 exit status
*** Error code 1
make: Fatal error: Command failed for target `mysql.so’
Gem files will remain installed in
/opt/csw/lib/ruby/gems/1.8/gems/mysql-2.7 for inspection.
Results logged to /opt/csw/lib/ruby/gems/1.8/gems/mysql-2.7/gem_make.out