如何将 ruby pg 链接到我自己的 libpq.so
我定制了自己的 postgresql 客户端和 postgresql 客户端开发包,我希望 Ruby 程序员可以使用它。所以安装 ruby pg gem 的命令如下:
gem install pg -- --with-pg-config=/usr/local/mypostgres-1.0/bin/pg_config --with-ldflags="-Wl,-rpath,/usr/local/mypostgres-1.0/lib"
如果只安装了我自己的 postgresql,该命令效果很好。
我的 pg_config 输出看起来不错:
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 = /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
但是,如果同时安装了官方和我定制的 postgresql。安装的驱动程序将链接到官方 libpq.so 而不是我自己的 libpq.so。 有什么方法可以强制 ruby-pg 链接到我自己的 libpq.so 吗?任何线索或提示将不胜感激。
如果我不能以这种方式做到这一点,我将如何自定义 gem 以链接到我的库?
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 = /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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论