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

Module is broken with Readline 7.0 #12

Closed
samcv opened this issue Nov 14, 2016 · 4 comments
Closed

Module is broken with Readline 7.0 #12

samcv opened this issue Nov 14, 2016 · 4 comments

Comments

@samcv
Copy link
Contributor

samcv commented Nov 14, 2016

https://lists.gnu.org/archive/html/info-gnu/2016-09/msg00009.html
Readline 7.0 has been out almost a month, and it will be out of Arch's testing repository in a day or two.
Here is the error:

Cannot locate native library 'libreadline.so.6': libreadline.so.6: cannot open shared object file: No such file or directory
  in method setup at /home/user/rakudo/install/share/perl6/sources/24DD121B5B4774C04A7084827BFAD92199756E03 (NativeCall) line 310
  in method CALL-ME at /home/user/rakudo/install/share/perl6/sources/24DD121B5B4774C04A7084827BFAD92199756E03 (NativeCall) line 322
  in method make-bare-keymap at /home/samantha/panda/.panda-work/1479105484_2/lib/Readline.pm (Readline) line 1040
  in sub  at t/02-base.t line 162
  in sub subtest at /home/user/rakudo/install/share/perl6/sources/C712FE6969F786C9380D643DF17E85D06868219E (Test) line 364
  in sub  at t/02-base.t line 161
  in sub subtest at /home/user/rakudo/install/share/perl6/sources/C712FE6969F786C9380D643DF17E85D06868219E (Test) line 364
  in block <unit> at t/02-base.t line 155
@samcv
Copy link
Contributor Author

samcv commented Nov 19, 2016

For anybody landing here:
Change this line: https://github.com/drforr/perl6-readline/blob/master/lib/Readline.pm#L657

And remove the version. So the line becomes: my constant LIB = ( 'readline' );

Disclaimer: could have some differences because of differences between Readline 6 and 7, but if you only have Readline 7 available this should work, and not error out.

@cono
Copy link

cono commented Aug 17, 2017

Well, actually this is not proper way to handle this.
Because libreadline.so is not proper SONAME and dlopen by opening libreadline.so file fails on some systems:

# Failed test 'initialize'
# at t/02-base.t line 11
# Cannot locate native library 'libreadline.so': /usr/lib64/libreadline.so: invalid ELF header
    not ok 1 - macro-dumper lives

Due to the file libreadline.so is not a shared object, its an LD script:

% cat /usr/lib64/libreadline.so 
/* GNU ld script
   Since Gentoo has critical dynamic libraries in /lib, and the static versions
   in /usr/lib, we need to have a "fake" dynamic lib in /usr/lib, otherwise we
   run into linking problems.  This "fake" dynamic lib is a linker script that
   redirects the linker to the real lib.  And yes, this works in the cross-
   compiling scenario as the sysroot-ed linker will prepend the real path.

   See bug https://bugs.gentoo.org/4411 for more info.
 */
OUTPUT_FORMAT ( elf64-x86-64 )
GROUP ( /lib64/libreadline.so.6 )

Proper way would be to make a factory which provides unified interface to different libreadline version and handle different version differently. And use proper SONAME:

% objdump -x /lib64/libreadline.so.6 | grep SONAME
  SONAME               libreadline.so.6

Detailed explanation here:
https://bugs.gentoo.org/show_bug.cgi?id=290974

@nxadm
Copy link

nxadm commented May 10, 2018

@samcv

In my case (Ubuntu 18.04 amd64), the fix was the reverse as there is no unversioned .so in Ubuntu 18.04:

$ ls -la /lib/x86_64-linux-gnu/libreadline*
lrwxrwxrwx 1 root root     18 feb  7  2016 /lib/x86_64-linux-gnu/libreadline.so.5 -> libreadline.so.5.2
-rw-r--r-- 1 root root 249144 feb  7  2016 /lib/x86_64-linux-gnu/libreadline.so.5.2
lrwxrwxrwx 1 root root     18 mei 15  2017 /lib/x86_64-linux-gnu/libreadline.so.7 -> libreadline.so.7.0
-rw-r--r-- 1 root root 294632 mei 15  2017 /lib/x86_64-linux-gnu/libreadline.so.7.0

To fix the Readline module, in https://github.com/drforr/perl6-readline/blob/master/lib/Readline.pm#L657 change:
from my constant LIB = ( 'readline' );
to my constant LIB = ( 'readline', v7 );

@drforr
Copy link
Owner

drforr commented Jul 11, 2018

Long time to leave this open, I know. Closing because the Perl library now looks in /lib/x86_64-linux-gnu for installed library versions and picks the highest version it can find. I'll eventually add a way to choose the exact library via environment or something.

@drforr drforr closed this as completed Jul 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants