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

strawberry perl 5.36 | doubled directory paths #19

Closed
shawnlaffan opened this issue Mar 19, 2023 · 19 comments
Closed

strawberry perl 5.36 | doubled directory paths #19

shawnlaffan opened this issue Mar 19, 2023 · 19 comments
Assignees

Comments

@shawnlaffan
Copy link
Owner

First reported in StrawberryPerl/Perl-Dist-Strawberry#39 (comment)

Looks like some of the path changes in 5.36 need to be accounted for.

@shawnlaffan shawnlaffan self-assigned this Mar 19, 2023
@shawnlaffan shawnlaffan reopened this Mar 19, 2023
@shawnlaffan
Copy link
Owner Author

Commit message parsing by the system was overzealous

@shawnlaffan
Copy link
Owner Author

@amlan-sw - can you please try App::PP::Autolink from git master? This is a followup to StrawberryPerl/Perl-Dist-Strawberry#39 (comment)

Installation can be done using

cpanm https://github.com/shawnlaffan/perl-pp-autolink.git

@amlan-sw
Copy link

==== 1. failed using cpanm

image

==== 2. try using old: perl Makefile.PL - gmake - gmake install

image

==== 3. then test, still failed

image

@shawnlaffan
Copy link
Owner Author

shawnlaffan commented Mar 19, 2023

I'll have to double check the cpanm from github invocation, but you have it working in any case.

Can you try the pp_autolink call without all the extra flags? If Tk86.dll is in your path then it will be found and added to the call.

pp_autolink -o tkx_gui_example.exe tkx_gui_example.pl

If you are up for some debugging then you could add some print statements within this block to see what it is working with. Check the value of $dll_path before the if-block and then inside each if condition. If $dll_path has the doubled path once L537 has been run then the issue is with Module::ScanDeps.

foreach my $dll (grep {$_ =~ $RE_DLL_EXT} @uses) {
my $dll_path = $deps_hash->{$package}{file};
# Remove trailing component of path after /lib/
if ($dll_path =~ m/$inc_path_re/) {
$dll_path = $1 . '/' . $dll;
}
else {
# fallback, get everything after /lib/
$dll_path =~ s|(?<=/lib/).+?$||;
$dll_path .= $dll;
}
#say $dll_path;
croak "either cannot find or cannot read $dll_path "
. "for package $package"
if not -r $dll_path;
$dll_hash{$dll_path}++;
}
}

It's also a good idea to familiarise yourself with github markdown. It is much easier to copy code snippets from code blocks rather than screenshots.
https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax

@amlan-sw
Copy link

I think pp_autolink have problem with XS path from perl\site\lib

C:\strawberry>echo use Win32::GUI; > a.pl

C:\strawberry>cat a.pl
use Win32::GUI;

C:\strawberry>perl a.pl

C:\strawberry>pp -o a.exe a.pl

C:\strawberry>pp_autolink -o a.exe a.pl
either cannot find or cannot read C:/STRAWBERRY/PERL/SITE/lib/C:/STRAWBERRY/PERL/SITE/lib/auto/Win32/GUI/DropFiles/DropFiles.xs.dll for package C:/STRAWBERRY/PERL/SITE/lib/auto/Win32/GUI/DropFiles/DropFiles.xs.dll at C:\STRAWBERRY\PERL\SITE\BIN/pp_autolink.bat line 30.

try XS module from perl/lib

C:\strawberry>echo use JSON::XS;print JSON::XS::encode_json({aaa=^>111}); > a.pl

C:\strawberry>cat a.pl
use JSON::XS;print JSON::XS::encode_json({aaa=>111});

C:\strawberry>perl a.pl
{"aaa":111}
C:\strawberry>pp -o a.exe a.pl

C:\strawberry>pp_autolink -o a.exe a.pl
DLL check iter: 1
No alien system dlls detected

Detected link list:

Detected aliens:

CMD: pp -o a.exe a.pl

C:\strawberry>a.exe
{"aaa":111}

@shawnlaffan
Copy link
Owner Author

There is an error in the portable shell distributed with the 5.36 dev releases. The perl\site\bin dir is erroneously listed as site\bin.

Can you try editing your startup script where it sets the path?

