Ruby-opengl gem uses ruby1.9, even from gem1.8

This is on an Ubuntu Hardy system, on x86_64. Both Ruby 1.8 and 1.9 are
installed.

I was tracking down the lack of ruby.h, which surprised me, as
ruby1.8-dev is
installed. Scrolling up even further, though, and something just seems
wrong
about these three lines:

rake RUBYARCHDIR=/var/lib/gems/1.8/gems/ruby-opengl-0.60.0/lib
RUBYLIBDIR=/var/lib/gems/1.8/gems/ruby-opengl-0.60.0/lib extension
/usr/bin/ruby1.9 mkrf_conf.rb
(in /var/lib/gems/1.8/gems/ruby-opengl-0.60.0)

Why is ruby1.9 being used to run mkrf_conf.rb? I am using a 1.8 gem –
as you
can see, it’s trying to install in a 1.8 path, and:

$ head -1 which gem
#! /usr/bin/ruby1.8
$ head -1 which gem1.9
#!/usr/bin/ruby1.9

I am sure I was using ‘gem’, and not ‘gem1.9’.

Full log from /var/lib/gems/1.8/gems/ruby-opengl-0.60.0/gem_make.out:

rake RUBYARCHDIR=/var/lib/gems/1.8/gems/ruby-opengl-0.60.0/lib
RUBYLIBDIR=/var/lib/gems/1.8/gems/ruby-opengl-0.60.0/lib extension
/usr/bin/ruby1.9 mkrf_conf.rb
(in /var/lib/gems/1.8/gems/ruby-opengl-0.60.0)
rake
cc -fPIC -fno-strict-aliasing -g -fPIC -Wall -DRUBY_VERSION=190
-I/usr/include/ruby-1.9.0 -I/usr/include/ruby-1.9.0/x86_64-linux
-I/usr/lib/ruby/1.9.0/x86_64-linux -I/usr/local/lib/site_ruby/1.9.0 -I.
-c
gl.c
(in /var/lib/gems/1.8/gems/ruby-opengl-0.60.0/ext/gl)
In file included from gl.c:18:
…/common/common.h:25:18: error: ruby.h: No such file or directory
In file included from …/common/common.h:51,
from gl.c:18:
…/common/gl-error.h:16: warning: parameter names (without types) in
function
declaration
…/common/gl-error.h:18: error: expected ‘=’, ‘,’, ‘;’, ‘asm’
or ‘__attribute__’ before ‘error_checking’
…/common/gl-error.h:19: error: expected ‘=’, ‘,’, ‘;’, ‘asm’
or ‘__attribute__’ before ‘inside_begin_end’
In file included from …/common/common.h:54,
from gl.c:18:
…/common/conv.h: In function ‘num2double’:
…/common/conv.h:55: error: expected declaration specifiers before
‘VALUE’
…/common/conv.h:55: warning: implicit declaration of function
‘FIXNUM_P’
…/common/conv.h:55: warning: implicit declaration of function
‘FIX2LONG’
…/common/conv.h:55: warning: implicit declaration of function ‘TYPE’
…/common/conv.h:55: error: ‘T_FLOAT’ undeclared (first use in this
function)
…/common/conv.h:55: error: (Each undeclared identifier is reported only
once
…/common/conv.h:55: error: for each function it appears in.)
…/common/conv.h:55: warning: implicit declaration of function ‘RFLOAT’
…/common/conv.h:55: error: invalid type argument of ‘->’
…/common/conv.h:55: error: ‘Qtrue’ undeclared (first use in this
function)
…/common/conv.h:55: error: ‘Qfalse’ undeclared (first use in this
function)
…/common/conv.h:55: error: ‘Qnil’ undeclared (first use in this
function)
…/common/conv.h:55: warning: implicit declaration of function
‘rb_num2dbl’
…/common/conv.h: In function ‘num2int’:
…/common/conv.h:62: error: expected declaration specifiers before
‘VALUE’
…/common/conv.h:62: error: ‘T_FLOAT’ undeclared (first use in this
function)
…/common/conv.h:62: error: invalid type argument of ‘->’
…/common/conv.h:62: error: ‘Qtrue’ undeclared (first use in this
function)
…/common/conv.h:62: error: ‘Qfalse’ undeclared (first use in this
function)
…/common/conv.h:62: error: ‘Qnil’ undeclared (first use in this
function)
…/common/conv.h:62: warning: implicit declaration of function
‘NUM2LONG’
…/common/conv.h: In function ‘num2uint’:
…/common/conv.h:63: error: expected declaration specifiers before
‘VALUE’
…/common/conv.h:63: warning: implicit declaration of function
‘FIX2ULONG’
…/common/conv.h:63: error: ‘T_FLOAT’ undeclared (first use in this
function)
…/common/conv.h:63: error: invalid type argument of ‘->’
…/common/conv.h:63: error: ‘Qtrue’ undeclared (first use in this
function)
…/common/conv.h:63: error: ‘Qfalse’ undeclared (first use in this
function)
…/common/conv.h:63: error: ‘Qnil’ undeclared (first use in this
function)
…/common/conv.h:63: warning: implicit declaration of function
‘NUM2ULONG’
…/common/conv.h: At top level:
…/common/conv.h:114: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or
‘__attribute__’
before ‘cond_GLBOOL2RUBY’
…/common/conv.h:115: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or
‘__attribute__’
before ‘cond_GLBOOL2RUBY_U’
…/common/conv.h:116: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or
‘__attribute__’
before ‘cond_GLBOOL2RUBY_LL’
…/common/conv.h:117: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or
‘__attribute__’
before ‘cond_GLBOOL2RUBY_ULL’
…/common/conv.h:118: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or
‘__attribute__’
before ‘cond_GLBOOL2RUBY_F’
…/common/conv.h:119: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or
‘__attribute__’
before ‘cond_GLBOOL2RUBY_D’
…/common/conv.h: In function ‘ary2cint’:
…/common/conv.h:142: error: expected declaration specifiers before
‘VALUE’
…/common/conv.h:142: warning: implicit declaration of function ‘RARRAY’
…/common/conv.h:142: warning: implicit declaration of function
‘rb_Array’
…/common/conv.h:142: warning: assignment makes pointer from integer
without a
cast
…/common/conv.h:142: error: dereferencing pointer to incomplete type
…/common/conv.h:142: error: dereferencing pointer to incomplete type
…/common/conv.h:142: error: dereferencing pointer to incomplete type
…/common/conv.h:142: warning: implicit declaration of function
‘rb_ary_entry’
…/common/conv.h:142: error: ‘VALUE’ undeclared (first use in this
function)
…/common/conv.h:142: error: expected ‘)’ before ‘ary’
…/common/conv.h: In function ‘ary2cuint’:
…/common/conv.h:143: error: expected declaration specifiers before
‘VALUE’
…/common/conv.h:143: warning: assignment makes pointer from integer
without a
cast
…/common/conv.h:143: error: dereferencing pointer to incomplete type
…/common/conv.h:143: error: dereferencing pointer to incomplete type
…/common/conv.h:143: error: dereferencing pointer to incomplete type
…/common/conv.h:143: error: ‘VALUE’ undeclared (first use in this
function)
…/common/conv.h:143: error: expected ‘)’ before ‘ary’
…/common/conv.h: In function ‘ary2cbyte’:
…/common/conv.h:144: error: expected declaration specifiers before
‘VALUE’
…/common/conv.h:144: warning: assignment makes pointer from integer
without a
cast
…/common/conv.h:144: error: dereferencing pointer to incomplete type
…/common/conv.h:144: error: dereferencing pointer to incomplete type
…/common/conv.h:144: error: dereferencing pointer to incomplete type
…/common/conv.h:144: error: ‘VALUE’ undeclared (first use in this
function)
…/common/conv.h:144: error: expected ‘)’ before ‘ary’
…/common/conv.h: In function ‘ary2cubyte’:
…/common/conv.h:145: error: expected declaration specifiers before
‘VALUE’
…/common/conv.h:145: warning: assignment makes pointer from integer
without a
cast
…/common/conv.h:145: error: dereferencing pointer to incomplete type
…/common/conv.h:145: error: dereferencing pointer to incomplete type
…/common/conv.h:145: error: dereferencing pointer to incomplete type
…/common/conv.h:145: error: ‘VALUE’ undeclared (first use in this
function)
…/common/conv.h:145: error: expected ‘)’ before ‘ary’
…/common/conv.h: In function ‘ary2cshort’:
…/common/conv.h:146: error: expected declaration specifiers before
‘VALUE’
…/common/conv.h:146: warning: assignment makes pointer from integer
without a
cast
…/common/conv.h:146: error: dereferencing pointer to incomplete type
…/common/conv.h:146: error: dereferencing pointer to incomplete type
…/common/conv.h:146: error: dereferencing pointer to incomplete type
…/common/conv.h:146: error: ‘VALUE’ undeclared (first use in this
function)
…/common/conv.h:146: error: expected ‘)’ before ‘ary’
…/common/conv.h: In function ‘ary2cushort’:
…/common/conv.h:147: error: expected declaration specifiers before
‘VALUE’
…/common/conv.h:147: warning: assignment makes pointer from integer
without a
cast
…/common/conv.h:147: error: dereferencing pointer to incomplete type
…/common/conv.h:147: error: dereferencing pointer to incomplete type
…/common/conv.h:147: error: dereferencing pointer to incomplete type
…/common/conv.h:147: error: ‘VALUE’ undeclared (first use in this
function)
…/common/conv.h:147: error: expected ‘)’ before ‘ary’
…/common/conv.h: In function ‘ary2cboolean’:
…/common/conv.h:148: error: expected declaration specifiers before
‘VALUE’
…/common/conv.h:148: warning: assignment makes pointer from integer
without a
cast
…/common/conv.h:148: error: dereferencing pointer to incomplete type
…/common/conv.h:148: error: dereferencing pointer to incomplete type
…/common/conv.h:148: error: dereferencing pointer to incomplete type
…/common/conv.h:148: error: ‘VALUE’ undeclared (first use in this
function)
…/common/conv.h:148: error: expected ‘)’ before ‘ary’
…/common/conv.h: In function ‘ary2cfloat’:
…/common/conv.h:149: error: expected declaration specifiers before
‘VALUE’
…/common/conv.h:149: warning: assignment makes pointer from integer
without a
cast
…/common/conv.h:149: error: dereferencing pointer to incomplete type
…/common/conv.h:149: error: dereferencing pointer to incomplete type
…/common/conv.h:149: error: dereferencing pointer to incomplete type
…/common/conv.h:149: error: ‘VALUE’ undeclared (first use in this
function)
…/common/conv.h:149: error: expected ‘)’ before ‘ary’
…/common/conv.h: In function ‘ary2cdouble’:
…/common/conv.h:150: error: expected declaration specifiers before
‘VALUE’
…/common/conv.h:150: warning: assignment makes pointer from integer
without a
cast
…/common/conv.h:150: error: dereferencing pointer to incomplete type
…/common/conv.h:150: error: dereferencing pointer to incomplete type
…/common/conv.h:150: error: dereferencing pointer to incomplete type
…/common/conv.h:150: error: ‘VALUE’ undeclared (first use in this
function)
…/common/conv.h:150: error: expected ‘)’ before ‘ary’
…/common/conv.h: In function ‘ary2cmatdouble’:
…/common/conv.h:176: error: expected declaration specifiers before
‘VALUE’
…/common/conv.h:176: warning: implicit declaration of function
‘rb_funcall’
…/common/conv.h:176: warning: implicit declaration of function
‘rb_intern’
…/common/conv.h:176: error: invalid type argument of ‘->’
…/common/conv.h:176: warning: implicit declaration of function
‘rb_raise’
…/common/conv.h:176: error: ‘rb_eArgError’ undeclared (first use in
this
function)
…/common/conv.h: In function ‘ary2cmatfloat’:
…/common/conv.h:177: error: expected declaration specifiers before
‘VALUE’
…/common/conv.h:177: error: invalid type argument of ‘->’
…/common/conv.h:177: error: ‘rb_eArgError’ undeclared (first use in
this
function)
…/common/conv.h: In function ‘ary2cmatdoublecount’:
…/common/conv.h:200: error: expected declaration specifiers before
‘VALUE’
…/common/conv.h:200: warning: implicit declaration of function
‘RARRAY_LEN’
…/common/conv.h:200: warning: implicit declaration of function ‘xfree’
…/common/conv.h:200: error: ‘rb_eArgError’ undeclared (first use in
this
function)
…/common/conv.h: In function ‘ary2cmatfloatcount’:
…/common/conv.h:201: error: expected declaration specifiers before
‘VALUE’
…/common/conv.h:201: error: ‘rb_eArgError’ undeclared (first use in
this
function)
In file included from gl.c:18:
…/common/common.h: At top level:
…/common/common.h:81: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or
‘__attribute__’
before ‘cProc’
…/common/common.h: In function ‘glformat_size’:
…/common/common.h:173: error: ‘rb_eArgError’ undeclared (first use in
this
function)
…/common/common.h: In function ‘gltype_glformat_unit_size’:
…/common/common.h:231: error: ‘rb_eArgError’ undeclared (first use in
this
function)
…/common/common.h: In function ‘get_uniform_size’:
…/common/common.h:316: error: ‘rb_eTypeError’ undeclared (first use in
this
function)
…/common/common.h: At top level:
…/common/common.h:338: error: expected declaration specifiers or ‘…’
before ‘VALUE’
…/common/common.h: In function ‘CheckDataSize’:
…/common/common.h:344: warning: implicit declaration of
function ‘RSTRING_LEN’
…/common/common.h:344: error: ‘data’ undeclared (first use in this
function)
…/common/common.h:345: error: ‘rb_eArgError’ undeclared (first use in
this
function)
…/common/common.h: At top level:
…/common/common.h:349: error: expected ‘=’, ‘,’, ‘;’, ‘asm’
or ‘__attribute__’ before ‘allocate_buffer_with_string’
…/common/common.h: In function ‘load_gl_function’:
…/common/common.h:390: error: ‘rb_eNotImpError’ undeclared (first use
in this
function)
…/common/common.h: At top level:
…/common/common.h:395: error: expected ‘=’, ‘,’, ‘;’, ‘asm’
or ‘__attribute__’ before ‘pack_array_or_pass_string’
gl.c:20: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’
before ‘module’
gl.c:22: warning: parameter names (without types) in function
declaration
gl.c:23: warning: parameter names (without types) in function
declaration
gl.c:24: warning: parameter names (without types) in function
declaration
gl.c:25: warning: parameter names (without types) in function
declaration
gl.c:26: warning: parameter names (without types) in function
declaration
gl.c:27: warning: parameter names (without types) in function
declaration
gl.c:28: warning: parameter names (without types) in function
declaration
gl.c:29: warning: parameter names (without types) in function
declaration
gl.c:30: warning: parameter names (without types) in function
declaration
gl.c:31: warning: parameter names (without types) in function
declaration
gl.c:32: warning: parameter names (without types) in function
declaration
gl.c:33: warning: parameter names (without types) in function
declaration
gl.c:34: warning: parameter names (without types) in function
declaration
gl.c:35: warning: parameter names (without types) in function
declaration
gl.c: In function ‘GetOpenglVersion’:
gl.c:49: error: ‘error_checking’ undeclared (first use in this function)
gl.c:49: error: ‘Qtrue’ undeclared (first use in this function)
gl.c:49: error: ‘inside_begin_end’ undeclared (first use in this
function)
gl.c:49: error: ‘Qfalse’ undeclared (first use in this function)
gl.c:51: warning: implicit declaration of function ‘sscanf’
gl.c:51: warning: incompatible implicit declaration of built-in
function ‘sscanf’
gl.c: In function ‘GetOpenglExtensions’:
gl.c:79: error: ‘error_checking’ undeclared (first use in this function)
gl.c:79: error: ‘Qtrue’ undeclared (first use in this function)
gl.c:79: error: ‘inside_begin_end’ undeclared (first use in this
function)
gl.c:79: error: ‘Qfalse’ undeclared (first use in this function)
gl.c:81: warning: implicit declaration of function ‘strlen’
gl.c:81: warning: incompatible implicit declaration of built-in
function ‘strlen’
gl.c:82: warning: implicit declaration of function ‘ALLOC_N’
gl.c:82: error: expected expression before ‘GLchar’
gl.c:82: warning: assignment makes pointer from integer without a cast
gl.c:83: warning: implicit declaration of function ‘strcpy’
gl.c:83: warning: incompatible implicit declaration of built-in
function ‘strcpy’
gl.c: In function ‘CheckExtension’:
gl.c:106: warning: incompatible implicit declaration of built-in
function ‘strlen’
gl.c:107: error: expected expression before ‘GLchar’
gl.c:107: warning: assignment makes pointer from integer without a cast
gl.c:108: warning: incompatible implicit declaration of built-in
function ‘strcpy’
gl.c:112: warning: implicit declaration of function ‘strstr’
gl.c:112: warning: incompatible implicit declaration of built-in
function ‘strstr’
gl.c: In function ‘CheckVersionExtension’:
gl.c:128: warning: incompatible implicit declaration of built-in
function ‘sscanf’
gl.c: At top level:
gl.c:140: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’
before ‘IsAvailable’
gl.c:142: error: expected identifier or ‘(’ before ‘{’ token
gl.c: In function ‘CheckBufferBinding’:
gl.c:175: error: ‘rb_eRuntimeError’ undeclared (first use in this
function)
gl.c:179: error: ‘error_checking’ undeclared (first use in this
function)
gl.c:179: error: ‘Qtrue’ undeclared (first use in this function)
gl.c:179: error: ‘inside_begin_end’ undeclared (first use in this
function)
gl.c:179: error: ‘Qfalse’ undeclared (first use in this function)
gl.c: In function ‘Init_gl’:
gl.c:185: error: ‘VALUE’ undeclared (first use in this function)
gl.c:185: error: expected ‘;’ before ‘VERSION’
gl.c:187: error: ‘module’ undeclared (first use in this function)
gl.c:187: warning: implicit declaration of function ‘rb_define_module’
gl.c:189: warning: implicit declaration of function ‘rb_define_const’
gl.c:189: error: ‘VERSION’ undeclared (first use in this function)
gl.c:208: warning: implicit declaration of
function ‘rb_define_module_function’
gl.c:208: error: ‘IsAvailable’ undeclared (first use in this function)
rake aborted!
Command failed with status (1):
[cc -fPIC -fno-strict-aliasing -g -fPIC …]
/var/lib/gems/1.8/gems/ruby-opengl-0.60.0/ext/gl/Rakefile:29:in `block
in <top
(required)>’
(See full trace by running task with --trace)
rake aborted!
Command failed with status (1): [rake…]

(See full trace by running task with --trace)

On May 28, 2008, at 01:14 AM, David M. wrote:

rake RUBYARCHDIR=/var/lib/gems/1.8/gems/ruby-opengl-0.60.0/lib
$ head -1 which gem1.9
#!/usr/bin/ruby1.9

head -1 which rake

On Wednesday 28 May 2008 03:55:32 Eric H. wrote:

#! /usr/bin/ruby1.8
$ head -1 which gem1.9
#!/usr/bin/ruby1.9

head -1 which rake

Ah. Thanks:

$ head -1 which rake
#!/usr/bin/ruby1.9

After installing rake via gem1.8, I still get the same on rake and
rake1.9 –
but they are not the same file:

$ diff /usr/bin/rake /usr/bin/rake1.9
1a2,4

#–

Copyright © 2003, 2004, 2005, 2006, 2007 Jim W.

3c6,11
< # This file was generated by RubyGems.

Permission is hereby granted, free of charge, to any person obtaining a

copy

of this software and associated documentation files (the “Software”), to

deal in the Software without restriction, including without limitation the

rights to use, copy, modify, merge, publish, distribute, sublicense,

and/or

sell copies of the Software, and to permit persons to whom the Software is

furnished to do so, subject to the following conditions:

5,6c13,14
< # The application ‘rake’ is installed as part of a gem, and
< # this file is here to facilitate running it.

The above copyright notice and this permission notice shall be included in

all copies or substantial portions of the Software.

7a16,23

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR

IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,

FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL

THE

AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER

LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER

DEALINGS

IN THE SOFTWARE.

#++
9,15c25,29
< require ‘rubygems’
<
< version = “>= 0”
<
< if ARGV.first =~ /^(.*)$/ and Gem::Version.correct? $1 then
< version = $1
< ARGV.shift


begin
require ‘rake’
rescue LoadError
require ‘rubygems’
require ‘rake’
17,19c31
<
< gem ‘rake’, version
< load ‘rake’


On Wednesday 28 May 2008 14:17:31 Eric H. wrote:

They should have a different shebang line. Re-run gem install rake
again to make plain rake be the 1.8 one.

I just did, and it has a 1.9 shebang. I’m pretty sure I tried this
before.

You may want to add “install: --format-executable” to your ~/.gemrc to
make gem add 1.8 or 1.9 to gem executable names so that they don’t
step on each others’ toes.

Ok, guessing that will be in root’s homedir if I install gems via sudo?

And would there still be a default ‘rake’ command? If so, which would it
use?
(Configurable?)

On May 28, 2008, at 03:24 AM, David M. wrote:

rake RUBYARCHDIR=/var/lib/gems/1.8/gems/ruby-opengl-0.60.0/lib
$ head -1 which gem1.9
rake1.9 –
but they are not the same file:

$ diff /usr/bin/rake /usr/bin/rake1.9
1a2,4

#–

Copyright © 2003, 2004, 2005, 2006, 2007 Jim W.

They should have a different shebang line. Re-run gem install rake
again to make plain rake be the 1.8 one.

You may want to add “install: --format-executable” to your ~/.gemrc to
make gem add 1.8 or 1.9 to gem executable names so that they don’t
step on each others’ toes.

On May 28, 2008, at 13:19 PM, David M. wrote:

On Wednesday 28 May 2008 14:17:31 Eric H. wrote:

They should have a different shebang line. Re-run gem install rake
again to make plain rake be the 1.8 one.

I just did, and it has a 1.9 shebang. I’m pretty sure I tried this
before.

Then does gem env report 1.9 as the ruby version?

You may want to add “install: --format-executable” to your ~/.gemrc
to
make gem add 1.8 or 1.9 to gem executable names so that they don’t
step on each others’ toes.

Ok, guessing that will be in root’s homedir if I install gems via
sudo?

In sudo ruby -e 'p ENV["HOME"]', which is the my homedir for me.

And would there still be a default ‘rake’ command? If so, which
would it use?
(Configurable?)

No, you would have to make a symlink to whichever you wanted to be the
default.