bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#36973: NativeCall doesn't work with rakudo ?


From: Efraim Flashner
Subject: bug#36973: NativeCall doesn't work with rakudo ?
Date: Thu, 8 Aug 2019 12:31:51 +0300
User-agent: Mutt/1.12.1 (2019-06-15)

On Wed, Aug 07, 2019 at 05:33:11PM +0200, Marc Chantreux wrote:
> hello,
> 
> i don't know if it's ok to report directly to the author, please excuse
> me if it's not.

It's definately not my first choice but I'm far more likely to respond
to it than if you had just sent it to bug-guix or one of the other
mailing lists :)

I'm going to inline my notes

> 
> i installed the rakudo thru guix over a debian buster.

(guix package -i rakudo)
provides the 'perl6' binary and $GUIX_PROFILE/share/perl6 directory

> 
> AFAIR, i just installed
> 
>   guix install perl6-zef sdl2
> 
> in my ~/.zshenv, i have
> 
>   export GUIX_PROFILE=~/.guix-profile
>   source $GUIX_PROFILE/etc/profile
>   path+=~/.guix-profile/bin
>   perl6lib+=( /home/mc/.guix-profile/share/perl6/lib(N) )
> 
> then i "successfully" installed SDL2 with
> 
>   zef install SDL2::Raw
> 
> i copied the example from this homepage (as attachement).
> 
> https://modules.perl6.org/dist/SDL2::Raw:cpan:TIMOTIMO

and saved it as sdl.p6

> 
> i have
> 
>   locate -e libSDL2.so
> /gnu/store/gyfg2rhnrny9z9gg6hwzjm13dpclr3v2-sdl2-2.0.9/lib/libSDL2.so
> /usr/lib/x86_64-linux-gnu/libSDL2.so
> 
> but if i run (inside or outside a guix environment)

(guix environment --ad-hoc rakudo perl6-zef sdl2 -- 'zef install \
    SDL2::Raw && perl6 sdl.p6')

> 
>   $GUIX_PROFILE/bin/perl6 sdl.p6
> 
> i get
> 
>   Cannot locate native library 'libSDL2.so': libSDL2.so: cannot open shared 
> object file: No such file or directory
>   in method setup at 
> /gnu/store/in3wgq5mwwc6pqad92zzsay3ri86p6sn-rakudo-2019.03.1/share/perl6/sources/947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B
>  (NativeCall) line 287
>   in method CALL-ME at 
> /gnu/store/in3wgq5mwwc6pqad92zzsay3ri86p6sn-rakudo-2019.03.1/share/perl6/sources/947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B
>  (NativeCall) line 576
>   in block <unit> at sdl.p6 line 3
> 

I can confirm this, the is the same output that I got.

efraim@bayfront ~$ find .perl6/ -name 
'*947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B*'
.perl6/precomp/A7BEF869F222B0D8D2C76EF47E1D0480FFD6EA2C/94/947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B.repo-id

> i tested other Nativecall libs like sqlite and have the same problem.
> 
> thanks for any help you can provide to fix it.
> 
> regards
> marc

First of all I want to thank you for your report. (and I mean this
seriously.) I packaged perl6 and rakudo (and a bunch of libraries working
toward rakudo-star) after seeing a presentation at FOSDEM and I was
curious. Unfortunately I have never used perl6 and we didn't have anyone
who really knew much about it, so I used building packages successively
as a test to see if everything seemed to work.

Sometimes in Guix we end up with problems where everything works well in
the build system, but binaries such as pip (the first one I can think
of, although probably not pip) end up not working when used as a stand
alone language package manager.

From reading through some back and forth from some Debian Developers and
some perl6/rakudo people, I got the impression that there were a couple
of different ways distro maintainers could distribute perl6 libraries.
One way is the way I went, which is to, for each library, precompile it
and then to mush (...join) them all together on the users machine, and
this is what I went with. The other way was to distribute source, and at
install time to recompile all the installed modules together so they'd
all be in the target directory. This we can accomplish with profile
hooks, and wouldn't be too bad, but I wanted to offload the building of
the libraries and not have a time intensive profile hook to finally
compile all the code.

All this is nice, but it doesn't actually address the error above, which
is that 'zef' apparently only knows to look for sources in
/gnu/store/...-rakudo-../share/perl6/sources. It should at the very
least be taught about profiles, and it would be nice to teach it about
$HOME/.perl6 as well.

In the interest of testing if making SDL2::Raw a guix package would
help, I packaged it in a file (attached) and ran:
guix package -f perl6-sdl2-raw.scm -i perl6-zef sdl2 rakudo
cleared my $HOME/.perl6 folder and then re-ran
perl6 sdl.p6

efraim@bayfront ~$ perl6 sdl.p6
===SORRY!===
Could not find SDL2::Raw at line 1 in:
    inst#/home/efraim/.perl6
    
inst#/gnu/store/in3wgq5mwwc6pqad92zzsay3ri86p6sn-rakudo-2019.03.1/share/perl6/site
    
inst#/gnu/store/in3wgq5mwwc6pqad92zzsay3ri86p6sn-rakudo-2019.03.1/share/perl6/vendor
    
inst#/gnu/store/in3wgq5mwwc6pqad92zzsay3ri86p6sn-rakudo-2019.03.1/share/perl6
    ap#
    nqp#
    perl5#

(this I believe is a separate issue, that perl6 doesn't know about our
current environment)

I then tried 'zef install SDL2::Raw' and re-ran 'perl6 sdl.p6'
same error as above:
efraim@bayfront ~$ perl6 sdl.p6
Cannot locate native library 'libSDL2.so': libSDL2.so: cannot open shared 
object file: No such file or directory
  in method setup at 
/gnu/store/in3wgq5mwwc6pqad92zzsay3ri86p6sn-rakudo-2019.03.1/share/perl6/sources/947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B
 (NativeCall) line 287
  in method CALL-ME at 
/gnu/store/in3wgq5mwwc6pqad92zzsay3ri86p6sn-rakudo-2019.03.1/share/perl6/sources/947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B
 (NativeCall) line 576
  in block <unit> at sdl.p6 line 3

So here I'm a bit stumped. The resource 947... exists, in
/gnu/store/...perl6-sdl2-raw-0.3/share/perl6/precomp and not in sources,
and perl6 is only searching in rakudo/share/perl6 it seems.

For another test, I copied my perl6-sdl2-raw package definition into the
Guix source tree and ran
./pre-inst-env guix environment --ad-hoc rakudo perl6-zef perl6-sdl2-raw sdl2

cleared my $HOME/.perl6 folder and re-ran 'perl6 sdl.p6'

efraim@bayfront ~ [env]$ perl6 sdl.p6
Use of uninitialized value of type Any in string context.
Methods .^name, .perl, .gist, or .say can be used to stringify it to something 
meaningful.
  in any statement_control at 
/gnu/store/in3wgq5mwwc6pqad92zzsay3ri86p6sn-rakudo-2019.03.1/share/nqp/lib/Perl6/Grammar.moarvm
 line 1
Use of uninitialized value of type Any in string context.
Methods .^name, .perl, .gist, or .say can be used to stringify it to something 
meaningful.
  in any statement_control at 
/gnu/store/in3wgq5mwwc6pqad92zzsay3ri86p6sn-rakudo-2019.03.1/share/nqp/lib/Perl6/Grammar.moarvm
 line 1
===SORRY!===
Cannot resolve caller new(IO::Path:U: Any:U, :CWD(Str)); none of these 
signatures match:
    (IO::Path: Str $path, :$SPEC = { ... }, Str:D :$CWD, *%_)
    (IO::Path: Str $path, :$SPEC = { ... }, :$CWD = { ... }, *%_)
    (IO::Path: Cool $path, :$SPEC = { ... }, :$CWD = { ... }, *%_)
    (IO::Path: :$basename!, :$dirname = "", :$volume = "", :$SPEC = { ... }, 
:$CWD = { ... }, *%_)
    (IO::Path: *%_)

I'm guessing that this is either some mistake on the code that's in the
file, or that there's no display from bayfront being passed back to my
computer.

I've gone ahead and tested on a Debian box that I have (aarch64, Debian
Sid, rakudo 2018.12-5, zef 0.6.2-2)
sudo apt install rakudo perl6-zef libsdl2-dev
zef install SDL2::Raw
perl6 sdl.p6

efraim@pine64:~$ perl6 sdl.p6 dl.p6
couldn't initialize SDL2: No available video device
  in block <unit> at sdl.p6 line 3

it seems 'ssh pine64 -Y' wasn't enough. It does, however, mean that
Debian's perl6/zef looks to be working well, and the code example from
the website checks out.


It looks like the short version is:
zef in guix doesn't install runnable software, probably a problem with
our copy of rakudo
everything works as expected in Debian
installing perl6 packages from the guix repo works
'guix package -f perl6-package -i rakudo' doesn't work as expected

-- 
Efraim Flashner   <address@hidden>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]