Yet another "installing pg gem" issue on Mac - ruby-on-rails

So, I've just spent the best part of the day trying to get Rails (and required gems) to install correctly.
After hours with line cache and nokogiri I'm just starting to feel drained and have now come up with a problem installing the 'pg' gem.
I'm going to continue battling on but any advice here with this problem?
(And I know I shouldn't ask two questions in 1 SO post but I'm going to anyway. I've installed vast amounts of software in the past (including compiling Linux kernels from scratch) and Rails seems inordinately difficult to install on Snow Leopard. On a par with getting Linux display drivers working in the bad old days. Is there any progress being made anywhere on making this process simpler?)
Error log is:
Using linecache19 (0.5.12)
Installing nokogiri (1.5.0) with native extensions
Installing pg (0.12.2) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/user/.rvm/rubies/ruby-1.9.2-p318/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 PQconnectdb() in -lpq... yes
checking for PQconnectionUsedPassword()... yes
checking for PQisthreadsafe()... yes
checking for PQprepare()... yes
checking for PQexecParams()... yes
checking for PQescapeString()... yes
checking for PQescapeStringConn()... yes
checking for PQgetCancel()... yes
checking for lo_create()... yes
checking for pg_encoding_to_char()... yes
checking for PQsetClientEncoding()... yes
checking for rb_encdb_alias()... yes
checking for rb_enc_alias()... yes
checking for struct pgNotify.extra in libpq-fe.h... yes
checking for unistd.h... yes
checking for ruby/st.h... yes
creating extconf.h
creating Makefile
make
/usr/bin/gcc-4.2 -I. -I/Users/user/.rvm/rubies/ruby-1.9.2-p318/include/ruby-1.9.1/x86_64-darwin11.3.0 -I/Users/user/.rvm/rubies/ruby-1.9.2-p318/include/ruby-1.9.1/ruby/backward -I/Users/user/.rvm/rubies/ruby-1.9.2-p318/include/ruby-1.9.1 -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/Users/user/.rvm/usr/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/usr/include -fno-common -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -fno-common -pipe -o compat.o -c compat.c
/usr/bin/gcc-4.2 -I. -I/Users/user/.rvm/rubies/ruby-1.9.2-p318/include/ruby-1.9.1/x86_64-darwin11.3.0 -I/Users/user/.rvm/rubies/ruby-1.9.2-p318/include/ruby-1.9.1/ruby/backward -I/Users/user/.rvm/rubies/ruby-1.9.2-p318/include/ruby-1.9.1 -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/Users/user/.rvm/usr/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/usr/include -fno-common -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -fno-common -pipe -o pg.o -c pg.c
pg.c: In function ‘pgconn_exec’:
pg.c:954: warning: implicit conversion shortens 64-bit value into a 32-bit value
pg.c:993: warning: implicit conversion shortens 64-bit value into a 32-bit value
pg.c: In function ‘pgconn_prepare’:
pg.c:1059: warning: implicit conversion shortens 64-bit value into a 32-bit value
pg.c: In function ‘pgconn_exec_prepared’:
pg.c:1150: warning: implicit conversion shortens 64-bit value into a 32-bit value
pg.c:1180: warning: implicit conversion shortens 64-bit value into a 32-bit value
pg.c: In function ‘pgconn_s_escape’:
pg.c:1324: warning: implicit conversion shortens 64-bit value into a 32-bit value
pg.c:1331: warning: implicit conversion shortens 64-bit value into a 32-bit value
pg.c: In function ‘pgconn_send_query’:
pg.c:1504: warning: implicit conversion shortens 64-bit value into a 32-bit value
pg.c:1543: warning: implicit conversion shortens 64-bit value into a 32-bit value
pg.c: In function ‘pgconn_send_prepare’:
pg.c:1608: warning: implicit conversion shortens 64-bit value into a 32-bit value
pg.c: In function ‘pgconn_send_query_prepared’:
pg.c:1697: warning: implicit conversion shortens 64-bit value into a 32-bit value
pg.c:1728: warning: implicit conversion shortens 64-bit value into a 32-bit value
pg.c: In function ‘pgconn_wait_for_notify’:
pg.c:2103: warning: implicit conversion shortens 64-bit value into a 32-bit value
pg.c: In function ‘pgconn_put_copy_data’:
pg.c:2173: warning: implicit conversion shortens 64-bit value into a 32-bit value
pg.c: In function ‘pgconn_block’:
pg.c:2586: warning: implicit conversion shortens 64-bit value into a 32-bit value
pg.c:2592: warning: format not a string literal and no format arguments
pg.c:2607: warning: format not a string literal and no format arguments
pg.c: In function ‘pgconn_locreate’:
pg.c:2870: warning: implicit conversion shortens 64-bit value into a 32-bit value
pg.c: In function ‘find_or_create_johab’:
pg.c:3940: warning: comparison between signed and unsigned
pg.c:3946: warning: comparison between signed and unsigned
pg.c: In function ‘pgconn_get_client_encoding_as_rb_encoding’:
pg.c:3974: warning: comparison between signed and unsigned
pg.c: In function ‘pgconn_get_rb_encoding_as_pg_encname’:
pg.c:4006: warning: comparison between signed and unsigned
pg.c: In function ‘pgconn_internal_encoding_set’:
pg.c:4065: warning: comparison between signed and unsigned
pg.c: In function ‘pgconn_external_encoding’:
pg.c:4121: warning: comparison between signed and unsigned
/usr/bin/gcc-4.2 -dynamic -bundle -o pg_ext.bundle compat.o pg.o -L. -L/Users/user/.rvm/rubies/ruby-1.9.2-p318/lib -L/Users/user/.rvm/usr/lib -L. -L/usr/local/lib -L/usr/lib -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace -lruby.1.9.1 -lpq -lpthread -ldl -lobjc
ld: in /usr/local/lib/libssl.0.9.8.dylib, missing required architecture x86_64 in file for architecture x86_64
collect2: ld returned 1 exit status
make: *** [pg_ext.bundle] Error 1
Gem files will remain installed in /Users/user/.rvm/gems/ruby-1.9.2-p318/gems/pg-0.12.2 for inspection.
Results logged to /Users/user/.rvm/gems/ruby-1.9.2-p318/gems/pg-0.12.2/ext/gem_make.out
An error occured while installing pg (0.12.2), and Bundler cannot continue.
Make sure that `gem install pg -v '0.12.2'` succeeds before bundling.

Is there any progress being made anywhere on making this process simpler?)
Yes: Yehuda Katz is leading a Kickstarter project to help:
http://www.kickstarter.com/projects/1397300529/railsapp
Looks like you may have an old openssl.
Try this:
sudo port selfupdate
View the list of outdated ports:
port outdated
Clean up outdated ports:
sudo port clean outdated
sudo port upgrade outdated
See if you have any libssl:
find / | grep libssl.*dylib
Try installing postgresql from a Mac download:
http://www.postgresql.org/download/macosx/
Then try installing the gem as usual:
gem install pg
Or if you use sudo do:
sudo gem install pg

Normally this is a 64bit/32bit issue resp. a mismatch between your ruby version and your Postgresql Installation.
Depending on your architecture you have to make use of the correct ARCH flags.
Please see this answer on stackoverflow.
Generally I have little to no problems using "homebrew" and RVM
HTH

Related

rvm install ruby-3.0.0 fails with gcc-8 specific error

rvm install ruby-3.0.0 fails with gcc-8 specific error
[2021-03-01 17:27:54] ./configure
current path: /Users/user/.rvm/src/ruby-3.0.0
GEM_HOME=/Users/user/.rvm/gems/ruby-2.6.4
PATH=/usr/local/opt/coreutils/bin:/usr/local/opt/pkg-config/bin:/usr/local/opt/libtool/bin:/usr/local/opt/automake/bin:/usr/local/opt/autoconf/bin:/Users/user/.rvm/gems/ruby-2.6.4/bin:/Users/user/.rvm/gems/ruby-2.6.4#global/bin:/Users/user/.rvm/rubies/ruby-2.6.4/bin:/Users/user/work/software/google-cloud-sdk/bin:/Applications/SnowSQL.app/Contents/MacOS:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:/Applications/Wireshark.app/Contents/MacOS:/Users/user/.rvm/bin
GEM_PATH=/Users/user/.rvm/gems/ruby-2.6.4:/Users/user/.rvm/gems/ruby-2.6.4#global
command(7): env CFLAGS=-O3 -I/usr/local/opt/libyaml/include -I/usr/local/opt/libksba/include -I/usr/local/opt/readline/include -I/usr/local/opt/zlib/include -I/usr/local/opt/openssl#1.1/include LDFLAGS=-L/usr/local/opt/libyaml/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/zlib/lib -L/usr/local/opt/openssl#1.1/lib ./configure --prefix=/Users/user/.rvm/rubies/ruby-3.0.0 --disable-install-doc --enable-shared
checking for ruby... /Users/user/.rvm/rubies/ruby-2.6.4/bin/ruby
tool/config.guess already exists
tool/config.sub already exists
checking build system type... i386-apple-darwin17.7.0
checking host system type... i386-apple-darwin17.7.0
checking target system type... i386-apple-darwin17.7.0
checking for /usr/local/opt/ld/bin/gcc-8... no
checking for /usr/local/opt/gcc-ar/bin/gcc-8... no
checking for /usr/local/opt/g++/bin/gcc-8... no
checking for /usr/local/opt/gcc-nm/bin/gcc-8... no
checking for /usr/local/opt/gcc-ranlib/bin/gcc-8... no
checking for gcc... /usr/local/opt/gcc/bin/gcc-8
checking whether the C compiler works... no
configure: error: in `/Users/user/.rvm/src/ruby-3.0.0':
configure: error: C compiler cannot create executables
See `config.log' for more details
Other observations
/usr/local/opt/gcc#8 exists
/usr/local/opt/gcc/bin/gcc-8 doesn't
gcc#8 8.4.0_1 is already installed and up-to-date
I am stuck building a project because of this issue, any pointers would be helpful
This may be because gcc path is different.
please check it with gcc --version
it will show you the path and please make sure to install from different source.

Compiling expat for iOS - Command /bin/sh failed with exit code 2

PS: My earlier question was different, that could be fixed, now I am running into new problem
I am trying to import the libkml library into my iOS project. I realised that expat libraries cannot be linked (?) and so have to build the expat sources for it again.
I found a SO link where a gentleman mentions that he could successfully link expat with his iOS SDK 5.1: How to compile expat with iOS SDK 5.1?
I tried the same using the [script available in github][2] as mentioned in the above link.
But, I am getting an error in the Run phase of the script. I could not make the most out of it but I need help to fix this.
The script used is the same as from github link. C++ standard library in the project is set to "Compiler default" which I presume is LLVM C++. Below is the output from config.log which I am not able to make out with my level of understanding. Please help me out in resolving this problem and build the library to link it across with my project:
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by expat configure 2.0.1, which was
generated by GNU Autoconf 2.59. Invocation command line was
$ ./configure --prefix=/Users/raj/Projects/test/bin/iPhoneSimulator5.0-i386.sdk --host=i386-apple-darwin --enable-static
## --------- ##
## Platform. ##
## --------- ##
hostname = Rajs-MacBook-Pro.local
uname -m = x86_64
uname -r = 12.3.0
uname -s = Darwin
uname -v = Darwin Kernel Version 12.3.0: Sun Jan 6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64
/usr/bin/uname -p = i386
/bin/uname -X = unknown
/bin/arch = unknown
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
hostinfo = Mach kernel version:
Darwin Kernel Version 12.3.0: Sun Jan 6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64
Kernel configured for up to 8 processors.
4 processors are physically available.
8 processors are logically available.
Processor type: i486 (Intel 80486)
Processors active: 0 1 2 3 4 5 6 7
Primary memory available: 4.00 gigabytes
Default processor set: 124 tasks, 641 threads, 8 processors
Load average: 1.70, Mach factor: 6.28
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown
PATH: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
PATH: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/libexec
PATH: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin
PATH: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/local/bin
PATH: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/usr/bin
PATH: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/usr/local/bin
PATH: /Applications/Xcode.app/Contents/Developer/usr/bin
PATH: /Applications/Xcode.app/Contents/Developer/usr/local/bin
PATH: /Applications/Xcode.app/Contents/Developer/Tools
PATH: /usr/bin
PATH: /bin
PATH: /usr/sbin
PATH: /sbin
## ----------- ##
## Core tests. ##
## ----------- ##
configure:2092: checking build system type
configure:2110: result: i386-apple-darwin12.3.0
configure:2118: checking host system type
configure:2132: result: i386-apple-darwin
configure:2148: checking for i386-apple-darwin-gcc
configure:2174: result: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc
configure:2456: checking for C compiler version
configure:2459: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc --version </dev/null >&5
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
configure:2462: $? = 0
configure:2464: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc -v </dev/null >&5
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.11~182/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.11~182/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
configure:2467: $? = 0
configure:2469: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc -V </dev/null >&5
llvm-gcc-4.2: argument to `-V' is missing
configure:2472: $? = 1
configure:2495: checking for C compiler default output file name
configure:2498: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc -arch i386 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -I/Users/raj/Projects/test/include -arch i386 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -L/Users/raj/Projects/test/lib conftest.c >&5
configure:2501: $? = 0
configure:2547: result: a.out
configure:2552: checking whether the C compiler works
configure:2558: ./a.out
configure:2561: $? = 0
configure:2578: result: yes
configure:2585: checking whether we are cross compiling
configure:2587: result: no
configure:2590: checking for suffix of executables
configure:2592: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc -o conftest -arch i386 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -I/Users/raj/Projects/test/include -arch i386 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -L/Users/raj/Projects/test/lib conftest.c >&5
configure:2595: $? = 0
configure:2620: result:
configure:2626: checking for suffix of object files
configure:2647: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc -c -arch i386 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -I/Users/raj/Projects/test/include conftest.c >&5
configure:2650: $? = 0
configure:2672: result: o
configure:2676: checking whether we are using the GNU C compiler
configure:2700: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc -c -arch i386 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -I/Users/raj/Projects/test/include conftest.c >&5
configure:2706: $? = 0
configure:2710: test -z
|| test ! -s conftest.err
configure:2713: $? = 0
configure:2716: test -s conftest.o
configure:2719: $? = 0
configure:2732: result: yes
configure:2738: checking whether /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc accepts -g
configure:2759: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc -c -g conftest.c >&5
configure:2765: $? = 0
configure:2769: test -z
|| test ! -s conftest.err
configure:2772: $? = 0
configure:2775: test -s conftest.o
configure:2778: $? = 0
configure:2789: result: yes
configure:2806: checking for /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc option to accept ANSI C
configure:2876: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc -c -arch i386 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -I/Users/raj/Projects/test/include conftest.c >&5
conftest.c:10:19: error: stdio.h: No such file or directory
conftest.c:11:23: error: sys/types.h: No such file or directory
conftest.c:12:22: error: sys/stat.h: No such file or directory
conftest.c:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
conftest.c:44: error: expected declaration specifiers or '...' before 'FILE'
configure:2882: $? = 1
configure: failed program was:
| /* confdefs.h. */
|
| #define PACKAGE_NAME "expat"
| #define PACKAGE_TARNAME "expat"
| #define PACKAGE_VERSION "2.0.1"
| #define PACKAGE_STRING "expat 2.0.1"
| #define PACKAGE_BUGREPORT "expat-bugs#libexpat.org"
| /* end confdefs.h. */
| #include <stdarg.h>
| #include <stdio.h>
| #include <sys/types.h>
| #include <sys/stat.h>
| /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
| struct buf { int x; };
| FILE * (*rcsopen) (struct buf *, struct stat *, int);
| static char *e (p, i)
| char **p;
| int i;
| {
| return p[i];
| }
| static char *f (char * (*g) (char **, int), char **p, ...)
| {
| char *s;
| va_list v;
| va_start (v,p);
| s = g (p, va_arg (v,int));
| va_end (v);
| return s;
| }
.
.
.
.
.
configure: exit 0
In addition to the above config.log file, I could find a build log too.
Details of the build-expat-2.0.1.log file:
configure: WARNING: If you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used.
checking build system type... i386-apple-darwin12.3.0
checking host system type... i386-apple-darwin
checking for i386-apple-darwin-gcc... /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc accepts -g... yes
checking for /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc option to accept ANSI C... none needed
checking for a sed that does not truncate output... /usr/bin/sed
checking for egrep... grep -E
checking for ld used by /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc... /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/ld) is GNU ld... no
checking for /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/nm
checking whether ln -s works... yes
checking how to recognise dependent libraries... pass_all
checking how to run the C preprocessor... /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc -E
checking for ANSI C header files... no
checking for sys/types.h... no
checking for sys/stat.h... no
checking for stdlib.h... no
checking for string.h... no
checking for memory.h... no
checking for strings.h... no
checking for inttypes.h... no
checking for stdint.h... no
checking for unistd.h... no
checking dlfcn.h usability... no
checking dlfcn.h presence... yes
configure: WARNING: dlfcn.h: present but cannot be compiled
configure: WARNING: dlfcn.h: check for missing prerequisite headers?
configure: WARNING: dlfcn.h: see the Autoconf documentation
configure: WARNING: dlfcn.h: section "Present But Cannot Be Compiled"
configure: WARNING: dlfcn.h: proceeding with the preprocessor's result
configure: WARNING: dlfcn.h: in the future, the compiler will take precedence
configure: WARNING: ## -------------------------------------- ##
configure: WARNING: ## Report this to expat-bugs#libexpat.org ##
configure: WARNING: ## -------------------------------------- ##
checking for dlfcn.h... yes
checking for i386-apple-darwin-g++... /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++
checking whether we are using the GNU C++ compiler... yes
checking whether /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++ accepts -g... yes
checking how to run the C++ preprocessor... /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-cpp-4.2
checking for i386-apple-darwin-g77... no
checking for i386-apple-darwin-f77... no
checking for i386-apple-darwin-xlf... no
checking for i386-apple-darwin-frt... no
checking for i386-apple-darwin-pgf77... no
checking for i386-apple-darwin-fort77... no
checking for i386-apple-darwin-fl32... no
checking for i386-apple-darwin-af77... no
checking for i386-apple-darwin-f90... no
checking for i386-apple-darwin-xlf90... no
checking for i386-apple-darwin-pgf90... no
checking for i386-apple-darwin-epcf90... no
checking for i386-apple-darwin-f95... no
checking for i386-apple-darwin-fort... no
checking for i386-apple-darwin-xlf95... no
checking for i386-apple-darwin-ifc... no
checking for i386-apple-darwin-efc... no
checking for i386-apple-darwin-pgf95... no
checking for i386-apple-darwin-lf95... no
checking for i386-apple-darwin-gfortran... no
checking for g77... no
checking for f77... no
checking for xlf... no
checking for frt... no
checking for pgf77... no
checking for fort77... no
checking for fl32... no
checking for af77... no
checking for f90... no
checking for xlf90... no
checking for pgf90... no
checking for epcf90... no
checking for f95... no
checking for fort... no
checking for xlf95... no
checking for ifc... no
checking for efc... no
checking for pgf95... no
checking for lf95... no
checking for gfortran... no
checking whether we are using the GNU Fortran 77 compiler... no
checking whether accepts -g... no
checking the maximum length of command line arguments... 196608
checking command to parse /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/nm output from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc object... ok
checking for objdir... .libs
checking for i386-apple-darwin-ar... no
checking for ar... ar
checking for i386-apple-darwin-ranlib... /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/ranlib
checking for i386-apple-darwin-strip... no
checking for strip... strip
checking if /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc supports -fno-rtti -fno-exceptions... no
checking for /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc option to produce PIC... -fno-common
checking if /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc PIC flag -fno-common works... yes
checking if /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc static flag -static works... no
checking if /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc supports -c -o file.o... yes
checking whether the /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc linker (/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
configure: creating libtool
appending configuration tag "CXX" to libtool
checking for ld used by /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++... /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/ld) is GNU ld... no
checking whether the /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++ linker (/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/ld) supports shared libraries... yes
checking for /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++ option to produce PIC... -fno-common
checking if /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++ PIC flag -fno-common works... yes
checking if /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++ static flag -static works... no
checking if /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++ supports -c -o file.o... yes
checking whether the /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++ linker (/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin dyld
checking how to hardcode library paths into programs... immediate
appending configuration tag "F77" to libtool
checking for i386-apple-darwin-gcc... (cached) /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc accepts -g... (cached) yes
checking for /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc option to accept ANSI C... (cached) none needed
checking for a BSD-compatible install... /usr/bin/install -c
checking whether /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc accepts -fexceptions... yes
checking for ANSI C header files... (cached) no
checking whether byte ordering is bigendian... no
checking for an ANSI C-conforming const... yes
checking for size_t... no
checking for memmove... no
checking for bcopy... no
checking fcntl.h usability... no
checking fcntl.h presence... yes
configure: WARNING: fcntl.h: present but cannot be compiled
configure: WARNING: fcntl.h: check for missing prerequisite headers?
configure: WARNING: fcntl.h: see the Autoconf documentation
configure: WARNING: fcntl.h: section "Present But Cannot Be Compiled"
configure: WARNING: fcntl.h: proceeding with the preprocessor's result
configure: WARNING: fcntl.h: in the future, the compiler will take precedence
configure: WARNING: ## -------------------------------------- ##
configure: WARNING: ## Report this to expat-bugs#libexpat.org ##
configure: WARNING: ## -------------------------------------- ##
checking for fcntl.h... yes
checking for unistd.h... (cached) no
checking for off_t... no
checking for stdlib.h... (cached) no
checking for unistd.h... (cached) no
checking for getpagesize... no
checking for working mmap... no
checking for an ANSI C99-conforming __func__... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating expat_config.h
config.status: expat_config.h is unchanged
/bin/sh ./libtool --silent --mode=compile /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc -I./lib -I. -arch i386 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -I/Users/raj/Projects/test/include -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions -DHAVE_EXPAT_CONFIG_H -o lib/xmlparse.lo -c lib/xmlparse.c
lib/xmlparse.c:6:65: error: string.h: No such file or directory
lib/xmlparse.c:7:20: error: assert.h: No such file or directory
In file included from lib/xmlparse.c:24:
lib/expat.h:17:20: error: stdlib.h: No such file or directory
lib/xmlparse.c:81:2: error: #error memmove does not exist on this platform, nor is a substitute available
lib/xmlparse.c: In function 'parserCreate':
lib/xmlparse.c:719: warning: implicit declaration of function 'malloc'
lib/xmlparse.c:719: warning: incompatible implicit declaration of built-in function 'malloc'
lib/xmlparse.c:722: warning: assignment from incompatible pointer type
lib/xmlparse.c:723: error: 'realloc' undeclared (first use in this function)
lib/xmlparse.c:723: error: (Each undeclared identifier is reported only once
lib/xmlparse.c:723: error: for each function it appears in.)
lib/xmlparse.c:724: error: 'free' undeclared (first use in this function)
lib/xmlparse.c: In function 'parserInit':
lib/xmlparse.c:848: warning: implicit declaration of function 'memset'
lib/xmlparse.c:848: warning: incompatible implicit declaration of built-in function 'memset'
lib/xmlparse.c: In function 'XML_Parse':
lib/xmlparse.c:1543: warning: implicit declaration of function 'memcpy'
lib/xmlparse.c:1543: warning: incompatible implicit declaration of built-in function 'memcpy'
lib/xmlparse.c: In function 'XML_GetBuffer':
lib/xmlparse.c:1627: warning: implicit declaration of function 'memmove'
lib/xmlparse.c:1627: warning: incompatible implicit declaration of built-in function 'memmove'
lib/xmlparse.c:1656: warning: incompatible implicit declaration of built-in function 'memcpy'
lib/xmlparse.c: In function 'XML_GetParsingStatus':
lib/xmlparse.c:1750: warning: implicit declaration of function 'assert'
lib/xmlparse.c: In function 'storeRawNames':
lib/xmlparse.c:2009: warning: incompatible implicit declaration of built-in function 'memcpy'
lib/xmlparse.c: In function 'doContent':
lib/xmlparse.c:2424: warning: implicit declaration of function 'memcmp'
lib/xmlparse.c: In function 'storeAtts':
lib/xmlparse.c:2922: warning: incompatible implicit declaration of built-in function 'memcpy'
lib/xmlparse.c:2931: warning: incompatible implicit declaration of built-in function 'memcpy'
lib/xmlparse.c: In function 'addBinding':
lib/xmlparse.c:3039: warning: incompatible implicit declaration of built-in function 'memcpy'
lib/xmlparse.c: In function 'lookup':
lib/xmlparse.c:5871: warning: incompatible implicit declaration of built-in function 'memset'
lib/xmlparse.c:5898: warning: incompatible implicit declaration of built-in function 'memset'
lib/xmlparse.c:5927: warning: incompatible implicit declaration of built-in function 'memset'
lib/xmlparse.c: In function 'poolGrow':
lib/xmlparse.c:6112: warning: incompatible implicit declaration of built-in function 'memcpy'
lib/xmlparse.c:6148: warning: incompatible implicit declaration of built-in function 'memcpy'
make: *** [lib/xmlparse.lo] Error 1
Two suggestions:
1) build the library for OSX, that is run ./configure and make. If that works, construct a Xcode library project, add all the library source files, and the created congig.h etc. get this project to compile, then add the project to your app. I have done this and it's often the easiest (in the end) solution.
2) if you cannot get that to work offer a 100 to 250 bounty and someone else will do it. That's a clear benefit of building up points here - you can use them for something when you really need to!

Erros while installing 'therubyracer-heroku' gem

I am trying to do a gem install therubyracer-heroku -v '0.8.1.pre3', but I am getting errors while building, it is a big log but here is the last failing lines (pasted full log in the end):
g++ -o obj/release/bootstrapper.o -c -Wall -Werror -W -Wno-unused-parameter -Wnon-virtual-dtor -pedantic -m32 -O3 -fomit-frame-pointer -fdata-sections -ffunction-sections -ansi -fno-rtti -fno-exceptions -fvisibility=hidden -Wall -Werror -W -Wno-unused-parameter -Wnon-virtual-dtor -pedantic -m32 -O3 -fomit-frame-pointer -fdata-sections -ffunction-sections -ansi -DV8_TARGET_ARCH_IA32 -DENABLE_VMSTATE_TRACKING -DENABLE_LOGGING_AND_PROFILING -DENABLE_DEBUGGER_SUPPORT -Isrc src/bootstrapper.cc
src/bootstrapper.cc: In static member function 'static bool v8::internal::Genesis::CompileScriptCached(v8::internal::Vector<const char>, v8::internal::Handle<v8::internal::String>, v8::internal::SourceCodeCache*, v8::Extension*, v8::internal::Handle<v8::internal::Context>, bool)':
src/bootstrapper.cc:1002:18: error: variable 'result' set but not used [-Werror=unused-but-set-variable]
src/bootstrapper.cc: In member function 'bool v8::internal::Genesis::InstallNatives()':
src/bootstrapper.cc:1227:24: error: variable 'name' set but not used [-Werror=unused-but-set-variable]
cc1plus: all warnings being treated as errors
scons: *** [obj/release/bootstrapper.o] Error 1
scons: building terminated because of errors.
make: *** [build/v8/libv8.a] Error 2
*** 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.
I have googled about his for many hours and looked into a lot of SO similar questions, but nothing helped, also I don't know what is mkmf log mean and where to find it.
Additional information:
OS: Ubuntu, 12.04
I already have nodeJs installed, version is v0.8.14 (Just giving this info, since it may be linked with this)
Ruby version: 1.9.3
RVM is used

Struggling to install pg gem on OSX Lion - "missing required architecture x86_64 in file for architecture x86_64"

I'm having trouble installing the PostgreSQL gem on OSX Lion. After running gem install pg I get the following output after the makefile is created:
make
/usr/bin/gcc-4.2 -I. -I/Users/Stuart/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/x86_64-darwin11.2.0 -I/Users/Stuart/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/ruby/backward -I/Users/Stuart/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1 -I. -DRUBY_EXTCONF_H=\"extconf.h\" -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/usr/include -fno-common -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -fno-common -pipe -o compat.o -c compat.c
/usr/bin/gcc-4.2 -I. -I/Users/Stuart/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/x86_64-darwin11.2.0 -I/Users/Stuart/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/ruby/backward -I/Users/Stuart/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1 -I. -DRUBY_EXTCONF_H=\"extconf.h\" -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/usr/include -fno-common -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -fno-common -pipe -o pg.o -c pg.c
pg.c: In function ‘pgconn_exec’:
pg.c:947: warning: implicit conversion shortens 64-bit value into a 32-bit value
pg.c:986: warning: implicit conversion shortens 64-bit value into a 32-bit value
pg.c: In function ‘pgconn_prepare’:
pg.c:1052: warning: implicit conversion shortens 64-bit value into a 32-bit value
pg.c: In function ‘pgconn_exec_prepared’:
pg.c:1143: warning: implicit conversion shortens 64-bit value into a 32-bit value
pg.c:1173: warning: implicit conversion shortens 64-bit value into a 32-bit value
pg.c: In function ‘pgconn_s_escape’:
pg.c:1317: warning: implicit conversion shortens 64-bit value into a 32-bit value
pg.c:1324: warning: implicit conversion shortens 64-bit value into a 32-bit value
pg.c: In function ‘pgconn_send_query’:
pg.c:1497: warning: implicit conversion shortens 64-bit value into a 32-bit value
pg.c:1536: warning: implicit conversion shortens 64-bit value into a 32-bit value
pg.c: In function ‘pgconn_send_prepare’:
pg.c:1601: warning: implicit conversion shortens 64-bit value into a 32-bit value
pg.c: In function ‘pgconn_send_query_prepared’:
pg.c:1690: warning: implicit conversion shortens 64-bit value into a 32-bit value
pg.c:1721: warning: implicit conversion shortens 64-bit value into a 32-bit value
pg.c: In function ‘pgconn_wait_for_notify’:
pg.c:2096: warning: implicit conversion shortens 64-bit value into a 32-bit value
pg.c: In function ‘pgconn_put_copy_data’:
pg.c:2166: warning: implicit conversion shortens 64-bit value into a 32-bit value
pg.c: In function ‘pgconn_block’:
pg.c:2579: warning: implicit conversion shortens 64-bit value into a 32-bit value
pg.c:2585: warning: format not a string literal and no format arguments
pg.c:2600: warning: format not a string literal and no format arguments
pg.c: In function ‘pgconn_locreate’:
pg.c:2863: warning: implicit conversion shortens 64-bit value into a 32-bit value
pg.c: In function ‘find_or_create_johab’:
pg.c:3933: warning: comparison between signed and unsigned
pg.c:3939: warning: comparison between signed and unsigned
pg.c: In function ‘pgconn_get_client_encoding_as_rb_encoding’:
pg.c:3967: warning: comparison between signed and unsigned
pg.c: In function ‘pgconn_get_rb_encoding_as_pg_encname’:
pg.c:3999: warning: comparison between signed and unsigned
pg.c: In function ‘pgconn_internal_encoding_set’:
pg.c:4058: warning: comparison between signed and unsigned
pg.c: In function ‘pgconn_external_encoding’:
pg.c:4114: warning: comparison between signed and unsigned
/usr/bin/gcc-4.2 -dynamic -bundle -o pg_ext.bundle compat.o pg.o -L. -L/Users/Stuart/.rvm/rubies/ruby-1.9.2-p290/lib -L. -L/usr/local/lib -L/usr/lib -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace -lruby.1.9.1 -lpq -lpthread -ldl -lobjc
ld: in /usr/local/lib/libssl.0.9.8.dylib, missing required architecture x86_64 in file for architecture x86_64
collect2: ld returned 1 exit status
make: *** [pg_ext.bundle] Error 1
Any ideas? I've not used Postgre on OSX before, so may be an issue with my install?
It looks like you are trying to install a 64-bit version on a 32-bit machine. Check to make sure that you downloaded the right version for your OS.
I had this exact same problem on OS Lion. I solved it by entering the following (after checking out the postgresql requirements):
rm Gemfile.lock
brew install readline (I'm not sure if this is needed here, but it is a dependency for postgresql and I already had the most up-to-date version of ossp-uuid)
brew unlink postgresql
brew install postgresql (this took about 4 minutes to execute)
bundle install
I hope this helps you out!

Error Installing ruby gem for PostgreSQL

I am trying to configure a rails server to use PostgreSQL, but getting stuck when installing the postgres gem. I have installed PostgreSQL successfully on the machine (and can use it for other applications) but am getting an error when attempting to install the ruby gem for it.
I do: sudo gem install postgres
And get the following output:
Building native extensions. This could take a while...
ERROR: Error installing postgres:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
checking for main() in -lpq... yes
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for PQsetClientEncoding()... no
checking for pg_encoding_to_char()... no
checking for PQfreemem()... no
checking for PQserverVersion()... no
checking for PQescapeString()... no
creating Makefile
make
gcc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I. -DHAVE_LIBPQ_FE_H -DHAVE_LIBPQ_LIBPQ_FS_H -I/Library/PostgreSQL/8.4/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common -c libpq-compat.c
libpq-compat.c: In function ‘PQescapeBytea’:
libpq-compat.c:104: warning: incompatible implicit declaration of built-in function ‘sprintf’
libpq-compat.c: In function ‘PQunescapeBytea’:
libpq-compat.c:158: warning: incompatible implicit declaration of built-in function ‘strlen’
libpq-compat.c: In function ‘PQescapeBytea’:
libpq-compat.c:104: warning: incompatible implicit declaration of built-in function ‘sprintf’
libpq-compat.c: In function ‘PQunescapeBytea’:
libpq-compat.c:158: warning: incompatible implicit declaration of built-in function ‘strlen’
gcc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I. -DHAVE_LIBPQ_FE_H -DHAVE_LIBPQ_LIBPQ_FS_H -I/Library/PostgreSQL/8.4/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common -c postgres.c
postgres.c:41: error: static declaration of ‘PQserverVersion’ follows non-static declaration
/Library/PostgreSQL/8.4/include/libpq-fe.h:289: error: previous declaration of ‘PQserverVersion’ was here
postgres.c: In function ‘Init_postgres’:
postgres.c:2676: error: ‘pgconn_protocol_version’ undeclared (first use in this function)
postgres.c:2676: error: (Each undeclared identifier is reported only once
postgres.c:2676: error: for each function it appears in.)
postgres.c:2677: error: ‘pgconn_server_version’ undeclared (first use in this function)
postgres.c:41: error: static declaration of ‘PQserverVersion’ follows non-static declaration
/Library/PostgreSQL/8.4/include/libpq-fe.h:289: error: previous declaration of ‘PQserverVersion’ was here
postgres.c: In function ‘Init_postgres’:
postgres.c:2676: error: ‘pgconn_protocol_version’ undeclared (first use in this function)
postgres.c:2676: error: (Each undeclared identifier is reported only once
postgres.c:2676: error: for each function it appears in.)
postgres.c:2677: error: ‘pgconn_server_version’ undeclared (first use in this function)
lipo: can't open input file: /var/tmp//ccpTMtE2.out (No such file or directory)
make: *** [postgres.o] Error 1
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/postgres-0.7.9.2008.01.28 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/postgres-0.7.9.2008.01.28/ext/gem_make.out
I am using Mac OS 10.6.4 and Postgres version 8.4.
And idea what could be happening here or how to fix it?
Looks like you're using the EnterpriseDB distribution of Posgres so you need to do this on Snow Leopard:
$ export ARCHFLAGS='-arch i386'
$ sudo gem install pg -- --with-pg-config=/Library/PostgreSQL/8.4/bin/pg_config

Resources