Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the library path of libpq available in ruby and add it to the DLL search paths on Windows which lacks rpath. #373

Merged
merged 2 commits into from
Mar 29, 2021

Commits on Mar 19, 2021

  1. Make the library path of libpq available in ruby

    ... and add it to the search paths on Windows which lacks rpath.
    
    In ELF based systems the libpq path is stored as rpath in pg_ext.so, so that libpq is found, even if it's not in the library search paths.
    
    On Windows however the rpath mechanism doesn't work and the search path for libpq must be added manually.
    This is done per RubyInstaller::Runtime.add_dll_directory.
    
    The libpq path is available in extconf.rb while build only (while gem install), so that we have to pass the string to lib/pg.rb where pg_ext.so is loaded (while require 'pg').
    This is a bit tricky, since pg_ext.so is linked to libpq, so that the library search path has to be set first, prior to loading pg_ext.so.
    Therefore a second file is needed bypassing pg_ext.so.
    That is postgresql_lib_path.rb and it is passed by mkmf's $INSTALLFILES mechanism.
    
    There's an issue with rake-compiler, which (in contrast to gem install) doesn't copy postgresql_lib_path.rb.
    This has to be addressed separatelly.
    
    Another approach would be to add a second extension file, but that is more complicated.
    
    Fixes ged#365
    larskanis committed Mar 19, 2021
    Configuration menu
    Copy the full SHA
    f6ccdae View commit details
    Browse the repository at this point in the history
  2. Add patch to rake-compiler-1.1.1 for make install

    With this patch rake-compiler executes not just "make" but also "make install" the same way as "gem install" does.
    That way postgresql_lib_path.rb is copied into the lib folder as expected.
    larskanis committed Mar 19, 2021
    Configuration menu
    Copy the full SHA
    2f6ab32 View commit details
    Browse the repository at this point in the history