How to link ruby pg to my own libpq.so
I have customized my own postgresql client and postgresql client-devel package and I want it to be available to Ruby programmer. So the command to install ruby pg gem is as below:
gem install pg -- --with-pg-config=/usr/local/mypostgres-1.0/bin/pg_config --with-ldflags="-Wl,-rpath,/usr/local/mypostgres-1.0/lib"
The command works pretty good if there is only my own postgresql installed.
My pg_config output looks good:
BINDIR = /usr/local/mypostgres-1.0/bin
DOCDIR = /usr/local/mypostgres-1.0/doc
HTMLDIR = /usr/local/mypostgres-1.0/doc
INCLUDEDIR = /usr/local/mypostgres-1.0/include
PKGINCLUDEDIR = /usr/local/mypostgres-1.0/include
INCLUDEDIR-SERVER = /usr/local/mypostgres-1.0/include/server
LIBDIR = /usr/local/mypostgres-1.0/lib
PKGLIBDIR开发者_StackOverflow = /usr/local/mypostgres-1.0/lib
LOCALEDIR = /usr/local/mypostgres-1.0/share/locale
MANDIR = /usr/local/mypostgres-1.0/man
SHAREDIR = /usr/local/mypostgres-1.0/share
SYSCONFDIR = /usr/local/mypostgres-1.0/etc
PGXS = /usr/local/mypostgres-1.0/lib/pgxs/src/makefiles/pgxs.mk
VERSION = PostgreSQL 9.0.0
However, if there are both official and my customized postgresql installed. The installed driver will be linked against official libpq.so instead of my own libpq.so. Is there any way to force ruby-pg to be linked against my own libpq.so? Any clue or hint will be appreciated.
If I can't do this in this way, how would I customize the gem to link to my library?
精彩评论