Skip to content

Can't open linker script files #107

@nevans

Description

@nevans

On my Ubuntu 21.10 installation, several shared libraries .so files are installed as linker scripts instead of using a symlink. In my research, I see that this is done (or has been done) in Debian, CentOS, Fedora, RHEL, Gentoo, and maybe Arch (I didn't personally verify the last two). This shouldn't a big deal if you link with GNU ld, but it breaks dlopen.

I found workarounds in the ffi gem and in ghc, and perhaps one of those could be copied into fiddle.

A workaround for users of fiddle might be to attempt to load a specific version of the library:

irb(main):005:0> File.read "/lib/x86_64-linux-gnu/libncurses.so"
=> "INPUT(libncurses.so.6 -ltinfo)\n"
irb(main):006:0> Fiddle::Handle.new("libncurses.so")
(irb):6:in `initialize': /lib/x86_64-linux-gnu/libncurses.so: file too short (Fiddle::DLError)
	from (irb):6:in `new'                              
	from (irb):6:in `<main>'                           
	from /home/nick/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/irb-1.4.1/exe/irb:11:in `<top (required)>'
	from /home/nick/.rbenv/versions/3.1.1/bin/irb:25:in `load'
	from /home/nick/.rbenv/versions/3.1.1/bin/irb:25:in `<main>'
irb(main):007:0> Fiddle::Handle.new("libncurses.so.6")
=> #<Fiddle::Handle:0x00007fcfbb858670>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions