unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Efraim Flashner <efraim@flashner.co.il>
To: Marc Chantreux <marc.chantreux@renater.fr>
Cc: 36973@debbugs.gnu.org
Subject: bug#36973: NativeCall doesn't work with rakudo ?
Date: Thu, 8 Aug 2019 12:31:51 +0300	[thread overview]
Message-ID: <20190808093151.GB5507@E2140> (raw)
In-Reply-To: <20190807153311.GA8932@prometheus.u-strasbg.fr>

[-- Attachment #1: Type: text/plain, Size: 8009 bytes --]

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   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

       reply	other threads:[~2019-08-08  9:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190807153311.GA8932@prometheus.u-strasbg.fr>
2019-08-08  9:31 ` Efraim Flashner [this message]
2019-08-08  9:43   ` bug#36973: NativeCall doesn't work with rakudo ? Efraim Flashner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190808093151.GB5507@E2140 \
    --to=efraim@flashner.co.il \
    --cc=36973@debbugs.gnu.org \
    --cc=marc.chantreux@renater.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).