gem install pg -- --with-pgsql-include-dir='/usr/include/pgsql' --
with-pgsql-lib-dir='/usr/lib/pgsql'
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb --with-pgsql-include-dir=/usr/include/pgsql --
with-pgsql-lib-dir=/usr/lib/pgsql
can't find header files for ruby.
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/
pg-0.9.0 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/pg-0.9.0/ext/
gem_make.out
from yum list postgres*, the relevant stuff I have installed is:
Installed Packages
postgresql.i686
8.4.2-1.fc12 @updates
postgresql-devel.i686
8.4.2-1.fc12 @updates
postgresql-libs.i686
8.4.2-1.fc12 @updates
postgresql-server.i686
8.4.2-1.fc12 @updates
this block of code in /usr/lib/ruby/1.8/mkmf.rb is where the error
happens
topdir = File.dirname(libdir = File.dirname(__FILE__))
extdir = File.expand_path("ext", topdir)
$extmk = File.expand_path($0)[0, extdir.size+1] == extdir+"/"
if not $extmk and File.exist?(Config::CONFIG["archdir"] + "/ruby.h")
$hdrdir = $topdir = Config::CONFIG["archdir"]
elsif File.exist?(($top_srcdir ||= topdir) + "/ruby.h") and
File.exist?(($topdir ||= Config::CONFIG["topdir"]) + "/config.h")
$hdrdir = $top_srcdir
else
abort "can't find header files for ruby."
end
it's looking for ruby.h in either:
/usr/lib/ruby/1.8/i386-linux
/usr/lib/ruby/
and config.h in
/usr/lib/ruby/1.8/i386-linux
but those files are not there ..
yum install ruby-devel.i686
now I get: can't find libpq-fe.h.
gem install pg -- --with-pgsql-include-dir=/usr/include/pgsql --with-
pgsql-lib-dir=/usr/lib/pgsql
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb --with-pgsql-include-dir=/usr/include/pgsql --
with-pgsql-lib-dir=/usr/lib/pgsql
checking for pg_config... yes
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby
--with-pg
--without-pg
--with-pg-config
--without-pg-config
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib
--enable-static-build
--disable-static-build
yum install postgresql-devel
Craig
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
I allready have that:
yum install postgresql-devel
Loaded plugins: presto, refresh-packagekit
Setting up Install Process
Package postgresql-devel-8.4.2-1.fc12.i686 already installed and
latest version
Nothing to do
The file is here: /usr/include/libpq-fe.h
but this doesn't work:
gem install pg -- --with-pgsql-include-dir=/usr/include
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb --with-pgsql-include-dir=/usr/include
[root@458869-MITLL ext]#
/usr/include/pgsql/internal/libpq-int.h
/usr/include/pgsql/server/libpq/libpq-be.h
/usr/include/pgsql/server/libpq/libpq.h
/usr/include/pgsql/server/libpq/libpq-fs.h
and then I have this file here:
/usr/include/libpq-fe.h
I don't know if that means I have something wrong or incompatible on
my system or if I should just try copying the file into the directory
with the other ones
If /usr/include/libpq-fe.h actually exists, the compiler doesn't believe
it.
Try removing and re-installing the postgresql-devel package
yum remove postgresql-devel
Ok, I just did that, but I am having a problem that my gem command is
not working all of a sudden.
I had also tried to debug the extconf.rb, I had stepped inside a
function that appeared to hang so I killed the process.
gem --help
/usr/lib/ruby/site_ruby/1.8/rubygems.rb:521:in `expand_path': No such
file or directory - getcwd (Errno::ENOENT)
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:521:in `find_files'
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:520:in `map'
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:520:in `find_files'
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:1132
from /usr/bin/gem:8:in `require'
from /usr/bin/gem:8
cd /
then try again
That was strange as 'ls' showed I was in a directory, but that fixed
that problem, but after the reinstall I still have the same problem:
also, the extra args don't allways seemed to matter as I get the same
error for
just "gem install pg" without the other args
gem install pg -- --with-pgsql-include-dir=/usr/include/pgsql --with-
pgsql-lib-dir=/usr/lib/pgsql
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb --with-pgsql-include-dir=/usr/include/pgsql --
with-pgsql-lib-dir=/usr/lib/pgsql
[root@458869-MITLL /]#
685 # preprocessor macro would be passed to the compiler.
686 #
687 def have_header(header, &b)
=> 688 checking_for header do
689 if try_cpp(cpp_include(header), &b)
690 $defs.push(format("-DHAVE_%s", header.tr("a-z./\055", "A-
Z___")))
691 true
692 else
(rdb:1) break 689
Set breakpoint 2 at /usr/lib/ruby/1.8/mkmf.rb:689
(rdb:1) c
module Logging
@log = nil
@logfile = 'mkmf.log'
@orgerr = $stderr.dup
@orgout = $stdout.dup
@postpone = 0
def self::open
@log ||= File::open(@logfile, 'w')
@log.sync = true
$stderr.reopen(@log)
$stdout.reopen(@log) # <-- execution dies here
yield
ensure
$stderr.reopen(@orgerr)
$stdout.reopen(@orgout)
end
suggest that you start from scratch...
rm -fr /usr/lib/ruby/gems/1.8/gems/pg-0.9.0
gem install pg
and see what happens... then if it still fails, why not post the
relevant content of the
'log' /usr/lib/gems/1.8/gems/pg-0.9.0/ext/gem_make.out to the list?
gcc -E -I. -I/usr/lib/ruby/1.8/i386-linux -I. -D_FILE_OFFSET_BITS=64 -
I/usr/include -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -
fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -
mtune=atom -fasynchronous-unwind-tables -fno-strict-aliasing -fPIC
conftest.c -o conftest.i
gcc: conftest.c: No such file or directory
/usr/bin/ruby extconf.rb
checking for pg_config... my in check_for
my postpone:mkmftmp1.log
my open:mkmf.log
step 2
step 3
#<File:mkmf.log>
#<IO:0xb78d6f64>
yes
my check for header
checking for libpq-fe.h... my in check_for
my postpone:mkmftmp1.log
my open:mkmf.log
step 2
step 3
#<File:mkmf.log>
#<IO:0xb78d6f64>
[root@458869-MITLL ~]#
# gem install pg
Building native extensions. This could take a while...
Successfully installed pg-0.9.0
1 gem installed
Installing ri documentation for pg-0.9.0...
Installing RDoc documentation for pg-0.9.0...
I'm wondering, do you have the gcc/build stuff installed? I'm asking
because this appears to be c and not a ruby build.
try yum install gcc-c++ autoconf make # that should probably be enough
and deleted the ext directory and tried 'gem install pg' and go the
same error.
in the mkmf.log I saw this:
------------------------------
"gcc -E -I. -I/usr/lib/ruby/1.8/i386-linux -I. -D_FILE_OFFSET_BITS=64
-I/usr/include -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -
mtune=atom -fasynchronous-unwind-tables -fno-strict-aliasing -fPIC
conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include <libpq-fe.h>
/* end */
---------------------
I saw that the build deletes conftest.c, so I created a conftest.c
with just:
#include <libpq-fe.h>
then ran the gcc command above and it created a conftest.i file
I tried to be carefull, but I realize that the way ruby functions
return default values that debug code in the wrong place can mess up
the return result. I often write code to return an explicit result.
After not making any sense of why it was erroring our, I restored the
non debug version of the mkmf.rb
I had same problem. But It's solved after run
yum install ruby-devel
Thanks.
--
Posted via http://www.ruby-forum.com/.
sudo yum groupinstall 'development tools'
Cheers!
...chad