Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Attempt to reload aborted" on Strawberry #88

Closed
VladimirAlexiev opened this issue Mar 25, 2024 · 12 comments
Closed

"Attempt to reload aborted" on Strawberry #88

VladimirAlexiev opened this issue Mar 25, 2024 · 12 comments

Comments

@VladimirAlexiev
Copy link

Hi! I'm trying to pack https://github.com/VladimirAlexiev/rdf2rml/blob/master/bin/rdfpuml.pl and all its dependencies.
I use Windows 10, Cygwin and Strawberry
This is perl 5, version 32, subversion 1 (v5.32.1) built for MSWin32-x64-multi-thread
I think my problems are more basic than https://groups.google.com/g/perl.par/c/KGXwXXSaz2U and that I'm doing something stupid.

This is how I pack it:

pp -o rdfpuml.exe -M RDF::Trine:: -M RDF::Query -M SLurp -M FindBin -a ../lib/RDF/Prefixes rdfpuml.pl
# Use of runtime loader module Module::Runtime detected.  Results of static scanning may be incomplete.
# Use of runtime loader module Module::Implementation detected.  Results of static scanning may be incomplete.

When I run it, I get these errors:

rdfpuml.exe cb-model.ttl
Attempt to reload RDF/Trine/Node/Resource.pm aborted.
Compilation failed in require at C:\tmp\par-566c6164696d697220416c6578696576\cache-2213514c7ad7aeee13764f53fb7a34812b4a3a15\inc\lib/RDF/Trine/Node.pm line 34.
BEGIN failed--compilation aborted at C:\tmp\par-566c6164696d697220416c6578696576\cache-2213514c7ad7aeee13764f53fb7a34812b4a3a15\inc\lib/RDF/Trine/Node.pm line 34.
Compilation failed in require at C:\tmp\par-566c6164696d697220416c6578696576\cache-2213514c7ad7aeee13764f53fb7a34812b4a3a15\inc\lib/RDF/Trine/Graph.pm line 82.
BEGIN failed--compilation aborted at C:\tmp\par-566c6164696d697220416c6578696576\cache-2213514c7ad7aeee13764f53fb7a34812b4a3a15\inc\lib/RDF/Trine/Graph.pm line 82.
Compilation failed in require at C:\tmp\par-566c6164696d697220416c6578696576\cache-2213514c7ad7aeee13764f53fb7a34812b4a3a15\inc\lib/RDF/Trine.pm line 115.
BEGIN failed--compilation aborted at C:\tmp\par-566c6164696d697220416c6578696576\cache-2213514c7ad7aeee13764f53fb7a34812b4a3a15\inc\lib/RDF/Trine.pm line 115.
Compilation failed in require at script/rdfpuml.pl line 14.
BEGIN failed--compilation aborted at script/rdfpuml.pl line 14.

Observations:

  • Node.pm line 34 asks for:
use RDF::Trine::Node::Nil;
use RDF::Trine::Node::Blank;
use RDF::Trine::Node::Literal;
use RDF::Trine::Node::Resource; <<< HERE
use RDF::Trine::Node::Variable;

And all these modules are included in the PAR:

unzip -l rdfpuml.exe lib/RDF/Trine/Node*
Archive:  rdfpuml.exe
  Length      Date    Time    Name
---------  ---------- -----   ----
     5659  03-25-2024 11:17   lib/RDF/Trine/Node.pm
     2277  03-25-2024 11:17   lib/RDF/Trine/Node/Blank.pm
     2714  03-25-2024 11:17   lib/RDF/Trine/Node/Formula.pm
    14192  03-25-2024 11:17   lib/RDF/Trine/Node/Literal.pm
     1407  03-25-2024 11:17   lib/RDF/Trine/Node/Nil.pm
     5111  03-25-2024 11:17   lib/RDF/Trine/Node/Resource.pm
     1522  03-25-2024 11:17   lib/RDF/Trine/Node/Variable.pm
  • I think some of these -M specs are redundant: eg I now notice that I forgot the double colons at the end of RDF::Query but a bunch of modules (and subfolders) are included in that module hierarchy
  • There are 4036 files in total in the PAR
  • RDF/Prefixes/Curie is a local module that my script uses like this:
use FindBin;
use lib "$FindBin::Bin/../lib"; # Curie is my own module, not yet on CPAN
use RDF::Prefixes::Curie;

I noticed there are 2 copies in the archive, one would overwrite the other, but they are supposed to be equivalent (one has the POD stripped out by PAR):

unzip -l rdfpuml.exe|grep -i curie
     2741  03-25-2024 11:17   lib/RDF/Prefixes/Curie.pm
     5868  04-18-2022 10:38   ../lib/RDF/Prefixes/Curie.pm
@VladimirAlexiev
Copy link
Author

The error is "Attempt to reload": does that mean the first load succeeded, and why does it need to reload?

@VladimirAlexiev
Copy link
Author

one would overwrite the other, but they are supposed to be equivalent (one has the POD stripped out by PAR)

I confirmed that: the only difference between lib/RDF/Prefixes/Curie.pm and ../lib/RDF/Prefixes/Curie.pm is the documentation at the end:
image

@shawnlaffan
Copy link

Maybe try using the -I argument to pack from your own lib dir instead of packing the whole dir again.
https://metacpan.org/pod/pp#-I,-lib=DIR

For example (untested):

pp -o rdfpuml.exe -M RDF::Trine:: -M RDF::Query -M Slurp -M FindBin -I ../lib rdfpuml.pl

@VladimirAlexiev
Copy link
Author

Thanks @shawnlaffan! I'm sure this is a better way but still no cigar:

pp -o rdfpuml.exe -M RDF::Trine:: -M RDF::Query:: -M RDF::Prefixes::Curie -M Slurp -M FindBin -I ../lib rdfpuml.pl
rdfpuml.exe cb-model.ttl
Attempt to reload RDF/Trine/Node/Resource.pm aborted.
Compilation failed in require at C:\tmp\par-566c6164696d697220416c6578696576\cache-6857ff78efa24d3963239d019870c3e6ee4fe85e\inc\lib/RDF/Trine/Node.pm line 34.
BEGIN failed--compilation aborted at C:\tmp\par-566c6164696d697220416c6578696576\cache-6857ff78efa24d3963239d019870c3e6ee4fe85e\inc\lib/RDF/Trine/Node.pm line 34.
Compilation failed in require at C:\tmp\par-566c6164696d697220416c6578696576\cache-6857ff78efa24d3963239d019870c3e6ee4fe85e\inc\lib/RDF/Trine/Graph.pm line 82.
BEGIN failed--compilation aborted at C:\tmp\par-566c6164696d697220416c6578696576\cache-6857ff78efa24d3963239d019870c3e6ee4fe85e\inc\lib/RDF/Trine/Graph.pm line 82.
Compilation failed in require at C:\tmp\par-566c6164696d697220416c6578696576\cache-6857ff78efa24d3963239d019870c3e6ee4fe85e\inc\lib/RDF/Trine.pm line 115.
BEGIN failed--compilation aborted at C:\tmp\par-566c6164696d697220416c6578696576\cache-6857ff78efa24d3963239d019870c3e6ee4fe85e\inc\lib/RDF/Trine.pm line 115.
Compilation failed in require at script/rdfpuml.pl line 14.
BEGIN failed--compilation aborted at script/rdfpuml.pl line 14.

@rschupp
Copy link
Owner

rschupp commented Mar 25, 2024

Thanks @shawnlaffan, I was about to suggest the same. Packing a script that uses FindBin will probably not work.

And why does Archive::Zip allow zip members with names that contain the component ".."? But that's probably not the cause of your problem.

@VladimirAlexiev can you try the following: insert the snippet

BEGIN 
{
    unshift @INC, sub {
        my ($ref, $file) = @_;
        my ($package, $filename, $line) = caller();
        print STDERR "require $file called from $filename line $line\n";
        return;
    };
}

at the start of rdfpuml.pl, repack and run rdfpuml.exe. This should print (on STDERR) a trace of all require (or use) performed including from where it was requested.

@rschupp
Copy link
Owner

rschupp commented Mar 25, 2024

See #76 (comment) for an explanation of "Attempt to reload ... aborted" and possible failure scenarios.

@VladimirAlexiev
Copy link
Author

VladimirAlexiev commented Mar 25, 2024

hi @rschupp thanks for trying to debug this! Here's the result with the debugging code you added:

