如何将 ruby​​ pg 链接到我自己的 libpq.so

发布于 2024-10-21 02:12:26 字数 1160 浏览 1 评论 0原文

我定制了自己的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文