From: Michael Granger Date: 2011-03-04T04:43:53+09:00 Subject: Re: Trying to install pg on 32bit Snow Leopard 10.6 On Feb 28, 2011, at 9:30 AM, theLemcke wrote: > > On Feb 28, 9:16 am, theLemcke wrote: >> 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. >> > [...] > Mkmf.log file for reference: > > [...] > 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 Your PostgreSQL client library is x86_64, not i386. The "file was built for unsupported file format which is not the architecture being linked (i386)" pretty much says it all. I'd make sure pg_config is in your path, then try running it without the ARCHFLAGS override. -- Michael Granger Rubymage, Architect, Believer The FaerieMUD Consortium