zef icon indicating copy to clipboard operation
zef copied to clipboard

Relocatable Rakudo and zef

Open hankache opened this issue 6 years ago • 5 comments

On Windows 10:

  • Built Rakudo 2019.07.1 under C:\rakudo using: perl Configure.pl --backends=moar --gen-moar --moar-option="--cc=gcc" --moar-option="--make=gmake" --relocatable

  • Installed zef using: perl6.exe -I. bin\zef install .

  • Added both bin and share\perl6\site\bin to the PATH

  • Installed a bunch of modules e.g. LWP::Simple

  • All works perfectly

  • Moved rakudo folder to another location

  • Updated the PATH to reflect new location

  • zef uninstall LWP::Simple works

  • zef nuke LWP::Simple works

  • Deleted .zef folder from ~ just in case

  • zef install LWP::Simple fails with the following error, it seems it is still trying to look for modules under the previous directory.

===> Searching for: LWP::Simple
===> Updating cpan mirror: https://raw.githubusercontent.com/ugexe/Perl6-ecosystems/master/cpan1.json
===> Updating p6c mirror: https://raw.githubusercontent.com/ugexe/Perl6-ecosystems/master/p6c1.json
===> Updated p6c mirror: https://raw.githubusercontent.com/ugexe/Perl6-ecosystems/master/p6c1.json
===> Updated cpan mirror: https://raw.githubusercontent.com/ugexe/Perl6-ecosystems/master/cpan1.json
===> Testing: LWP::Simple:ver<0.106>:auth<github:perl6>
Failed to open file C:\rakudo\share\perl6\site\dist\BBA6CC2442CDDBD0FD7CC08C7F699CEAFBBA8D56: No such file or directory
  in sub dll-resource at C:\rakudo\share\perl6\site\sources\63A637A7B8F0082D7932DAAF4AD8E419FFC0DD91 (OpenSSL::NativeLib) line 32
  in sub gen-lib at C:\rakudo\share\perl6\site\sources\63A637A7B8F0082D7932DAAF4AD8E419FFC0DD91 (OpenSSL::NativeLib) line 10
  in sub guess_library_name at C:\Users\Naoum\Desktop\rakudo\share\perl6\core\sources\947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B (NativeCall) line 217
  in method setup at C:\Users\Naoum\Desktop\rakudo\share\perl6\core\sources\947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B (NativeCall) line 279
  in method CALL-ME at C:\Users\Naoum\Desktop\rakudo\share\perl6\core\sources\947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B (NativeCall) line 576
  in method new at C:\Users\Naoum\Desktop\rakudo\share\perl6\site\sources\018B553E2A2E3D877302BB1DEE4B896BC4B4655C (OpenSSL) line 36
  in method initialize at C:\Users\Naoum\Desktop\rakudo\share\perl6\site\sources\4F548318B01C8DF341C8829795EAE9515CB8839F (IO::Socket::SSL) line 67
  in method new at C:\Users\Naoum\Desktop\rakudo\share\perl6\site\sources\4F548318B01C8DF341C8829795EAE9515CB8839F (IO::Socket::SSL) line 58
  in method make_request at C:\Users\naoum\.zef\store\perl6-lwp-simple.git\eb48ab98b3422b40cd0def8faa882abb9184c265\lib\LWP\Simple.pm (LWP::Simple) line 242
  in method request_shell at C:\Users\naoum\.zef\store\perl6-lwp-simple.git\eb48ab98b3422b40cd0def8faa882abb9184c265\lib\LWP\Simple.pm (LWP::Simple) line 84
  in method get at C:\Users\naoum\.zef\store\perl6-lwp-simple.git\eb48ab98b3422b40cd0def8faa882abb9184c265\lib\LWP\Simple.pm (LWP::Simple) line 32
  in method getstore at C:\Users\naoum\.zef\store\perl6-lwp-simple.git\eb48ab98b3422b40cd0def8faa882abb9184c265\lib\LWP\Simple.pm (LWP::Simple) line 354
  in sub getstore-tests at t/getstore.t line 30
  in block <unit> at t/getstore.t line 24

# You planned 10 tests, but ran 5
# Failed test 'can retrieve http://github.com/'
# at t/issue-7.t line 21
# Failed to open file C:\rakudo\share\perl6\site\dist\BBA6CC2442CDDBD0FD7CC08C7F699CEAFBBA8D56: No such file or directory
# You failed 1 test of 1
===> Testing [FAIL]: LWP::Simple:ver<0.106>:auth<github:perl6>
Aborting due to test failure: LWP::Simple:ver<0.106>:auth<github:perl6> (use --force-test to override)

hankache avatar Oct 13 '19 12:10 hankache

PS: This might not be related to zef but it would be great if you can point us in the right direction. The purpose of this exercise is to create a relocatable Rakudo + Zef + Modules (Rakudo Star) on Windows so that users would be able to install anywhere not only on C:\rakudo

PS2: After running zef uninstall OpenSSL and zef install OpenSSL, zef install LWP::Simple works. It feels weird since none of them depends on the other!

hankache avatar Oct 13 '19 13:10 hankache

What do you mean none of them depend on each other? The stack trace quite clearly implicates OpenSSL::NativeLib::dll-resource. And while I don't know why exactly it doesn' work, I can't say I'm surprised to find a compile time variable confused after relocating things it originally referred to

ugexe avatar Oct 13 '19 13:10 ugexe

@ugexe What I mean is that based on https://github.com/perl6/perl6-lwp-simple/blob/master/META6.json I don't see any dependency on OpenSSL. That being said I noticed that one test of LWP::Simple requires IO::Socket::SSL which depends on OpenSSL: https://github.com/perl6/perl6-lwp-simple/blob/eb48ab98b3422b40cd0def8faa882abb9184c265/t/getstore.t#L17

hankache avatar Oct 13 '19 13:10 hankache

If I understand correctly, you mean to say that OpenSSL::NativeLib::dll-resource still points to the old location? Where should this be reported, here or in https://github.com/rakudo/rakudo. Or should it not be reported at all and this is how things work? Thanks

hankache avatar Oct 13 '19 13:10 hankache

You could add debug output to the gen-lib -- https://github.com/sergot/openssl/blob/edf86b6dbc7ba6dfc44cdc7e4dd853fc6ca189cb/lib/OpenSSL/NativeLib.pm6#L9-L13 to get a better idea.

What OpenSSL is doing with &gen-lib/resources is a hack, but I don't think it is at fault. The error C:\rakudo\share\perl6\site\dist\BBA6CC2442CDDBD0FD7CC08C7F699CEAFBBA8D56: No such file or directory also doesn't make sense to me given the backtrace (I would have expected ...\site\resources\... not ...\site\dist\...)

ugexe avatar Oct 13 '19 13:10 ugexe