Search

The Joyent Community

A place where the Joyent community can gather, help each other out, and stay informed.

You are not logged in.

#1 2006-11-11 01:08:56

benr
Systems Team
From: Silicon Valley
Registered: 2006-09-26
Posts: 119
Website  Expertise

HOWTO: Mongrel Gem Won't Build!?!

Lots of customers have tried to upgrade your Mongrel gems (its installed by default, although its currently 2 revs behind) only to run into a brick wall. 1 of 3 things can happen:

1) Rake can't find "make". Solaris hides "make" in /usr/ccs/bin with the other dev tools, such as ld, you can use the Solaris version of make by adding that directory to your path. Alternatively, you can use GNU Make found in /opt/csw/bin, as 'gmake'. In your container we symlink that to /usr/bin/make, but if for some reason its not present either alias the command ('alias make=/opt/csw/bin/gmake'), use 'gmake' instead of 'make', or even symlink gmake to make yourself.

2) Problems involving the "install" command. Similar to the 'make' wierdness, Solaris places 'install' in the '/usr/ucb' directory (BSD compatability tools, UCB stands for UC Berkely). Either add that directory to your path, or deal with the GNU version ('/opt/csw/bin/ginstall') in the same way as we did with make above.

3) The most common problem involves "cc" not being found. This is a by-product of the fact that we offer Blastwave packages (www.blastwave.org). Blastwave builds all of its packages with the Sun Studio compiler, which is great except that we can't install that compiler in your zone due to licensing problems (despite the fact that its free) and since Ruby was built with 'cc' it tries to use it again in the future.

We've assisted users who've submitted tickets with the 'cc' problem typically by NFS mounting the Studio Compiler Suite (/opt/SUNWspro) into your zone and having you add it to your path. In many cases I feel bad about this happening and I just finish install the gem myself on the customers behalf.

There are, however, other ways to deal with this problem. One way is to over-ride the variables supplied by Ruby by editing extconf.rb in the directory with the Makefile (in the case of Mongrel that'd typically be: /opt/csw/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/ext/http11/. In this method you add the appropriate variables to extconf.rb, execute it ('ruby extconf.rb') and then re-attempt your 'make'. That works, its fine and well, but its going to happen again in the future.

The best method is to fix all the default parameters that Ruby uses, which are found in: /opt/csw/lib/ruby/1.8/(ARCH)/rbconfig.rb. Here's a diff between the Sun Studio version and my modified GCC version:

Code:

# diff /opt/csw/lib/ruby/1.8/i386-solaris2.8/rbconfig.rb.default /opt/csw/lib/ruby/1.8/i386-solaris2.8/rbconfig.rb.gcc-ized
13c13
< CONFIG["INSTALL"] = "/export/home/comand/bin/install -c"
---
> CONFIG['INSTALL'] = "/usr/ucb/install"
61,63c61,63
< CONFIG["CC"] = "cc"
< CONFIG["CFLAGS"] = "-xO3 -xarch=386 -xspace -xildoff -I/opt/csw/include -I/opt/csw/include -KPIC"
< CONFIG["LDFLAGS"] = " -xarch=386 -L/opt/csw/lib -L/opt/csw/lib "
---
> CONFIG["CC"] = "/opt/csw/gcc3/bin/gcc"
> CONFIG["CFLAGS"] = "-g -O2"
> CONFIG["LDFLAGS"] = "-L/opt/csw/lib -L/opt/csw/lib"
66c66
< CONFIG["CPP"] = "cc -E"
---
> CONFIG["CPP"] = "/opt/csw/gcc3/bin/gcc -E"
91,92c91,92
< CONFIG["CCDLFLAGS"] = " -KPIC"
< CONFIG["LDSHARED"] = "ld -G"
---
> CONFIG["CCDLFLAGS"] = " -fPIC"
> CONFIG["LDSHARED"] = "$(CC) -Wl,-G"
98c98
< CONFIG["RPATHFLAG"] = " -R'%1$-s'"
---
> CONFIG["RPATHFLAG"] = " -Wl,-R'%1$-s'"
111,112c111,112
< CONFIG["XLDFLAGS"] = " -R$(libdir) -L."
< CONFIG["LIBRUBY_LDSHARED"] = "ld -G"
---
> CONFIG["XLDFLAGS"] = " -L."
> CONFIG["LIBRUBY_LDSHARED"] = "$(CC) -Wl,-G"


After making these changes dont' bother messing with the code, just re-install the Gem ('gem install mongrel') and it should succeed. Furthermore, it shouldn't be a problem anymore in the future.

In all new containers I'm applying this as a patch over the stock configuration. For existing customers you'll need to fix this yourself or request the fix in a ticket, giving us authorization to over-write your existing rbconfig.rb.

If your too lazy to edit the file I've put up a properly edited version here: http://www.cuddletech.com/rbconfig.rb You can simply move your existing rbconfig.rb away and wget that file down in its place.

Offline

 

#2 2006-11-11 01:38:40

madams
 
From: Edinburgh
Registered: 2005-05-11
Posts: 2010
Website  Expertise

Re: HOWTO: Mongrel Gem Won't Build!?!

Oh, man, Ben: thanks so much for this.

I'm not on a container but I'm trying out mongrel on Solaris at work, and it took me forever to get it to compile correctly. I knew that the issue involved a mismatch between the compilers used for Ruby (via Blastwave) and for the native components of the mongrel gem. Eventually I somehow fiddled with my PATH settings and got it to work (I think it must have been calling GNU tools for some things, Sun Studio tools for others).

If I ever have to reinstall I'll give your instructions a try.


Mark
Live in the city, work in the country. | OpenSolaris Immigrant

Offline

 

#3 2006-11-11 01:41:56

mcornick
Member
Registered: 2005-09-06
Posts: 93
Expertise

Re: HOWTO: Mongrel Gem Won't Build!?!

FWIW: Hpricot also needs similar tweaks to compile. I suspect it's probably the same for most if not all gems that need to compile C.

(Even after fixing it as described above, Hpricot installed but didn't quite work. I fixed this by updating to _why's latest dev version. gem install hpricot --source code.whytheluckystiff.net)

Offline

 

#4 2006-12-19 05:15:21

technoweenie
Member
From: TX
Registered: 2005-01-29
Posts: 66
Website  Expertise

Re: HOWTO: Mongrel Gem Won't Build!?!

I just upgraded to the latest mongrel pre-release 0.3.20 (gem update mongrel --source=http://mongrel.rubyforge.org/releases) and it compiled just fine on Solaris. Cool. This is a worthy upgrade from 0.3.13.4 (the last stable release on rubyforge) since it has the cgi dos fix and mentalguy's thread replacement, among other updates.

Offline

 

#5 2007-03-09 09:47:34

JustinG
Member
Registered: 2007-02-28
Posts: 42
Website  Expertise

Re: HOWTO: Mongrel Gem Won't Build!?!

By the way, it looks like this problem is re-triggered if you pkg-get update to ruby 1.85. The same fixes work.

Offline

 

#6 2007-03-31 13:22:57

Bas van Westing
New member
Registered: 2006-12-03
Posts: 12
Expertise

Re: HOWTO: Mongrel Gem Won't Build!?!

benr wrote:

If your too lazy to edit the file I've put up a properly edited version here: http://www.cuddletech.com/rbconfig.rb You can simply move your existing rbconfig.rb away and wget that file down in its place.


The link no longer works. After changing the config.rb manually, I still got errors. This only happens when trying to install rmagick. It doesn't happen on other gem installations. Why is that?

Edit: the rbconfig.rb file can be found here: http://svn.joyent.com/public/accelerators/
After using this file I got no errors anymore... so it was probably a typo.

The reason rmagick gave an error was that this gem uses the 'make' command. The new rbconfig.rb fixes this.

Last edited by Bas van Westing (2007-03-31 14:29:32)

Offline

 

#7 2007-04-05 20:30:09

msears
New member
From: Canada
Registered: 2007-01-09
Posts: 22
Website  Expertise

Re: HOWTO: Mongrel Gem Won't Build!?!

Just when I though I had this rbconfig.rb thing beat. Nope!

Updated packages and have a new version of ruby

Code:

mark$ ruby -v
ruby 1.8.5 (2006-12-25 patchlevel 12) [i386-solaris2.8]


I downloaded http://svn.joyent.com/public/accelerato … fig.rb.185 and am getting pages of errors when trying to do

Code:

mark$ sudo gem install raspell


Code:

mark$ sudo gem install hpricot


I have tried the rbconfig.rb i did manual changes on (and worked on another container). I am wondering if there needs to be any changes done to http://svn.joyent.com/public/accelerato … fig.rb.185 or if I am missing something stupid?!

Here is a partial dump of the errors in case something jumps out for someone:

Code:

__pthread_barrier_reserved"
/opt/csw/gcc3/lib/gcc/i386-pc-solaris2.8/3.4.5/include/sys/types.h:465: error: syntax error before "__pthread_barrier_lock"
/opt/csw/gcc3/lib/gcc/i386-pc-solaris2.8/3.4.5/include/sys/types.h:466: error: syntax error before "__pthread_barrier_cond"
/opt/csw/gcc3/lib/gcc/i386-pc-solaris2.8/3.4.5/include/sys/types.h:469: error: syntax error before "pthread_spinlock_t"
/opt/csw/gcc3/lib/gcc/i386-pc-solaris2.8/3.4.5/include/sys/types.h:496: error: syntax error before "upad64_t"
/opt/csw/gcc3/lib/gcc/i386-pc-solaris2.8/3.4.5/include/sys/types.h:641:24: sys/select.h: No such file or directory
In file included from /opt/csw/lib/ruby/1.8/i386-solaris2.8/ruby.h:694,

from raspell.h:4, from raspell.c:2:
/opt/csw/lib/ruby/1.8/i386-solaris2.8/intern.h:215: error: syntax error before "fd_set"
/opt/csw/lib/ruby/1.8/i386-solaris2.8/intern.h:216: warning: "struct timeval" declared inside parameter list
/opt/csw/lib/ruby/1.8/i386-solaris2.8/intern.h:216: warning: its scope is only this definition or declaration, which is probably not what you want
/opt/csw/lib/ruby/1.8/i386-solaris2.8/intern.h:216: warning: parameter has incomplete type
In file included from raspell.h:4, from raspell.c:2:
/opt/csw/lib/ruby/1.8/i386-solaris2.8/ruby.h:703:21: pthread.h: No such file or directory
make: *** [raspell.o] Error 1
ruby extconf.rb install raspell
checking for ruby.h... no
checking for aspell.h... yes
checking for main() in -laspell... no
creating Makefile

make
/opt/csw/gcc3/bin/gcc -I. -I. -I/opt/csw/lib/ruby/1.8/i386-solaris2.8 -I. -DHAVE_ASPELL_H -I/opt/csw/include -I/opt/csw/include -fPIC -g -O2 -c raspell.c

make install
mkdir -p /opt/csw/lib/ruby/gems/1.8/gems/raspell-0.3/lib
/opt/csw/gcc3/bin/gcc -I. -I. -I/opt/csw/lib/ruby/1.8/i386-solaris2.8 -I. -DHAVE_ASPELL_H -I/opt/csw/include -I/opt/csw/include -fPIC -g -O2 -c raspell.c
Successfully installed raspell-0.3

Last edited by msears (2007-04-05 20:32:47)

Offline

 

#8 2008-03-12 08:08:21

jesser
New member
Registered: 2007-11-12
Posts: 12
Expertise

Re: HOWTO: Mongrel Gem Won't Build!?!

Thanks Ben for this post, made my day!

Offline

 

#9 2008-04-13 01:38:53

akkdio
New member
Registered: 2008-03-29
Posts: 9
Expertise

Re: HOWTO: Mongrel Gem Won't Build!?!

I am not sure this is the same problem. Has anyone had this issue?

gem update --system
Updating RubyGems...
Bulk updating Gem source index for: http://gems.rubyforge.org
Attempting remote update of rubygems-update
ERROR: While executing gem ... (Errno::EACCES)

Permission denied - /opt/csw/lib/ruby/gems/1.8/cache/rubygems-update-1.1.1.gem

Andrew

Offline

 

#10 2008-04-13 06:16:28

gtcaz
Raconteur
From: Tucson, AZ
Registered: 2005-01-21
Posts: 1603
Website  Expertise

Re: HOWTO: Mongrel Gem Won't Build!?!

Maybe sudo gem update --system?


You're gonna have to answer to the Coca-Cola company.

Offline

 

#11 2008-04-24 16:18:42

akkdio
New member
Registered: 2008-03-29
Posts: 9
Expertise

Re: HOWTO: Mongrel Gem Won't Build!?!

Thanks gtcaz. Sudo got me further... but then I have this lovely message:

Updating RubyGems...
Bulk updating Gem source index for: http://gems.rubyforge.org
Attempting remote update of rubygems-update
Successfully installed rubygems-update-1.1.1
Updating version of RubyGems to 1.1.1
Installing RubyGems 1.1.1
ERROR: While executing gem ... (Errno::ENOMEM)

Not enough space

Gosh gee wiz. I have nothing but space on this de-accelerator because I can get anything to work. I have started to read my sysadmin books I bought so maybe in a few months I can get this gem updated.

Offline

 

#12 2008-04-24 16:34:21

unglued
Member
From: middle of nowhere, wisconsin
Registered: 2005-10-18
Posts: 214
Website  Expertise

Re: HOWTO: Mongrel Gem Won't Build!?!

Akkdio -- try killing off everything else on your accelerator first. if you've got a small accelerator and some stuff running (mongrels?), it's easy for gem operations to feel squeezed.

you might want to disable apache while you're at it -- something like:

Code:

sudo svcadm disable svc:/network/http:cswapache2

Offline

 

#13 2008-04-25 12:23:53

akkdio
New member
Registered: 2008-03-29
Posts: 9
Expertise

Re: HOWTO: Mongrel Gem Won't Build!?!

Thank you for your reply. I had to download it from the ruby site as tar file and then run ruby setup.rb in the directory that I downloaded it and unziped it. now I have 1.1.1.1 and mongrel starts (surprised, I was). Now it says ruby is out of date. So that is next.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson