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

Can't open linker script files #107

Closed
nevans opened this issue Apr 6, 2022 · 4 comments
Closed

Can't open linker script files #107

nevans opened this issue Apr 6, 2022 · 4 comments

Comments

@nevans
Copy link

nevans commented Apr 6, 2022

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>
@nevans nevans closed this as completed Apr 6, 2022
@chrisseaton
Copy link
Contributor

Hi what are you struggling to open?

@nevans nevans changed the title Can't open Can't open linker script files Apr 6, 2022
@nevans
Copy link
Author

nevans commented Apr 6, 2022

I'm so sorry, I accidentally hit enter when I'd only just started creating the ticket! I was hoping I'd be able to fill in the details before anyone noticed. Anyway, I've updated the subject and I'll send a few other details over in a minute.

@nevans nevans reopened this Apr 6, 2022
nevans added a commit to nevans/reline that referenced this issue Apr 6, 2022
This maybe isn't probably isn't the best approach, but it will allow
`Fiddle::Terminfo.curses_dl` to work.  I documented more details about
this in an issue on fiddle: ruby/fiddle#107

It is probably better to deal with it there.  But this is workaround is
simpler.

FYI: `reline` itself seems to be working just fine for me _without_
loading ncurses.  But I wanted to be able to use `Reline::Terminfo` for
my own projects. :)
@kou kou closed this as completed in 49ea149 Apr 10, 2022
@kou
Copy link
Member

kou commented Apr 10, 2022

Thanks for your report.
I didn't know about linker script.

I've added support for linker script only on Linux for now.

@nevans
Copy link
Author

nevans commented Apr 13, 2022

Excellent, thanks!

matzbot pushed a commit to ruby/ruby that referenced this issue May 24, 2022
This maybe isn't probably isn't the best approach, but it will allow
`Fiddle::Terminfo.curses_dl` to work.  I documented more details about
this in an issue on fiddle: ruby/fiddle#107

It is probably better to deal with it there.  But this is workaround is
simpler.

FYI: `reline` itself seems to be working just fine for me _without_
loading ncurses.  But I wanted to be able to use `Reline::Terminfo` for
my own projects. :)

ruby/reline@fd4bdb35e2
schneems pushed a commit to schneems/ruby that referenced this issue Jul 26, 2022
This maybe isn't probably isn't the best approach, but it will allow
`Fiddle::Terminfo.curses_dl` to work.  I documented more details about
this in an issue on fiddle: ruby/fiddle#107

It is probably better to deal with it there.  But this is workaround is
simpler.

FYI: `reline` itself seems to be working just fine for me _without_
loading ncurses.  But I wanted to be able to use `Reline::Terminfo` for
my own projects. :)

ruby/reline@fd4bdb35e2
nobu pushed a commit to nobu/ruby that referenced this issue Oct 18, 2022
nobu pushed a commit to ruby/ruby that referenced this issue Oct 18, 2022
tenderlove pushed a commit to Shopify/ruby that referenced this issue Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants