all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#36973: NativeCall doesn't work with rakudo ?
       [not found] <20190807153311.GA8932@prometheus.u-strasbg.fr>
@ 2019-08-08  9:31 ` Efraim Flashner
  2019-08-08  9:43   ` Efraim Flashner
  0 siblings, 1 reply; 2+ messages in thread
From: Efraim Flashner @ 2019-08-08  9:31 UTC (permalink / raw)
  To: Marc Chantreux; +Cc: 36973

[-- 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 --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#36973: NativeCall doesn't work with rakudo ?
  2019-08-08  9:31 ` bug#36973: NativeCall doesn't work with rakudo ? Efraim Flashner
@ 2019-08-08  9:43   ` Efraim Flashner
  0 siblings, 0 replies; 2+ messages in thread
From: Efraim Flashner @ 2019-08-08  9:43 UTC (permalink / raw)
  To: 36973


[-- Attachment #1.1: Type: text/plain, Size: 241 bytes --]

forgot the two attachments

-- 
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 #1.2: sdl.p6 --]
[-- Type: text/plain, Size: 863 bytes --]

use SDL2::Raw;

die "couldn't initialize SDL2: { SDL_GetError }"
if SDL_Init(VIDEO) != 0;

my $window = SDL_CreateWindow(
    "Hello, world!",
    SDL_WINDOWPOS_CENTERED_MASK, SDL_WINDOWPOS_CENTERED_MASK,
    800, 600,
    OPENGL
);
my $render = SDL_CreateRenderer($window, -1, ACCELERATED +| PRESENTVSYNC);

my $event = SDL_Event.new;

main: loop {
    SDL_SetRenderDrawColor($render, 0, 0, 0, 0);
    SDL_RenderClear($render);

    while SDL_PollEvent($event) {
        if $event.type == QUIT {
            last main;
        }
    }

    SDL_SetRenderDrawColor($render, 255, 255, 255, 255);
    SDL_RenderFillRect($render,
    SDL_Rect.new(
        2 * min(now * 300 % 800, -now * 300 % 800),
        2 * min(now * 470 % 600, -now * 470 % 600),
        sin(3 * now) * 50 + 80, cos(4 * now) * 50 + 60));

        SDL_RenderPresent($render);
    }
    SDL_Quit;

[-- Attachment #1.3: perl6-sdl2-raw.scm --]
[-- Type: text/plain, Size: 913 bytes --]

(define-module (perl6-sdl2-raw)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix git-download)
  #:use-module (guix build-system rakudo)
  #:use-module (gnu packages perl6))

(define-public perl6-sdl2-raw
  (package
    (name "perl6-sdl2-raw")
    (version "0.3")
    (source
      (origin
        (method git-fetch)
        (uri (git-reference
               (url "https://github.com/timo/SDL2_Raw-p6.git")
               (commit version)))
        (file-name (git-file-name name version))
        (sha256
         (base32
          "1h9g76bdps5aw14s6yxgnjfys9269vxiiq8728nrv8ccfynz64j3"))))
    (build-system rakudo-build-system)
    (home-page "https://github.com/timo/SDL2_Raw-p6")
    (synopsis "Sugar-free NativeCall binding for libSDL2")
    (description "Sugar-free NativeCall binding for libSDL2")
    (license license:artistic2.0)))

perl6-sdl2-raw

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-08-08  9:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20190807153311.GA8932@prometheus.u-strasbg.fr>
2019-08-08  9:31 ` bug#36973: NativeCall doesn't work with rakudo ? Efraim Flashner
2019-08-08  9:43   ` Efraim Flashner

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.