extconf.rb should use pg_config --ldflags not --libdir

Issue #164 resolved
Jeff Blaine
created an issue

Currently extconf.rb constructs its own linker command-line options when using pg_config:

    libdir = `"#{pgconfig}" --libdir`.chomp

    if RbConfig::CONFIG["RPATHFLAG"].to_s.empty? && try_link('int main() {return 0;}', " -Wl,-rpath,#{libdir}")
        $LDFLAGS << " -Wl,-rpath,#{libdir}"

This means this gem is explicitly tied to an object linker that accepts those arguments instead of gathering the information from pg_config properly via pg_config --ldflags

I believe this to be an error and bug. You have a command-line option to query what LDFLAGS should be set to, but are instead constructing your own tight coupling between the linker and the gem.

In my case, compiling on Solaris 10 SPARC with the native linker, everything built fine once I changed extconf.rb as above.

Thanks for your thoughts and attention

Comments (4)

  1. Log in to comment