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

Can't load Win32.xs.dll when running cpanm #195

Open
realflash opened this issue Jun 26, 2024 · 12 comments
Open

Can't load Win32.xs.dll when running cpanm #195

realflash opened this issue Jun 26, 2024 · 12 comments

Comments

@realflash
Copy link

I have placed the portable edition into a Windows nanoserver container. A hello world perl script runs OK. I have added the directories in the README so that I can call the perl executable directly, which also works OK. When I run cpanm I get:

Can't load 'c:/perl/perl/lib/auto/Win32/Win32.xs.dll' for module Win32: load_file:The specified module could not be found at c:/perl/perl/lib/DynaLoader.pm

PATH is set to

c:\Windows\System32;c:\Windows;c:\perl\perl\bin;c:\perl\perl\site\bin;c:\perl\c\bin

Version is strawberry-perl-5.38.2.2-64bit-portable

If I try to use the cpan module directly I get a different error which I imagine has the same cause:

c:\perl>perl -MCPAN -e 'install Dancer;'
Attempt to reload Win32.pm aborted.
Compilation failed in require at c:/perl/perl/lib/Cwd.pm line 592.

Could someone please help?

@sisyphus
Copy link

When I run Strawberry Perl, the following extra directories are included in my PATH:
C:\Windows\System32\Wbem;
C:\Windows\System32\WindowsPowerShell\v1.0;
C:\Windows\System32\OpenSSH;
C:\Users\Owner\AppData\Local\Microsoft\WindowsApps

Maybe try adding them (or equivalent) to your path and see if that locates the missing dll.

The usual way of opening up a shell with the correct path automatically set for you is to just double-click on portableshell.bat which you'll find in your C:\Perl directory.

@tonycoz
Copy link

tonycoz commented Jun 26, 2024

Do other core dynamic modules load,eg:

perl -MDevel::Peek -e0

Does Win32 load outside of cpanm:

perl -MWin32 -e0

@realflash
Copy link
Author

No error when loading Devel::Peek. Same error when loading Win32 directly.

@realflash
Copy link
Author

I should add that the same error occurs when trying to load Win32 from the portableshell.

@mohawk2
Copy link

mohawk2 commented Jun 26, 2024

What do perl -MV=Win32 and perl -MV=Devel::Peek show? (You'll probably have to install V first)

@realflash
Copy link
Author

c:\perl>perl -MV=Win32
Win32
        C:\perl\perl\lib\Win32.pm: 0.59

c:\perl>perl -MV=Devel::Peek
Devel::Peek
        C:\perl\perl\lib\Devel\Peek.pm: 1.33

@mohawk2
Copy link

mohawk2 commented Jun 27, 2024

Thank you. Sorry for the multiple questions! If I knew enough to have an immediate solution, I'd go straight to that. Does the @INC part of perl -V look like this?

  @INC:
    C:/perl/perl/site/lib/MSWin32-x64-multi-thread
    C:/perl/perl/site/lib
    C:/perl/perl/vendor/lib
    C:/perl/perl/lib

I have C:\perl\perl\lib\auto\Win32\Win32.xs.dll, do you? Also, I'm using 5.32.1.1, do you get the same problem with other versions of Strawberry? Have you tried the very latest?

@sisyphus
Copy link

I should add that the same error occurs when trying to load Win32 from the portableshell.

This makes me wonder if you've had a bad download, or a bad unpacking of the Strawberry Perl zip.
Does the SHA256 digest of your downloaded strawberry-perl-5.38.2.2-64bit-portable.zip match that shown at https://strawberryperl.com/releases.html (ea451686065d6338d7e4d4a04c9af49f17951d15aa4c2e19ab8cb56fa2373440) ?

What tool did you use to unpack it ? (I use 7z .)
Going back quite a few years, it was not uncommon for some unzip tools to botch the unpacking - depending upon how they were configured. (Winzip was one such tool - but I don't know if that tool even exists any more.)
If the unpacking of the zip package issued warnings/errors, then your Strawberry Perl installation is probably broken.

@realflash
Copy link
Author

c:\perl>perl -e "print \"@INC\""
c:/perl/perl/site/lib
c:/perl/perl/vendor/lib
c:/perl/perl/lib

I can confirm that that DLL exists. I'll try a different version.

@realflash
Copy link
Author

realflash commented Jun 29, 2024

strawberry-perl-5.32.1.1-64bit-portable works OK (has 64-bit and 32-bit editions)
strawberry-perl-5.36.3.1-64bit-portable fails as in my first post (only has 64-bit edition)
strawberry-perl-5.38.2.2-64bit-portable fails as in my first post (only has 64-bit edition)

Some maybe something happened in the change to 64-bit only that broke it?

The value of @inc doesn't change no matter which version; it only has the three entries shown in my previous comment.

I have validated the SHA sums of all the downloads. I have extracted them multiple times using the unzip functionality built into Windows 11.

@xiaoyafeng
Copy link

Just a guess since I don't have Win11, is there some dll files which win11 doesn't have but old wins has? try install vc_redist to see if it help.

@wchristian
Copy link
Member

you could also try using https://learn.microsoft.com/en-us/sysinternals/downloads/procmon to watch what the perl process is trying to access

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

6 participants