[Rubygems-developers] How to rebuild a gem

Luis Lavena luislavena at gmail.com
Thu Jan 22 06:23:08 EST 2009


On Thu, Jan 22, 2009 at 7:32 AM, Han Holl <han.holl at tietoenator.com> wrote:
> On Wednesday 21 January 2009, Eric Hodel wrote:
>>
>> You need to run `gem install` first.  It'll put the files in all the
>> right places.  You didn't read Ryan's original mail where he explained
>> this:
>>
> I did read his mail, and yours, and thing just are different for me. Maybe
> there is something ont quite alright with the gem I'm trying to install ?
> Here's the complete history. New ruby-1.9.1 install in /usr/local/bin.
>
> zernez:/usr/local/lib/ruby/gems/1.9.1> find .
> .
> ./gems
> ./cache
> ./doc
> ./specifications
> zernez:/usr/local/lib/ruby/gems/1.9.1> gem install pg
> Building native extensions.  This could take a while...
> ERROR:  Error installing pg:
>        ERROR: Failed to build gem native extension.
>
> /usr/local/bin/ruby extconf.rb install pg
> checking for main() in -lpq... yes
> checking for libpq-fe.h... yes
> checking for libpq/libpq-fs.h... yes
> checking for PQconnectionUsedPassword()... no
> checking for PQisthreadsafe()... no
> checking for PQprepare()... yes
> checking for PQexecParams()... yes
> checking for PQescapeString()... yes
> checking for PQescapeStringConn()... yes
> checking for lo_create()... yes
> checking for pg_encoding_to_char()... yes
> checking for PQsetClientEncoding()... yes
> creating Makefile
>
> make
> gcc -I. -I/usr/local/include/ruby-1.9.1/x86_64-linux -I/usr/local/include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I. -DHAVE_LIBPQ_FE_H -DHAVE_LIBPQ_LIBPQ_FS_H -DHAVE_PQPREPARE -DHAVE_PQEXECPARAMS -DHAVE_PQESCAPESTRING -DHAVE_PQESCAPESTRINGCONN -DHAVE_LO_CREATE -DHAVE_PG_ENCODING_TO_CHAR -DHAVE_PQSETCLIENTENCODING -I/usr/include    -fPIC  -O2 -g -Wall -Wno-parentheses  -o
> pg.o -c pg.c
> In file included from pg.h:6,
>                 from pg.c:15:
> /usr/local/include/ruby-1.9.1/ruby/backward/rubyio.h:2:2: warning: #warning
> use "ruby/io.h" instead of "rubyio.h"
> pg.c: In function 'parse_connect_args':
> pg.c:233: warning: unused variable 'error'
> pg.c:231: warning: unused variable 'conn'
> pg.c: In function 'pgconn_exec':
> pg.c:960: error: 'struct RArray' has no member named 'len'
> pg.c: In function 'pgconn_prepare':
> pg.c:1065: error: 'struct RArray' has no member named 'len'
> pg.c: In function 'pgconn_exec_prepared':
> pg.c:1151: error: 'struct RArray' has no member named 'len'
> pg.c: In function 'pgconn_send_query':
> pg.c:1491: error: 'struct RArray' has no member named 'len'
> pg.c: In function 'pgconn_send_prepare':
> pg.c:1595: error: 'struct RArray' has no member named 'len'
> pg.c: In function 'pgconn_send_query_prepared':
> pg.c:1684: error: 'struct RArray' has no member named 'len'
> pg.c: In function 'pgconn_trace':
> pg.c:2161: warning: implicit declaration of function 'dup'
> pg.c:2141: warning: unused variable 'fp'
> make: *** [pg.o] Error 1
>
>
> Gem files will remain installed
> in /usr/local/lib/ruby/gems/1.9.1/gems/pg-0.7.9.2008.10.13 for inspection.
> Results logged
> to /usr/local/lib/ruby/gems/1.9.1/gems/pg-0.7.9.2008.10.13/ext/gem_make.out
> zsh: exit 1     gem install pg
> zernez:/usr/local/lib/ruby/gems/1.9.1>   cd gems/pg-0.7.9.2008.10.13/ext
> zernez:.../1.9.1/gems/pg-0.7.9.2008.10.13/ext> cp /home/han/pg.c .
> zernez:.../1.9.1/gems/pg-0.7.9.2008.10.13/ext> make
> gcc -I. -I/usr/local/include/ruby-1.9.1/x86_64-linux -I/usr/local/include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I. -DHAVE_LIBPQ_FE_H -DHAVE_LIBPQ_LIBPQ_FS_H -DHAVE_PQPREPARE -DHAVE_PQEXECPARAMS -DHAVE_PQESCAPESTRING -DHAVE_PQESCAPESTRINGCONN -DHAVE_LO_CREATE -DHAVE_PG_ENCODING_TO_CHAR -DHAVE_PQSETCLIENTENCODING -I/usr/include    -fPIC  -O2 -g -Wall -Wno-parentheses  -o
> pg.o -c pg.c
> In file included from pg.h:6,
>                 from pg.c:15:
> /usr/local/include/ruby-1.9.1/ruby/backward/rubyio.h:2:2: warning: #warning
> use "ruby/io.h" instead of "rubyio.h"
> pg.c: In function 'parse_connect_args':
> pg.c:233: warning: unused variable 'error'
> pg.c:231: warning: unused variable 'conn'
> pg.c: In function 'pgconn_trace':
> pg.c:2161: warning: implicit declaration of function 'dup'
> pg.c:2141: warning: unused variable 'fp'
> pg.c: At top level:
> pg.c:88: warning: 'value_as_cstring' defined but not used
> gcc -I. -I/usr/local/include/ruby-1.9.1/x86_64-linux -I/usr/local/include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I. -DHAVE_LIBPQ_FE_H -DHAVE_LIBPQ_LIBPQ_FS_H -DHAVE_PQPREPARE -DHAVE_PQEXECPARAMS -DHAVE_PQESCAPESTRING -DHAVE_PQESCAPESTRINGCONN -DHAVE_LO_CREATE -DHAVE_PG_ENCODING_TO_CHAR -DHAVE_PQSETCLIENTENCODING -I/usr/include    -fPIC  -O2 -g -Wall -Wno-parentheses  -o
> compat.o -c compat.c
> gcc -shared -o pg.so pg.o
> compat.o -L. -L/usr/local/lib -Wl,-R/usr/local/lib -L/usr/lib64 -Wl,-R/usr/lib64 -L.  -rdynamic -Wl,-export-dynamic    -lpq  -lpthread -lrt -ldl -lcrypt -lm   -lc
> zernez:.../1.9.1/gems/pg-0.7.9.2008.10.13/ext>   cd ../../..
> zernez:/usr/local/lib/ruby/gems/1.9.1> find .
> .
> ./gems
> ./gems/pg-0.7.9.2008.10.13
> ./gems/pg-0.7.9.2008.10.13/sample
> ./gems/pg-0.7.9.2008.10.13/sample/test1.rb
> ./gems/pg-0.7.9.2008.10.13/sample/test4.rb
> ./gems/pg-0.7.9.2008.10.13/sample/test2.rb
> ./gems/pg-0.7.9.2008.10.13/sample/psqlHelp.rb
> ./gems/pg-0.7.9.2008.10.13/sample/losample.rb
> ./gems/pg-0.7.9.2008.10.13/sample/psql.rb
> ./gems/pg-0.7.9.2008.10.13/spec
> ./gems/pg-0.7.9.2008.10.13/spec/data
> ./gems/pg-0.7.9.2008.10.13/spec/data/expected_trace.out
> ./gems/pg-0.7.9.2008.10.13/spec/data/random_binary_data
> ./gems/pg-0.7.9.2008.10.13/spec/pgresult_spec.rb
> ./gems/pg-0.7.9.2008.10.13/spec/pgconn_spec.rb
> ./gems/pg-0.7.9.2008.10.13/doc
> ./gems/pg-0.7.9.2008.10.13/doc/postgres.jp.html
> ./gems/pg-0.7.9.2008.10.13/doc/postgres.html
> ./gems/pg-0.7.9.2008.10.13/ext
> ./gems/pg-0.7.9.2008.10.13/ext/gem_make.out
> ./gems/pg-0.7.9.2008.10.13/ext/compat.o
> ./gems/pg-0.7.9.2008.10.13/ext/extconf.rb
> ./gems/pg-0.7.9.2008.10.13/ext/mkmf.log
> ./gems/pg-0.7.9.2008.10.13/ext/pg.so
> ./gems/pg-0.7.9.2008.10.13/ext/Makefile
> ./gems/pg-0.7.9.2008.10.13/ext/pg.c
> ./gems/pg-0.7.9.2008.10.13/ext/mkrf_config.rb
> ./gems/pg-0.7.9.2008.10.13/ext/pg.h
> ./gems/pg-0.7.9.2008.10.13/ext/pg.o
> ./gems/pg-0.7.9.2008.10.13/ext/compat.c
> ./gems/pg-0.7.9.2008.10.13/ext/compat.h
> ./cache
> ./cache/pg-0.7.9.2008.10.13.gem
> ./doc
> ./specifications
> zernez:/usr/local/lib/ruby/gems/1.9.1> gem list
>
> *** LOCAL GEMS ***
>
>
> zernez:/usr/local/lib/ruby/gems/1.9.1>
>
> As you can see I end up with _no_ installed gems. Most critically, there is
> no .gemspec file in ./specification, and there isn't one in the the original
> archive either.
> Am I doing something wrong here ?

You can generate it:

gem spec pg > specifications/pg-0.7.9.2008.10.13.gemspec

That's your last step to have the gem installed, I believe.

>
> Cheers,
>
> Han Holl
>
> PS I've attached the transcript as well, because mail programs may do nasty
> thing with some of the lines here.
>

-- 
Luis Lavena
AREA 17
-
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry


More information about the Rubygems-developers mailing list