# Installprobs: mysql gem on solaris

**URL:** <https://www.ruby-forum.com/t/installprobs-mysql-gem-on-solaris/130568>\
**Category:** Deployment\
**Created:** [February 29, 2008, 2:13pm UTC](https://www.ruby-forum.com/t/installprobs-mysql-gem-on-solaris/130568 "2008-02-29T14:13:52Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![derkaan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/90db22/32.png) [@derkaan](https://www.ruby-forum.com/u/derkaan)\
**Post date:** [February 29, 2008, 2:13pm UTC](https://www.ruby-forum.com/t/installprobs-mysql-gem-on-solaris/130568/1 "2008-02-29T14:13:52Z")

</div>

Hi,

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.

I searched a lot to find more info about this issue, but the only  
related post ([Mysql driver question - Deployment - Ruby-Forum](http://www.ruby-forum.com/topic/98177)) still don’t solve  
it.

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’

---

<div class="post-metadata">

**Author:** ![derkaan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/90db22/32.png) [@derkaan](https://www.ruby-forum.com/u/derkaan)\
**Post date:** [February 29, 2008, 7:55pm UTC](https://www.ruby-forum.com/t/installprobs-mysql-gem-on-solaris/130568/2 "2008-02-29T19:55:26Z")

</div>

Welcome to Solaris hell.

I have had no end of problems with this, and still don’t have it  
working right. I have resolved to fix it once and for all on my  
server this weekend.

You can read some about my particular oddesy here:  
[http://www.ruby-forum.com/topic/138737](http://www.ruby-forum.com/topic/138737)

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…

On Feb 29, 8:13 am, Kaan K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![derkaan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/90db22/32.png) [@derkaan](https://www.ruby-forum.com/u/derkaan)\
**Post date:** [March 3, 2008, 12:13pm UTC](https://www.ruby-forum.com/t/installprobs-mysql-gem-on-solaris/130568/3 "2008-03-03T12:13:08Z")

</div>

Hi,

> Welcome to Solaris hell.  
> 🙂  
> 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…
> 
> On Feb 29, 8:13ï¿½am, Kaan K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

Cheers  
Kaan

---

<div class="post-metadata">

**Author:** ![derkaan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/90db22/32.png) [@derkaan](https://www.ruby-forum.com/u/derkaan)\
**Post date:** [March 3, 2008, 3:14pm UTC](https://www.ruby-forum.com/t/installprobs-mysql-gem-on-solaris/130568/4 "2008-03-03T15:14:12Z")

</div>

Kaan,

From your original message…

> 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.

On Mar 3, 6:13Â am, Kaan K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![derkaan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/90db22/32.png) [@derkaan](https://www.ruby-forum.com/u/derkaan)\
**Post date:** [March 3, 2008, 3:49pm UTC](https://www.ruby-forum.com/t/installprobs-mysql-gem-on-solaris/130568/5 "2008-03-03T15:49:37Z")

</div>

Andrew,

> 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](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’

---

<div class="post-metadata">

**Author:** ![derkaan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/90db22/32.png) [@derkaan](https://www.ruby-forum.com/u/derkaan)\
**Post date:** [March 3, 2008, 4:31pm UTC](https://www.ruby-forum.com/t/installprobs-mysql-gem-on-solaris/130568/6 "2008-03-03T16:31:46Z")

</div>

Is there another or a different error from cc?

The next error in your original post is "cc: language ildoff not  
recognized "

I don’t know how to fix that one, but if you keep googling the errors  
that cc spits out you should be able to work through it…

Sorry, I’m not an expert on this myself, so I don’t have the answers,  
but I do have the experience troubleshooting similar problems. 🙂

—A

On Mar 3, 9:49 am, Kaan K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![derkaan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/90db22/32.png) [@derkaan](https://www.ruby-forum.com/u/derkaan)\
**Post date:** [March 3, 2008, 4:45pm UTC](https://www.ruby-forum.com/t/installprobs-mysql-gem-on-solaris/130568/7 "2008-03-03T16:45:26Z")

</div>

> 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

---

<div class="post-metadata">

**Author:** ![derkaan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/90db22/32.png) [@derkaan](https://www.ruby-forum.com/u/derkaan)\
**Post date:** [March 3, 2008, 7:11pm UTC](https://www.ruby-forum.com/t/installprobs-mysql-gem-on-solaris/130568/8 "2008-03-03T19:11:36Z")

</div>

No, instead you have…

gcc: language arch=v8 not recognized

Keep Googling these kinds of error messages until you have a config  
that will compile. 🙂

On Mar 3, 10:45 am, Kaan K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
