I'm trying to install the "pg" gem on 32-bit snow leopard and I'm
encountering the following error:
$ sudo env ARCHFLAGS="-arch i386" gem install pg -v=0.9.0
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/opt/local/bin/ruby extconf.rb
checking for pg_config... yes
MacOS X build: fixing architecture flags:
using the value in ARCHFLAGS environment variable ("-arch i386").
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.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
--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=/opt/local/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
--with-pqlib
--without-pqlib
--with-libpqlib
--without-libpqlib
--with-ms/libpqlib
--without-ms/libpqlib
Any suggestions or help?
Mkmf.log file for reference:
find_executable: checking for pg_config... -------------------- yes
--------------------
have_header: checking for libpq-fe.h... -------------------- yes
"/usr/bin/gcc-4.2 -E -I. -I/opt/local/lib/ruby/1.8/i686-darwin10 -I. -
I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/opt/local/
include -I/opt/local/include/postgresql84 -pipe -O2 -fno-common -pipe
-fno-common -arch i386 conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include <libpq-fe.h>
/* end */
--------------------
have_header: checking for libpq/libpq-fs.h... -------------------- yes
"/usr/bin/gcc-4.2 -E -I. -I/opt/local/lib/ruby/1.8/i686-darwin10 -I. -
I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/opt/local/
include -I/opt/local/include/postgresql84 -pipe -O2 -fno-common -pipe
-fno-common -arch i386 conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include <libpq/libpq-fs.h>
/* end */
--------------------
have_library: checking for PQconnectdb() in -lpq...
-------------------- no
"/usr/bin/gcc-4.2 -o conftest -I. -I/opt/local/lib/ruby/1.8/i686-
darwin10 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -
I/opt/local/include -I/opt/local/include/postgresql84 -pipe -O2 -fno-
common -pipe -fno-common -arch i386 conftest.c -L. -L/opt/local/lib
-L/opt/local/lib -L. -L/opt/local/lib -L/opt/local/lib/postgresql84 -
arch i386 -arch i386 -lruby-static -lpq -lpthread -ldl -lobjc "
conftest.c: In function ‘t’:
conftest.c:3: error: ‘PQconnectdb’ undeclared (first use in this
function)
conftest.c:3: error: (Each undeclared identifier is reported only once
conftest.c:3: error: for each function it appears in.)
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { void ((*volatile p)()); p = (void ((*)()))PQconnectdb;
return 0; }
/* end */
"/usr/bin/gcc-4.2 -o conftest -I. -I/opt/local/lib/ruby/1.8/i686-
darwin10 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -
I/opt/local/include -I/opt/local/include/postgresql84 -pipe -O2 -fno-
common -pipe -fno-common -arch i386 conftest.c -L. -L/opt/local/lib
-L/opt/local/lib -L. -L/opt/local/lib -L/opt/local/lib/postgresql84 -
arch i386 -arch i386 -lruby-static -lpq -lpthread -ldl -lobjc "
ld: warning: in /opt/local/lib/postgresql84/libpq.dylib, file was
built for unsupported file format which is not the architecture being
linked (i386)
Undefined symbols:
"_PQconnectdb", referenced from:
_t in ccNZOcje.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { PQconnectdb(); return 0; }
/* end */
"/usr/bin/gcc-4.2 -o conftest -I. -I/opt/local/lib/ruby/1.8/i686-
darwin10 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -
I/opt/local/include -I/opt/local/include/postgresql84 -pipe -O2 -fno-
common -pipe -fno-common -arch i386 conftest.c -L. -L/opt/local/lib
-L/opt/local/lib -L. -L/opt/local/lib -L/opt/local/lib/postgresql84 -
arch i386 -arch i386 -lruby-static -lpq -lpthread -ldl -lobjc "
ld: warning: in /opt/local/lib/postgresql84/libpq.dylib, file was
built for unsupported file format which is not the architecture being
linked (i386)
Undefined symbols:
"_PQconnectdb", referenced from:
_t in ccJOW4Il.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: int PQconnectdb();
2: /*top*/
3: /*
4: *
http://trac.macports.org/ticket/3604
5: * gcc 4.0 on 10.4 has a problem
6: */
7: int main() { return 0; }
8: int t() { PQconnectdb(); return 0; }
/* end */
--------------------
have_library: checking for PQconnectdb() in -llibpq...
-------------------- no
"/usr/bin/gcc-4.2 -o conftest -I. -I/opt/local/lib/ruby/1.8/i686-
darwin10 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -
I/opt/local/include -I/opt/local/include/postgresql84 -pipe -O2 -fno-
common -pipe -fno-common -arch i386 conftest.c -L. -L/opt/local/lib
-L/opt/local/lib -L. -L/opt/local/lib -L/opt/local/lib/postgresql84 -
arch i386 -arch i386 -lruby-static -llibpq -lpthread -ldl -lobjc
"
conftest.c: In function ‘t’:
conftest.c:3: error: ‘PQconnectdb’ undeclared (first use in this
function)
conftest.c:3: error: (Each undeclared identifier is reported only once
conftest.c:3: error: for each function it appears in.)
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { void ((*volatile p)()); p = (void ((*)()))PQconnectdb;
return 0; }
/* end */
"/usr/bin/gcc-4.2 -o conftest -I. -I/opt/local/lib/ruby/1.8/i686-
darwin10 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -
I/opt/local/include -I/opt/local/include/postgresql84 -pipe -O2 -fno-
common -pipe -fno-common -arch i386 conftest.c -L. -L/opt/local/lib
-L/opt/local/lib -L. -L/opt/local/lib -L/opt/local/lib/postgresql84 -
arch i386 -arch i386 -lruby-static -llibpq -lpthread -ldl -lobjc
"
ld: library not found for -llibpq
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { PQconnectdb(); return 0; }
/* end */
"/usr/bin/gcc-4.2 -o conftest -I. -I/opt/local/lib/ruby/1.8/i686-
darwin10 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -
I/opt/local/include -I/opt/local/include/postgresql84 -pipe -O2 -fno-
common -pipe -fno-common -arch i386 conftest.c -L. -L/opt/local/lib
-L/opt/local/lib -L. -L/opt/local/lib -L/opt/local/lib/postgresql84 -
arch i386 -arch i386 -lruby-static -llibpq -lpthread -ldl -lobjc
"
ld: library not found for -llibpq
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: int PQconnectdb();
2: /*top*/
3: /*
4: *
http://trac.macports.org/ticket/3604
5: * gcc 4.0 on 10.4 has a problem
6: */
7: int main() { return 0; }
8: int t() { PQconnectdb(); return 0; }
/* end */
--------------------
have_library: checking for PQconnectdb() in -lms/libpq...
-------------------- no
"/usr/bin/gcc-4.2 -o conftest -I. -I/opt/local/lib/ruby/1.8/i686-
darwin10 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -
I/opt/local/include -I/opt/local/include/postgresql84 -pipe -O2 -fno-
common -pipe -fno-common -arch i386 conftest.c -L. -L/opt/local/lib
-L/opt/local/lib -L. -L/opt/local/lib -L/opt/local/lib/postgresql84 -
arch i386 -arch i386 -lruby-static -lms/libpq -lpthread -ldl -
lobjc "
conftest.c: In function ‘t’:
conftest.c:3: error: ‘PQconnectdb’ undeclared (first use in this
function)
conftest.c:3: error: (Each undeclared identifier is reported only once
conftest.c:3: error: for each function it appears in.)
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { void ((*volatile p)()); p = (void ((*)()))PQconnectdb;
return 0; }
/* end */
"/usr/bin/gcc-4.2 -o conftest -I. -I/opt/local/lib/ruby/1.8/i686-
darwin10 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -
I/opt/local/include -I/opt/local/include/postgresql84 -pipe -O2 -fno-
common -pipe -fno-common -arch i386 conftest.c -L. -L/opt/local/lib
-L/opt/local/lib -L. -L/opt/local/lib -L/opt/local/lib/postgresql84 -
arch i386 -arch i386 -lruby-static -lms/libpq -lpthread -ldl -
lobjc "
ld: library not found for -lms/libpq
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { PQconnectdb(); return 0; }
/* end */
"/usr/bin/gcc-4.2 -o conftest -I. -I/opt/local/lib/ruby/1.8/i686-
darwin10 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -
I/opt/local/include -I/opt/local/include/postgresql84 -pipe -O2 -fno-
common -pipe -fno-common -arch i386 conftest.c -L. -L/opt/local/lib
-L/opt/local/lib -L. -L/opt/local/lib -L/opt/local/lib/postgresql84 -
arch i386 -arch i386 -lruby-static -lms/libpq -lpthread -ldl -
lobjc "
ld: library not found for -lms/libpq
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: int PQconnectdb();
2: /*top*/
3: /*
4: *
http://trac.macports.org/ticket/3604
5: * gcc 4.0 on 10.4 has a problem
6: */
7: int main() { return 0; }
8: int t() { PQconnectdb(); return 0; }
/* end */
--------------------