ged / ruby-pg

A PostgreSQL client library for Ruby
Other
796 stars 181 forks source link

MacOS: libpq rpath doesn't work #405

Open larskanis opened 3 years ago

larskanis commented 3 years ago

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?

ged commented 3 years ago

Yeah, I can take a look at this.