Closed bbrtj closed 1 year ago
I can reproduce with for example MooseX::XSConstructor, MooX::XSAccessor
These two modules do not exist on CPAN, perhaps typos?
I did the guess work and tried it with MooseX::XSAccessor, and it seems to work fine:
➜ cat cpanfile
requires 'MooseX::XSAccessor';
➜ carmel install
Using MooseX::XSAccessor (0.009)
Using Class::XSAccessor (1.19)
Using Moose (2.2201)
Using Class::Load (0.25)
Using Data::OptList (0.112)
Using List::Util (1.63)
Using Params::Util (1.102)
Using Sub::Install (0.928)
Using Module::Implementation (0.09)
Using Module::Runtime (0.016)
Using Module::Build (0.4231)
Using Try::Tiny (0.31)
Using Package::Stash (0.40)
Using Dist::CheckConflicts (0.11)
Using Package::Stash::XS (0.30)
Using Class::Load::XS (0.10)
Using Devel::GlobalDestruction (0.14)
Using Sub::Exporter::Progressive (0.001013)
Using Devel::OverloadInfo (0.007)
Using MRO::Compat (0.15)
Using Devel::StackTrace (2.04)
Using Eval::Closure (0.14)
Using Module::Runtime::Conflicts (0.003)
Using Package::DeprecationManager (0.17)
Using Sub::Name (0.26)
Using Sub::Exporter (0.988)
---> Complete! 1 cpanfile dependencies. 26 modules installed.
➜ carmel exec perl -e 'use MooseX::XSAccessor (); warn MooseX::XSAccessor->VERSION'
0.009 at -e line 1.
I wonder if you have some environment variables that's affecting where to load the arch-dependent modules from.
Sorry, I got the names mixed up. It's MooX::XSConstructor and MooseX::XSAccessor
my env is rather simple:
$ printenv
MAIL=/var/mail/devenv
PATH=/root/perl5/perlbrew/perls/perl-5.36.0/bin:/root/perl5/perlbrew/bin:/root/.rakubrew/bin:/root/.rakubrew/versions/moar-2022.04/install/bin:/root/.rakubrew/repos/zef/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/home/devenv/bin
OLDPWD=/usr/home/devenv
PWD=/home/devenv/prj/tests
TERM=screen-256color
HOME=/home/devenv
USER=devenv
SHELL=/bin/sh
BLOCKSIZE=K
$
looking at your error output here, the list of paths doesn't include CryptX artifacts.
Did you add the line requires "CryptX";
to your cpanfile, then run carmel install
? Every time you add or change a dependency, you have to modify these lines in cpanfile
and run carmel install
; that's how Carmel maintains the state of your dependencies in the .snapshot
file.
Please upload the entire cpanfile
,cpanfile.snapshot
and .carmel/MySetup.pm
if that doesn't resolve the issue.
My .carmel/MySetup.pm
looks like this after adding requires "MooX::XSConstructor";
to cpanfile, and running carmel install
:
➜ head -30 .carmel/MySetup.pm
# DO NOT EDIT! Auto-generated via carmel install.
package Carmel::MySetup;
our %environment = (
'inc' => [
'/Users/miyagawa/.carmel/5.34.1-darwin-2level/builds/MooX-XSConstructor-0.002/blib/lib',
'/Users/miyagawa/.carmel/5.34.1-darwin-2level/builds/Class-XSConstructor-0.009/blib/arch',
'/Users/miyagawa/.carmel/5.34.1-darwin-2level/builds/Class-XSConstructor-0.009/blib/lib',
'/Users/miyagawa/.carmel/5.34.1-darwin-2level/builds/Exporter-Tiny-1.006000/blib/lib',
'/Users/miyagawa/.carmel/5.34.1-darwin-2level/builds/Scalar-List-Utils-1.63/blib/arch',
'/Users/miyagawa/.carmel/5.34.1-darwin-2level/builds/Scalar-List-Utils-1.63/blib/lib',
'/Users/miyagawa/.carmel/5.34.1-darwin-2level/builds/Ref-Util-0.204/blib/lib',
'/Users/miyagawa/.carmel/5.34.1-darwin-2level/builds/Ref-Util-XS-0.117/blib/arch',
'/Users/miyagawa/.carmel/5.34.1-darwin-2level/builds/Ref-Util-XS-0.117/blib/lib',
'/Users/miyagawa/.carmel/5.34.1-darwin-2level/builds/Hook-AfterRuntime-0.006/blib/lib',
'/Users/miyagawa/.carmel/5.34.1-darwin-2level/builds/B-Hooks-Parser-0.21/blib/arch',
'/Users/miyagawa/.carmel/5.34.1-darwin-2level/builds/B-Hooks-Parser-0.21/blib/lib',
'/Users/miyagawa/.carmel/5.34.1-darwin-2level/builds/B-Hooks-OP-Check-0.22/blib/arch',
'/Users/miyagawa/.carmel/5.34.1-darwin-2level/builds/B-Hooks-OP-Check-0.22/blib/lib',
'/Users/miyagawa/.carmel/5.34.1-darwin-2level/builds/ExtUtils-Depends-0.8001/blib/lib',
'/Users/miyagawa/.carmel/5.34.1-darwin-2level/builds/Module-Build-0.4231/blib/lib',
'/Users/miyagawa/.carmel/5.34.1-darwin-2level/builds/Moo-2.005004/blib/lib',
'/Users/miyagawa/.carmel/5.34.1-darwin-2level/builds/Class-Method-Modifiers-2.13/blib/lib',
'/Users/miyagawa/.carmel/5.34.1-darwin-2level/builds/Role-Tiny-2.002004/blib/lib',
'/Users/miyagawa/.carmel/5.34.1-darwin-2level/builds/Sub-Quote-2.006006/blib/lib'
],
'path' => [
'/Users/miyagawa/.carmel/5.34.1-darwin-2level/builds/Module-Build-0.4231/blib/script'
],
'execs' => {
CryptX is not in my cpanfile. My problem is that CryptX was installed globally in perl using cpanm CryptX
, so I assume it should also be loadable under carmel exec
without requires "CryptX";
in the cpanfile. If that isn't the case, then is it a documented behavior?
My problem is that CryptX was installed globally in perl using cpanm CryptX
Yes, that is indeed the problem. To make sure you're NOT accidentally using locally-installed modules, Carmel (like Carton) clears out the site installation path, so that you can run carmel install
and run carmel exec
on another machine, to satisfy the prerequisite without relying on locally-updated modules + versions.
You have to add all the non-core modules to cpanfile
and run carmel install
.
If you have a strong reason to avoid adding some specific modules to cpanfile
while understanding the risk of doing so (e.g. have to install modules that's not available on CPAN), you can:
carmel install
carmel rollout
. this will install all the modules specified in cpanfile
to ./local
perl -Ilocal/lib/perl5 yourscript.pl ...
(without using carmel exec
)This will not clear the site_perl path from INC, so that your locally-installed modules are still available. This is documented in Carmel.pm
under the production deployment section.
My first test with Path::Tiny was indeed flawed - it is a popular distribution, and got pulled by Carmel as an indirect dependency. I checked with other non-core pure perl module and now I see this behavior is consistent (it does not load).
It isn't immediately obvious that carmel exec
/ use Carmel::Setup;
does that, but it makes sense. Thank you for the explanation!
Can't find any documentation on it, so I'll assume it's a bug:
I can reproduce with for example MooseX::XSConstructor, MooX::XSAccessor, but not with Path::Tiny:
Same with
use Carmel::Setup
inside the script. Modules are loadable before that statement, but not after.