-
Notifications
You must be signed in to change notification settings - Fork 190
Description
Upgrading to v1.6.0 on Alpine Linux results in a runtime error when loading pg:
LoadError: cannot load such file -- pg_ext (LoadError)
...
Caused by:
LoadError: Error loading shared library libresolv.so.2: No such file or directory (needed by /usr/local/bundle/gems/pg-1.6.0-x86_64-linux/lib/3.3/../../ports/x86_64-linux/lib/libpq-ruby-pg.so.1) - /usr/local/bundle/gems/pg-1.6.0-x86_64-linux/lib/3.3/pg_ext.so (LoadError)
I believe this has been caused by the inclusion the binary gems in the latest release, and presumably these are build against glibc. Under 1.5.9 we were able to build these gems from source on Alpine Linux.
We were able to continue building from source by adding the force_ruby_platform to our Gemfile.
gem 'pg', force_ruby_platform: trueI'm not to familiar with how compiled gems work, but I think perhaps the platform specifier could be made more specific; by changing the currently build gem's platform from x86_64-linux to x86_64-linux-gnu.
It appears that while there is a CI action to test Alpine compatibility it installs the gcompat glibc compatibility layer, which I assume is why this wasn't noticed previously.
I suspect that, additionally, a binary gem could be built for the x86_64-linux-musl platform as it appears to compile and work correctly without the gcompat glibc compatibility layer.