Skip to content

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

@ged

Description

@ged

Original report by Jeff Blaine (Bitbucket: jblaine, GitHub: jblaine).


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

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

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

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions