ruby-pg icon indicating copy to clipboard operation
ruby-pg copied to clipboard

MacOS: libpq rpath doesn't work

Open larskanis opened this issue 4 years ago • 1 comments

I noticed this in our CI on Github Actions.

If the libpq shared object is used from a non system location like in our CI: https://github.com/larskanis/ruby-pg/runs/3784028158?check_suite_focus=true#step:8:8000

... then it's explicit added as an rpath to the ld command: https://github.com/larskanis/ruby-pg/runs/3784028158?check_suite_focus=true#step:10:119

... but in the end this file isn't used but a libpq shared object from /usr/local/lib: https://github.com/larskanis/ruby-pg/runs/3784028158?check_suite_focus=true#step:11:20

I solved a very similar issue on Windows, which doesn't recognize an rpath setting in https://github.com/ged/ruby-pg/pull/373 . It sets the path to be used at load time at require 'pg'. Maybe this solution can be extended to also give the dynamic loader a hint which directory should be used.

This issue hasn't stood out before, since we didn't do Macos tests for a long time and when we did, the system library was good enough.

I don't have much knowledge about Macos. @ged , @cbandy Can you help?

larskanis avatar Oct 04 '21 15:10 larskanis

Yeah, I can take a look at this.

ged avatar Oct 04 '21 19:10 ged