# ... is C:\tmp\par-566c6164696d697220416c6578696576\cache-4db4da5ebf6777eb269942e75cbfeaf48baf27cb

require RDF/Trine.pm called from script/rdfpuml-pp.pl line 19
require Module/Load/Conditional.pm called from ...\inc\lib/RDF/Trine.pm line 86
require Module/Load.pm called from ...\inc\lib/Module/Load/Conditional.pm line 5
require Params/Check.pm called from ...\inc\lib/Module/Load/Conditional.pm line 6
require Locale/Maketext/Simple.pm called from ...\inc\lib/Params/Check.pm line 6
require Locale/Maketext/Lexicon.pm called from ...\inc\lib/Locale/Maketext/Simple.pm line 140
require Locale/Maketext/Lexicon.pm called from ...\inc\lib/Locale/Maketext/Simple.pm line 140
require version.pm called from ...\inc\lib/Module/Load/Conditional.pm line 12
require version/vxs.pm called from (eval 15) line 1
require version/regex.pm called from ...\inc\lib/version.pm line 62
require Module/Metadata.pm called from ...\inc\lib/Module/Load/Conditional.pm line 14
require LWP/UserAgent.pm called from ...\inc\lib/RDF/Trine.pm line 87
require LWP/MemberMixin.pm called from <embedded>/base.pm line 137
require HTTP/Request.pm called from ...\inc\lib/LWP/UserAgent.pm line 8
require HTTP/Message.pm called from <embedded>/base.pm line 137
require HTTP/Headers.pm called from ...\inc\lib/HTTP/Message.pm line 8
require Clone.pm called from ...\inc\lib/HTTP/Headers.pm line 302
require AutoLoader.pm called from ...\inc\lib/Clone.pm line 8
require URI.pm called from (eval 16) line 1
require URI/Escape.pm called from ...\inc\lib/URI.pm line 22
require HTTP/Response.pm called from ...\inc\lib/LWP/UserAgent.pm line 9
require HTTP/Status.pm called from ...\inc\lib/HTTP/Response.pm line 10
require HTTP/Date.pm called from ...\inc\lib/LWP/UserAgent.pm line 10
require LWP.pm called from ...\inc\lib/LWP/UserAgent.pm line 12
require LWP/Protocol.pm called from ...\inc\lib/LWP/UserAgent.pm line 13
require Try/Tiny.pm called from ...\inc\lib/LWP/Protocol.pm line 11
require Sub/Util.pm called from ...\inc\lib/Try/Tiny.pm line 20
require RDF\Redland.pm called from ...\inc\lib/Module/Load/Conditional.pm line 218
require Log/Log4perl.pm called from ...\inc\lib/RDF/Trine.pm line 110
require Log/Log4perl/Util.pm called from ...\inc\lib/Log/Log4perl.pm line 13
require Log/Log4perl/Logger.pm called from ...\inc\lib/Log/Log4perl.pm line 14
require Log/Log4perl/Level.pm called from ...\inc\lib/Log/Log4perl/Logger.pm line 10
require Log/Log4perl/Layout.pm called from ...\inc\lib/Log/Log4perl/Logger.pm line 11
require Log/Log4perl/Layout/SimpleLayout.pm called from ...\inc\lib/Log/Log4perl/Layout.pm line 4
require Log/Log4perl/Layout/PatternLayout.pm called from ...\inc\lib/Log/Log4perl/Layout.pm line 5
require Log/Log4perl/DateFormat.pm called from ...\inc\lib/Log/Log4perl/Layout/PatternLayout.pm line 14
require Log/Log4perl/NDC.pm called from ...\inc\lib/Log/Log4perl/Layout/PatternLayout.pm line 15
require Log/Log4perl/MDC.pm called from ...\inc\lib/Log/Log4perl/Layout/PatternLayout.pm line 16
require Log/Log4perl/Util/TimeTracker.pm called from ...\inc\lib/Log/Log4perl/Layout/PatternLayout.pm line 17
require Sys/Hostname.pm called from ...\inc\lib/Log/Log4perl/Util.pm line 51
require Log/Log4perl/Layout/PatternLayout/Multiline.pm called from ...\inc\lib/Log/Log4perl/Layout.pm line 6
require Log/Log4perl/Appender.pm called from ...\inc\lib/Log/Log4perl/Logger.pm line 12
require Log/Log4perl/Appender/String.pm called from ...\inc\lib/Log/Log4perl/Logger.pm line 13
require Log/Log4perl/Filter.pm called from ...\inc\lib/Log/Log4perl/Logger.pm line 14
require Log/Log4perl/Config.pm called from ...\inc\lib/Log/Log4perl/Filter.pm line 10
require Log/Log4perl/Config/PropertyConfigurator.pm called from ...\inc\lib/Log/Log4perl/Config.pm line 10
require Log/Log4perl/Config/BaseConfigurator.pm called from ...\inc\lib/Log/Log4perl/Config/PropertyConfigurator.pm line 2
require Log/Log4perl/JavaMap.pm called from ...\inc\lib/Log/Log4perl/Config.pm line 11
require Log/Log4perl/Filter/Boolean.pm called from ...\inc\lib/Log/Log4perl/Config.pm line 13
require Log/Log4perl/Config/Watch.pm called from ...\inc\lib/Log/Log4perl/Config.pm line 14
require RDF/Trine/Graph.pm called from ...\inc\lib/RDF/Trine.pm line 115
require Algorithm/Combinatorics.pm called from ...\inc\lib/RDF/Trine/Graph.pm line 38
require Data/Dumper.pm called from ...\inc\lib/RDF/Trine/Graph.pm line 79
require RDF/Trine/Node.pm called from ...\inc\lib/RDF/Trine/Graph.pm line 82
require RDF/Trine/Node/Nil.pm called from ...\inc\lib/RDF/Trine/Node.pm line 31
require RDF/Trine/Node/Blank.pm called from ...\inc\lib/RDF/Trine/Node.pm line 32
require RDF/Trine/Node/Literal.pm called from ...\inc\lib/RDF/Trine/Node.pm line 33
require RDF/Trine/Error.pm called from ...\inc\lib/RDF/Trine/Node/Literal.pm line 21
require Error.pm called from <embedded>/base.pm line 137
require RDF/Trine/Error/ParserError.pm called from <embedded>/base.pm line 137
require Term\ANSIColor.pm called from ...\inc\lib/Module/Load/Conditional.pm line 218
require Term/ANSIColor.pm called from ...\inc\lib/Module/Load.pm line 78
require RDF/Trine/Error/ParserError/Explainable.pm called from <embedded>/base.pm line 137
require RDF/Trine/Error/ParserError/Explainable.pm called from <embedded>/base.pm line 137
require RDF/Trine/Node/Literal/XML.pm called from (eval 19) line 1
require RDF/Trine/Node/Formula.pm called from (eval 20) line 1
require RDF/Trine/Pattern.pm called from ...\inc\lib/RDF/Trine/Node/Formula.pm line 10
require RDF/Trine/Iterator.pm called from ...\inc\lib/RDF/Trine/Pattern.pm line 25
require XML/SAX.pm called from ...\inc\lib/RDF/Trine/Iterator.pm line 39
require XML/SAX/ParserFactory.pm called from ...\inc\lib/XML/SAX.pm line 18
require XML/SAX/Exception.pm called from ...\inc\lib/XML/SAX/ParserFactory.pm line 12
require RDF/Trine/Iterator/SAXHandler.pm called from ...\inc\lib/RDF/Trine/Iterator.pm line 41
require XML/SAX/Base.pm called from <embedded>/base.pm line 137
require RDF/Trine/VariableBindings.pm called from ...\inc\lib/RDF/Trine/Iterator/SAXHandler.pm line 44
require RDF/Trine/Iterator/JSONHandler.pm called from ...\inc\lib/RDF/Trine/Iterator.pm line 42
require JSON.pm called from ...\inc\lib/RDF/Trine/Iterator/JSONHandler.pm line 37
require JSON/XS.pm called from (eval 21) line 2
require common/sense.pm called from ...\inc\lib/JSON/XS.pm line 90
require Types/Serialiser.pm called from ...\inc\lib/JSON/XS.pm line 100
require RDF/Trine/Iterator/Bindings.pm called from ...\inc\lib/RDF/Trine/Iterator.pm line 60
require Text/Table.pm called from ...\inc\lib/RDF/Trine/Iterator/Bindings.pm line 41
require Text/Aligner.pm called from ...\inc\lib/Text/Table.pm line 11
require RDF/Trine/Iterator/Bindings/Materialized.pm called from ...\inc\lib/RDF/Trine/Iterator/Bindings.pm line 44
require RDF/Trine/Serializer/Turtle.pm called from ...\inc\lib/RDF/Trine/Iterator/Bindings.pm line 45
require RDF/Trine/Serializer.pm called from <embedded>/base.pm line 137
require HTTP/Negotiate.pm called from ...\inc\lib/RDF/Trine/Serializer.pm line 30
require RDF/Trine/Serializer/NQuads.pm called from ...\inc\lib/RDF/Trine/Serializer.pm line 40
require RDF/Trine/Statement.pm called from ...\inc\lib/RDF/Trine/Serializer/NQuads.pm line 43
require RDF/Trine/Serializer/NTriples.pm called from ...\inc\lib/RDF/Trine/Serializer.pm line 41
require RDF/Trine/Serializer/NTriples/Canonical.pm called from ...\inc\lib/RDF/Trine/Serializer.pm line 42
require RDF/Trine/Serializer/RDFXML.pm called from ...\inc\lib/RDF/Trine/Serializer.pm line 43
require RDF/Trine/Serializer/RDFJSON.pm called from ...\inc\lib/RDF/Trine/Serializer.pm line 44
require RDF/Trine/Serializer/TriG.pm called from ...\inc\lib/RDF/Trine/Serializer.pm line 46
require RDF/Trine/Serializer/RDFPatch.pm called from ...\inc\lib/RDF/Trine/Serializer.pm line 47
require RDF/Trine/Exporter/RDFPatch.pm called from ...\inc\lib/RDF/Trine/Serializer/RDFPatch.pm line 46
require RDF/Trine/Serializer/TSV.pm called from ...\inc\lib/RDF/Trine/Serializer.pm line 48
require RDF/Trine/Namespace.pm called from ...\inc\lib/RDF/Trine/Serializer/Turtle.pm line 49
require XML/Namespace.pm called from <embedded>/base.pm line 137
require RDF/Trine/Node/Resource.pm called from ...\inc\lib/RDF/Trine/Namespace.pm line 54
require IRI.pm called from ...\inc\lib/RDF/Trine/Node/Resource.pm line 22
require Moo.pm called from ...\inc\lib/IRI.pm line 84
require Moo/_Utils.pm called from ...\inc\lib/Moo.pm line 17
require mro.pm called from ...\inc\lib/Moo/_Utils.pm line 170
require Moo/HandleMoose/_TypeMap.pm called from ...\inc\lib/Moo/_Utils.pm line 284
require Moo/sification.pm called from ...\inc\lib/Moo.pm line 32
require Moo/Object.pm called from ...\inc\lib/Moo.pm line 72
require MooX/HandlesVia.pm called from ...\inc\lib/IRI.pm line 85
require Moo/Role.pm called from ...\inc\lib/MooX/HandlesVia.pm line 8
require Role/Tiny.pm called from ...\inc\lib/Moo/Role.pm line 18
require Module/Runtime.pm called from ...\inc\lib/MooX/HandlesVia.pm line 9
require Types/Standard.pm called from ...\inc\lib/IRI.pm line 86
require re.pm called from ...\inc\lib/Types/Standard.pm line 8
require Type/Library.pm called from ...\inc\lib/Types/Standard.pm line 20
require Eval/TypeTiny.pm called from ...\inc\lib/Type/Library.pm line 14
require Exporter/Tiny.pm called from ...\inc\lib/Eval/TypeTiny.pm line 78
require Type/Tiny.pm called from ...\inc\lib/Type/Library.pm line 16
require Types/TypeTiny.pm called from ...\inc\lib/Type/Tiny.pm line 22
require Type/Tiny/XS.pm called from ...\inc\lib/Types/TypeTiny.pm line 15
require Ref/Util/XS.pm called from ...\inc\lib/Types/Standard.pm line 54
require B.pm called from ...\inc\lib/Moo/HandleMoose/_TypeMap.pm line 28
require Type/Coercion.pm called from ...\inc\lib/Type/Tiny.pm line 492
require Method/Generate/Constructor.pm called from ...\inc\lib/Moo.pm line 205
require Sub/Quote.pm called from ...\inc\lib/Method/Generate/Constructor.pm line 5
require Sub/Defer.pm called from ...\inc\lib/Sub/Quote.pm line 11
require Method/Generate/Accessor.pm called from ...\inc\lib/Moo.pm line 193
require Class/XSAccessor.pm called from ...\inc\lib/Moo/_Utils.pm line 113
require Class/XSAccessor/Heavy.pm called from ...\inc\lib/Class/XSAccessor.pm line 6
require Type/Tiny/Class.pm called from ...\inc\lib/Types/Standard.pm line 876
require Type/Tiny/ConstrainedObject.pm called from ...\inc\lib/Type/Tiny/Class.pm line 22
require Data/Perl/Collection/Hash/MooseLike.pm called from ...\inc\lib/Module/Runtime.pm line 314
Attempt to reload RDF/Trine/Node/Resource.pm aborted.
Compilation failed in require at ...\inc\lib/RDF/Trine/Node.pm line 34.
BEGIN failed--compilation aborted at ...\inc\lib/RDF/Trine/Node.pm line 34.
Compilation failed in require at ...\inc\lib/RDF/Trine/Graph.pm line 82.
BEGIN failed--compilation aborted at ...\inc\lib/RDF/Trine/Graph.pm line 82.
Compilation failed in require at ...\inc\lib/RDF/Trine.pm line 115.
BEGIN failed--compilation aborted at ...\inc\lib/RDF/Trine.pm line 115.
Compilation failed in require at script/rdfpuml-pp.pl line 19.
BEGIN failed--compilation aborted at script/rdfpuml-pp.pl line 19.

Packing a script that uses FindBin will probably not work.

What is the best way to include a local module, which would work both with pp and with a script that relies on a "normal" installation?

But it doesn't even get to that part...

@VladimirAlexiev
Copy link
Author

Trine uses Module::Load::Conditional to check for the presence of Redland library/modules that I don't use.

use Module::Load::Conditional qw[can_load];
use LWP::UserAgent;

our ($debug, @ISA, $VERSION, @EXPORT_OK);
BEGIN {
	$debug		= 0;
	$VERSION	= '1.019';
	
	require Exporter;
	@ISA		= qw(Exporter);
	@EXPORT_OK	= qw(iri blank literal variable statement store UNION_GRAPH NIL_GRAPH);
	
	unless ($ENV{RDFTRINE_NO_REDLAND}) {
		can_load( modules => {
			'RDF::Redland'					=> undef,
			'RDF::Trine::Store::Redland'	=> undef,
			'RDF::Trine::Parser::Redland'	=> undef,
		} );

@VladimirAlexiev
Copy link
Author

VladimirAlexiev commented Mar 25, 2024

Here are the lines that cause Compilation failed in require

# RDF/Trine/Node.pm line 34.
use RDF::Trine::Node::Resource;

# RDF/Trine/Graph.pm line 82
use RDF::Trine::Node;

# RDF/Trine.pm line 115
use RDF::Trine::Graph;

# script/rdfpuml-pp.pl line 19
use RDF::Trine;

Trine loads sub-modules in this order:

# Trine.pm:
use RDF::Trine::Graph;
use RDF::Trine::Parser;
use RDF::Trine::Serializer;
use RDF::Trine::Node;
use RDF::Trine::Statement;
use RDF::Trine::Namespace;
use RDF::Trine::NamespaceMap;
use RDF::Trine::Iterator;
use RDF::Trine::Store;
use RDF::Trine::Error;
use RDF::Trine::Model;
use RDF::Trine::Parser::Turtle;
use RDF::Trine::Parser::TriG;

# Graph.pm:
...
use RDF::Trine::Node;
use RDF::Trine::Store;

# Node.pm:
use RDF::Trine::Node::Nil;
use RDF::Trine::Node::Blank;
use RDF::Trine::Node::Literal;
use RDF::Trine::Node::Resource;
use RDF::Trine::Node::Variable;

# all Node::*.pm:
use base qw(RDF::Trine::Node);

# Literal.pm
use RDF::Trine::Error;

Trine::Error does a bunch of tricks

use base qw(Error);

package RDF::Trine::Error::CompilationError;

use base qw(RDF::Trine::Error);

package RDF::Trine::Error::QuerySyntaxError;

use base qw(RDF::Trine::Error);

package RDF::Trine::Error::MethodInvocationError;

use base qw(RDF::Trine::Error);

package RDF::Trine::Error::SerializationError;

use base qw(RDF::Trine::Error);

package RDF::Trine::Error::DatabaseError;

use base qw(RDF::Trine::Error);

package RDF::Trine::Error::ParserError;

use base qw(RDF::Trine::Error);

package RDF::Trine::Error::ParserError::Explainable;

use base qw(RDF::Trine::Error::ParserError);
use Module::Load::Conditional qw[can_load];

package RDF::Trine::Error::ParserError::Tokenized;

use base qw(RDF::Trine::Error::ParserError::Explainable);

package RDF::Trine::Error::ParserError::Positioned;

use base qw(RDF::Trine::Error::ParserError::Explainable);

@rschupp
Copy link
Owner

rschupp commented Mar 27, 2024

@VladimirAlexiev Can you check (with unzip -l rdfpuml.exe) whether Data/Perl/Collection/Hash/MooseLike.pm has been packed into the executable. If not, try repacking by adding -M Data::Perl::Collection::Hash::MooseLike to your pp command.

@VladimirAlexiev
Copy link
Author

Thanks a lot, it works!!!

Is there something I can help you with to improve dependency detection?
It still gives:

# Use of runtime loader module Module::Runtime detected.  Results of static scanning may be incomplete.
# Use of runtime loader module Module::Implementation detected.  Results of static scanning may be incomplete.

rschupp added a commit to rschupp/Module-ScanDeps that referenced this issue Mar 29, 2024
@rschupp
Copy link
Owner

rschupp commented Mar 29, 2024

Thanks a lot, it works!!!

Thanks for testing. I simply installed all required modules on linux, packed rdfpuml.pl and ran the excutable:

Can't locate Data/Perl/Collection/Hash/MooseLike.pm in @INC (you may need to install the Data::Perl::Collection::Hash::MooseLike module) (@INC contains: /tmp/par-726f646572696368/cache-3019000794a46860af7c902a93d3b3543e18ca80/inc/lib /tmp/par-726f646572696368/cache-3019000794a46860af7c902a93d3b3543e18ca80/inc CODE(0x55cfa685b698) CODE(0x55cfa685bea8)) at /tmp/par-726f646572696368/cache-3019000794a46860af7c902a93d3b3543e18ca80/inc/lib/Module/Runtime.pm line 314.

That is the typical error when pp missed some dependency of your script. Actually it's Module::ScanDeps job to find these dependencies. In your case module MooX::HandlesVia loads Data::Perl::Collection::Hash::MooseLike in a way that cannot be detected by "static" analysis of MooX/HandlesVia.pm (it's using one of those "runtime loader modules"). A simple example for this problem is File::Spec:

 my %module = (
              MSWin32 => 'Win32',
              os2     => 'OS2',
              VMS     => 'VMS',
              amigaos => 'AmigaOS');
my $module = $module{$^O} || 'Unix';
require "File/Spec/$module.pm";      # <--- 

Sometimes using pp option --compile will help in this situation. In your case pp -c -o rdfpuml.exe -I lib rdfpuml.pl does the trick.

I'm still puzzled about the "Attempt to reload ... abort" error message though 🤔

Is there something I can help you with to improve dependency detection?

I'll add a hint to Module::ScanDeps: when MooX::HandlesVia is detected as a dependency, also add all modules "below" Data::Perl.

@rschupp rschupp closed this as completed Mar 29, 2024
rschupp added a commit to rschupp/Module-ScanDeps that referenced this issue Mar 31, 2024
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Nov 24, 2024
1.37  2024-11-14

- fix parsing of "use if ..."
  Fixes errors in PAR::Packer test t/90-rt59710.t

- add test for _parse_libs()

1.36  2024-10-21

- Fix CVE-2024-10224: Unsanitized input leads to LPE

  - use three-argument open()
  - replace 'eval "..."' constructs

  Note: this version was not released on CPAN because of
  Coordinated Release Date for CVE

- README: add "Source Repository" and "Contact" info
  switch "Please submit bug reports to ..." to GitHub issues

- add preload rule for MooX::HandlesVia
  cf. rschupp/PAR-Packer#88
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants