Original report by Edho Arief (Bitbucket: nanayapro, ).
When postgresql is installed on non-standard location (say, /opt/PostgreSQL/9.2), the compile finished without error but raises error when used:
libpq.so.5: cannot open shared object file: No such file or directory (LoadError)
One of the solution I tested to work is by adding
$LDFLAGS << " -Wl,-R%s" % [ `"#{pgconfig}" --libdir`.chomp ]
to the extconf.rb in addition to -I and -L in pgconfig test.
I'm not sure if it's the correct fix (and whether it works with non gcc/linux system).