#   set SP=%~dp0
#   set PATH=%SP%\perl\site\bin;%SP%\perl\bin;%SP%\c\bin;%SP%\Tcl\bin;%SP%\ImageMagick;%SP%\bin;%PATH%

@shawnlaffan
Copy link
Owner Author

Although now I have installed Win32::GUI I can reproduce the issue.

Possibly this is due to the strawberry perl build, possibly File::Find. StrawberryPerl/Perl-Dist-Strawberry#88

Either way I'll look into adding more workarounds to future proof pp_autolink.

shawnlaffan added a commit that referenced this issue Mar 19, 2023
This avoids potential issues with File::Find dependent
code in perl 5.37 (and strawberry perl 5.36).

Updates #19
@shawnlaffan
Copy link
Owner Author

@amlan-sw - can you try again from latest master?

@amlan-sw
Copy link

@amlan-sw - can you try again from latest master?

still not working

R:\perl-pp-autolink-master\perl-pp-autolink-master>perl Makefile.PL
Checking if your kit is complete...
Looks good
Generating a gmake-style Makefile
Writing Makefile for App::PP::Autolink
Writing MYMETA.yml and MYMETA.json

R:\perl-pp-autolink-master\perl-pp-autolink-master>gmake
cp tester.pl blib\lib\App\PP\tester.pl
cp lib/App/PP/Autolink.pm blib\lib\App\PP\Autolink.pm
"C:\strawberry\perl\bin\perl.exe" -MExtUtils::Command -e cp -- bin/pp_autolink.pl blib\script\pp_autolink.pl
pl2bat.bat blib\script\pp_autolink.pl

R:\perl-pp-autolink-master\perl-pp-autolink-master>gmake install
Installing C:\strawberry\perl\site\lib\App\PP\Autolink.pm
Appending installation info to C:\strawberry\perl\lib/perllocal.pod

R:\perl-pp-autolink-master\perl-pp-autolink-master>cat use Win32::GUI; > a.pl
cat: use: No such file or directory
cat: Win32::GUI;: No such file or directory

R:\perl-pp-autolink-master\perl-pp-autolink-master>echo use Win32::GUI; > a.pl

R:\perl-pp-autolink-master\perl-pp-autolink-master>cat a.pl
use Win32::GUI;

R:\perl-pp-autolink-master\perl-pp-autolink-master>perl a.pl

R:\perl-pp-autolink-master\perl-pp-autolink-master>pp -o a.exe a.pl

R:\perl-pp-autolink-master\perl-pp-autolink-master>perl -e "use App::PP::Autolink; print $App::PP::Autolink::VERSION"
2.10
R:\perl-pp-autolink-master\perl-pp-autolink-master>pp_autolink -o a.exe a.pl
either cannot find or cannot read C:/STRAWBERRY/PERL/SITE/lib/C:/STRAWBERRY/PERL/SITE/lib/auto/Win32/GUI/Scintilla/SciLexer.dll for package C:/STRAWBERRY/PERL/SITE/lib/auto/Win32/GUI/Scintilla/SciLexer.dll at C:\STRAWBERRY\PERL\SITE\BIN/pp_autolink.bat line 30.

I think you should update $VERSION of your .pm files after every update and publish, so other tester can know if module/app already updated

R:\perl-pp-autolink-master\perl-pp-autolink-master>perl -e "use App::PP::Autolink; print $App::PP::Autolink::VERSION"
2.10

R:\perl-pp-autolink-master\perl-pp-autolink-master>cat C:\strawberry\perl\site\lib\App\PP\Autolink.pm | grep VERSION

cygwin warning:
  MS-DOS style path detected: C:\strawberry\perl\site\lib\App\PP\Autolink.pm
  Preferred POSIX equivalent is: /cygdrive/c/strawberry/perl/site/lib/App/PP/Autolink.pm
  CYGWIN environment variable option "nodosfilewarning" turns off this warning.
  Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
our $VERSION = '2.10';

R:\perl-pp-autolink-master\perl-pp-autolink-master>cat lib\App\PP\Autolink.pm | grep VERSION

cygwin warning:
  MS-DOS style path detected: lib\App\PP\Autolink.pm
  Preferred POSIX equivalent is: lib/App/PP/Autolink.pm
  CYGWIN environment variable option "nodosfilewarning" turns off this warning.
  Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
our $VERSION = '2.10'; 

@shawnlaffan
Copy link
Owner Author

Just checking, but did you run git pull before testing?

In terms of testing you can also use the code directly without installing it by using the perl script.

#  from the git repo on your system
perl bin\pp_autolink.pl -o a.exe a.pl

I think you should update $VERSION of your .pm files after every update and publish, so other tester can know if module/app already updated

This version has yet to be published.

@amlan-sw
Copy link

Just checking, but did you run git pull before testing?

no, in windows I always use "Download Zip"

image

perl bin\pp_autolink.pl -o a.exe a.pl

must becareful using this, you must set PERL5LIB first to ./lib , and for testing I always check using

perl -e "use App::PP::Autolink; print $App::PP::Autolink::VERSION"

thats why every change we must change $VERSION, to know if we use right version before testing

@shawnlaffan
Copy link
Owner Author

must becareful using this, you must set PERL5LIB first to ./lib

This library uses rlib so that's not necessary in this case. See also blib for using compiled modules without installing them (e.g. perl -Mblib bin\somescript.pl).

As for the issue, the best way to be sure you have the latest version is to check the code contains the relevant changes, in this case those from 3d2ace9

@amlan-sw
Copy link

I manage to get hack solution for this doublepath issue,simply just get last path.

#only windows path using : (colon)
if($dll_path =~ /:/){
    $dll_path =~ s/^.+(.):/$1:/;       
}

I dont know if you want to fix this from pp_autolink side, where in StrawberryPerl 5.32.1.1 pp_autolink work fine

And about StrawberryPerl portableshell.bat

Can you try editing your startup script where it sets the path?

#   set SP=%~dp0
#   set PATH=%SP%\perl\site\bin;%SP%\perl\bin;%SP%\c\bin;%SP%\Tcl\bin;%SP%\ImageMagick;%SP%\bin;%PATH%

I think, you should remove user's %PATH%, I spend few hours to figure out why Alien::wxWidgets not compiling in dev_20230318, and all because my complicated %PATH%, so maybe for portableshell.bat minimal PATH for work:

set SP=%~dp0
set PATH=%SP%perl\site\bin;%SP%perl\bin;%SP%c\bin;%WINDIR%\system32;%WINDIR%;

@shawnlaffan
Copy link
Owner Author

To which line does your hack apply? It would probably also be better to search for two colons in the string in the condition.

WRT %PATH%, that will not change as it will break other code that expects utilities to be available. You can use your build script to change the paths locally. See for example the Env module.

@amlan-sw
Copy link

To which line does your hack apply? It would probably also be better to search for two colons in the string in the condition.

Autolink.pm around line 548 before

     #say $dll_path; 
     croak "either cannot find or cannot read $dll_path " 

@shawnlaffan
Copy link
Owner Author

I've tracked down the source of the issue. Some of the paths from Module::ScanDeps are absolute under SP5.36, where previously they are relative. Presumably something M:SD depends on has caused this change.

The location to fix is

# Remove trailing component of path after /lib/
if ($dll_path =~ m/$inc_path_re/) {
$dll_path = $1 . '/' . $dll;
}

@shawnlaffan
Copy link
Owner Author

Version 2.11 includes this change and has been uploaded to CPAN.

@amlan-sw - I will close this issue but please let me know if it is still present in 2.11.

@amlan-sw
Copy link

Version 2.11 includes this change and has been uploaded to CPAN.

@amlan-sw - I will close this issue but please let me know if it is still present in 2.11.

ok fixed

test 2.10

C:\strawberry>pp_autolink gui_example.pl
either cannot find or cannot read 
C:/strawberry/perl/site/lib/C:/strawberry/perl/site/lib/auto/Win32/GUI/DropFiles/DropFiles.xs.dll for package 
C:/strawberry/perl/site/lib/auto/Win32/GUI/DropFiles/DropFiles.xs.dll at C:\strawberry\perl\site\bin/pp_autolink.bat line 30.

test 2.11

C:\strawberry>pp_autolink gui_example.pl
DLL check iter: 1
No alien system dlls detected

Detected link list:

Detected aliens:

CMD: pp gui_example.pl

@shawnlaffan
Copy link
Owner Author

Thanks for confirming.

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

2 participants