Issue #159 invalid

Installation failed on macosx

Thierry DELHAISE
created an issue

On my mac :

Darwin mars.local 12.3.0 Darwin Kernel Version 12.3.0: Sun Jan 6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64

Running gem install give me the following output :

mars:~ thierry$ sudo gem install pg -V
GET http://rubygems.org/latest_specs.4.8.gz
302 Moved Temporarily
GET http://production.s3.rubygems.org/latest_specs.4.8.gz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/pg-0.15.1.gemspec.rz
302 Moved Temporarily
GET http://production.cf.rubygems.org/quick/Marshal.4.8/pg-0.15.1.gemspec.rz
200 OK
Installing gem pg-0.15.1
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/.gemtest
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/BSDL
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/ChangeLog
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/Contributors.rdoc
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/History.rdoc
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/LICENSE
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/Manifest.txt
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/POSTGRES
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/README-OS_X.rdoc
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/README-Windows.rdoc
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/README.ja.rdoc
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/README.rdoc
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/Rakefile
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/Rakefile.cross
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/ext/extconf.rb
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/ext/gvl_wrappers.c
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/ext/gvl_wrappers.h
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/ext/pg.c
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/ext/pg.h
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/ext/pg_connection.c
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/ext/pg_result.c
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/ext/vc/pg.sln
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/ext/vc/pg_18/pg.vcproj
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/ext/vc/pg_19/pg_19.vcproj
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/lib/pg.rb
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/lib/pg/connection.rb
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/lib/pg/constants.rb
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/lib/pg/exceptions.rb
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/lib/pg/result.rb
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/sample/array_insert.rb
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/sample/async_api.rb
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/sample/async_copyto.rb
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/sample/async_mixed.rb
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/sample/check_conn.rb
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/sample/copyfrom.rb
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/sample/copyto.rb
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/sample/cursor.rb
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/sample/disk_usage_report.rb
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/sample/issue-119.rb
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/sample/losample.rb
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/sample/minimal-testcase.rb
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/sample/notify_wait.rb
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/sample/pg_statistics.rb
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/sample/replication_monitor.rb
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/sample/test_binary_values.rb
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/sample/wal_shipper.rb
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/sample/warehouse_partitions.rb
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/spec/data/expected_trace.out
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/spec/data/random_binary_data
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/spec/lib/helpers.rb
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/spec/pg/connection_spec.rb
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/spec/pg/result_spec.rb
/Library/Ruby/Gems/1.8/gems/pg-0.15.1/spec/pg_spec.rb
Building native extensions.  This could take a while...
ERROR:  Error installing pg:
    ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** 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=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/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
    --without-pg-config
    --with-pg_config
    --without-pg_config
    --with-pqlib
    --without-pqlib
    --with-libpqlib
    --without-libpqlib
    --with-ms/libpqlib
    --without-ms/libpqlib


Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/pg-0.15.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/pg-0.15.1/ext/gem_make.out

After checking mkmf.log, i've founded :

have_library: checking for PQconnectdb() in -lms/libpq... -------------------- no

"xcrun cc -o conftest -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0 -I.  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -I/usr/include -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE  -fno-common  -pipe -fno-common   conftest.c  -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L. -arch i386 -arch x86_64  -L/usr/lib -Wl,-rpath,/usr/lib     -lruby -lms/libpq  -lpthread -ldl -lobjc  "
ld: library not found for -lms/libpq
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
1: #include <libpq-fe.h>
2:
3: /*top*/
4: int main() { return 0; }
5: int t() { void ((*volatile p)()); p = (void ((*)()))PQconnectdb; return 0; }
/* end */

"xcrun cc -o conftest -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0 -I.  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -I/usr/include -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE  -fno-common  -pipe -fno-common   conftest.c  -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L. -arch i386 -arch x86_64  -L/usr/lib -Wl,-rpath,/usr/lib     -lruby -lms/libpq  -lpthread -ldl -lobjc  "
conftest.c:5:23: error: too few arguments to function call, single argument 'conninfo' was not specified
int t() { PQconnectdb(); return 0; }
          ~~~~~~~~~~~ ^
/usr/include/libpq-fe.h:243:1: note: 'PQconnectdb' declared here
extern PGconn *PQconnectdb(const char *conninfo);
^
1 error generated.
checked program was:
/* begin */
1: #include <libpq-fe.h>
2:
3: /*top*/
4: int main() { return 0; }
5: int t() { PQconnectdb(); return 0; }
/* end */

Fact : the default compiler don't allow the compilation of the test if there is not enough args in the test call of PQconnectdb. May be a call with the no args func PQconndefaults should be enough to confirm that the library is here ?

Comments (3)

  1. Michael Granger repo owner

    The error you're citing is part of the normal discovery that the mkmf library does when testing your compilation environment. I develop on MacOS X myself, and I can vouch for the extension's ability to generate its Makefile under "normal" conditions.

    The test for ms/libpq is for a different platform. The one you want to look at is the test for -lpq. You can attach your whole mkmf.log if you'd like, and I'd be happy to take a look and help figure out why it's not able to detect your libpq.

  2. Michael Granger repo owner

    I assume your issue is fixed, since I haven't heard back from you. If you still need help, feel free to re-open this ticket, or better yet, give us an update on your situation via the Google group in case anyone else has a similar issue now or in the future.

  3. Log in to comment