pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Extension rpath issues on MacOS
3+ messages / 2 participants
[nested] [flat]

* Extension rpath issues on MacOS
@ 2022-09-16 21:06  Christophe Pettus <xof@thebuild.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Christophe Pettus @ 2022-09-16 21:06 UTC (permalink / raw)
  To: pgsql-general list <pgsql-general@lists.postgresql.org>

I'm attempting to build the pgspider JDBC foreign data wrapper on MacOS, and not having an enormously successful time.  The driver source is at:

	https://github.com/pgspider/jdbc_fdw

It (unsurprisingly) needs to link with libjvm.dylib, so I've included the path to it in the PostgreSQL ./configure LDFLAGS.  (It's being built outside of contrib/ using PGXS.)  It compiles and installs successfully, but can't find libjvm at runtime:

j=# create extension jdbc_fdw;
ERROR:  could not load library "/usr/local/pgsql/lib/jdbc_fdw.so": dlopen(/usr/local/pgsql/lib/jdbc_fdw.so, 10): Library not loaded: @rpath/libjvm.dylib
  Referenced from: /usr/local/pgsql/lib/jdbc_fdw.so
  Reason: image not found

That's not a big surprise, because the .so uses @rpath in its path to libjvm:

$ otool -L /usr/local/pgsql/lib/jdbc_fdw.so
/usr/local/pgsql/lib/jdbc_fdw.so:
	/usr/local/pgsql/lib/libpq.5.dylib (compatibility version 5.0.0, current version 5.14.0)
	@rpath/libjvm.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.100.1)

I could patch it with `install_name_tool`, but I'd like to keep the Makefile intact and non-MacOS-specific.  Ideally, I'd like it use an absolute path there.

Has anyone encountered this situation (not libjvm in particular, just an external library using @rpath) during an extension build?




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Extension rpath issues on MacOS
@ 2022-09-16 21:20  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Christophe Pettus <xof@thebuild.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2022-09-16 21:20 UTC (permalink / raw)
  To: Christophe Pettus <xof@thebuild.com>; +Cc: pgsql-general list <pgsql-general@lists.postgresql.org>

Christophe Pettus <xof@thebuild.com> writes:
> Has anyone encountered this situation (not libjvm in particular, just an external library using @rpath) during an extension build?

Yeah ... IIRC, I've hit that from trying to use the Apple-supplied
libpython to underlie PL/Python.  I've not found a workaround.  I suspect
that Apple doesn't want people using these OS components from "outside",
and this is something they're intentionally doing to prevent it.

IOW: I think they want you to get that from macports or homebrew instead.
It certainly works a lot easier if you do.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Extension rpath issues on MacOS
@ 2022-09-16 21:23  Christophe Pettus <xof@thebuild.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Christophe Pettus @ 2022-09-16 21:23 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-general list <pgsql-general@lists.postgresql.org>



> On Sep 16, 2022, at 14:20, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> IOW: I think they want you to get that from macports or homebrew instead.
> It certainly works a lot easier if you do.

Yeah, I installed openjdk8 using MacPorts, but it puts its stuff in a rather idiosyncratic location.  I guess it's "create-a-symlink" time.  Thank you!




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2022-09-16 21:23 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-09-16 21:06 Extension rpath issues on MacOS Christophe Pettus <xof@thebuild.com>
2022-09-16 21:20 ` Tom Lane <tgl@sss.pgh.pa.us>
2022-09-16 21:23   ` Christophe Pettus <xof@thebuild.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox