1. Michael Granger
  2. ruby-pg
  3. Issues


Issue #83 resolved

HELP!! gem install pg failed on opensuse 10.3

created an issue


This is my first time install pg gem on linux box and it is failed. The only error I saw is the libpq-fe.h not found. Below is the command I use and the output of the command:


/export/home/invantest/tools/ruby/current/bin/gem install pg -- --with-pg-config=/export/home/invantest/tools/pgsql/8.3.3/bin/pg_config

Building native extensions. This could take a while... ERROR: Error installing pg: ERROR: Failed to build gem native extension.

    /export/home/invantest/tools/ruby/1.8.7/bin/ruby extconf.rb --with-pg-config=/export/home/invantest/tools/pgsql/8.3.3/bin/pg_config

Using config values from /export/home/invantest/tools/pgsql/8.3.3/bin/pg_config 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=/export/home/invantest/tools/ruby/1.8.7/bin/ruby --with-pg --without-pg --with-pg-dir --without-pg-dir --with-pg-include --without-pg-include=${pg-dir}/include --with-pg-lib --without-pg-lib=${pg-dir}/lib --with-pg-config

Gem files will remain installed in /export/home/invantest/tools/ruby/1.8.7/lib/ruby/gems/1.8/gems/pg-0.11.0 for inspection. Results logged to /export/home/invantest/tools/ruby/1.8.7/lib/ruby/gems/1.8/gems/pg-0.11.0/ext/gem_make.out }}}

When I do a ls on the include path, it show that the file is really exist:


ls /export/home/invantest/tools/pgsql/8.3.3/include/libpq-fe.h /export/home/invantest/tools/pgsql/8.3.3/include/libpq-fe.h }}}

I have no idea what else missing.

  • Ruby version is 1.8.7
  • Postgresql version is 8.3.3

I also included the mkmf.log for your reference. I am very appreciate for your help.

Comments (8)

  1. jdavis

    On debian and ubuntu, it looks like libpq-fe.h is provided by the package "libpq-dev". Can you try installing that package (or equivalent on your distribution)?

  2. Michael Granger repo owner
    • changed status to open

    Jeff, it looks like he has Postgres installed in his home directory, and the `mkmkf.log` confirms that the include dir from the installation is being included in the CPPFLAGS.

    syliang, would you mind testing something out for me? Create a file called `test.c` or something and paste this into it:

    #include <libpq-fe.h>

    Then run this command:

    gcc -E -I. -I/export/home/invantest/tools/ruby/1.8.7/lib/ruby/1.8/i686-linux -I. \
      -D_FILE_OFFSET_BITS=64  -I/export/home/invantest/tools/pgsql/8.3.3/include \
      -g -O2    test.c -o test.i

    and either reply with the output, or attach it if you prefer. Thanks!

  3. syliang reporter

    Hi Guy,

    I know what is the error already. I done a stupid mistake that I didn't notice the machine did not install with GCC. After I install the GCC, pg gem install successful. The error seem to be not reflect the real error but anyway it works. Thanks and sorry guys for wasting your time.

  4. Log in to comment