-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[BUG] cloc won't work if ran through a symlink on Windows (ex Winget) : Can't locate PAR.pm in @INC
#849
Comments
I don't control the winget package for cloc but the config at https://github.com/microsoft/winget-pkgs/blob/master/manifests/a/AlDanial/Cloc/2.00/AlDanial.Cloc.installer.yaml looks fine. If you manually download the 2.00 exe from https://github.com/AlDanial/cloc/releases/download/v2.00/cloc-2.00.exe does that work properly for you? (The 2.02 release is also out; can get it from https://github.com/AlDanial/cloc/releases ) |
recreating a symlink with so ultimately I think that cloc can never be ran through a symlink |
Can't locate PAR.pm in @INC
Can't locate PAR.pm in @INC
Thanks for investigating the issue. However I'm wondering if the problem is associated with your environment rather than with cloc or its winget package? I did the installation myself, and cloc ran fine: PS C:\Users\al> winget install AlDanial.Cloc then opened a new PowerShell terminal and got the version number cleanly: PS C:\Users\al> cloc --version 2.00 Code counts work properly too. Do you have access to other Windows machines on which to try this? |
I've just tried use cloc for the first time and opted to |
23H2 too as stated in the original message |
Reproduced. Really weird with this error 😕 Console Logs in a single shell session
Reinstall
|
There's something happened. Outputs from 2 methods are different.
|
@EDM115 : I should have read your initial post more closely, re the OS version, thanks for the reminder. @Dragon1573 : is there a way to write the winget manifest for cloc without using a symlink? |
This is the designed feature of Maybe it's caused by Or create an install wizard (by InnoSetup, NullSoft, Burn, WiX, ...) for |
@AlDanial @Dragon1573 @danijam I think I fixed it, will open a PR |
fix: works when ran through a symlink, #849
@danijam I guess there was maybe an issue when rebuilding https://github.com/AlDanial/cloc/releases/download/v2.02/cloc-2.02-winget.exe |
I'm baffled since PR #850 is in the source I used to build |
hmmm… |
Good thinking, I hadn't tested that til now. I used the output of |
@mr-mihu maybe this is more likely a winget issue ? |
Wanted to chime in that I have found a (very hacky and temporary) work around. (Get-Item $env:LOCALAPPDATA\Microsoft\WinGet\Links\cloc.exe).Delete(); New-Item -Type HardLink -Path $env:LOCALAPPDATA\Microsoft\WinGet\Links\cloc.exe -Target $env:LOCALAPPDATA\Microsoft\WinGet\Packages\AlDanial.Cloc_Microsoft.Winget.Source_8wekyb3d8bbwe\cloc.exe; I really don't advise doing this, personally, but it does work. It's something specific to symbolic links, obviously. |
@glektarssza once again you can also copy-paste the built file from #850 (comment) and the symlink will work flawlessly |
edit : I built the latest cloc (ccb88c0) since it have the same issues :( |
@EDM115 are your build steps different than the ones I have at https://github.com/AlDanial/cloc?tab=readme-ov-file#building-a-windows-executable- ? |
absolutely not, and that's what puzzles me :( |
hmmm so I checked a bit further the repo and noticed that you probably create releases by hand. as far as I can see releases contains :
since windows is the only distro to have a built executable we could run the action on once the exe built we could probably automate the virustotal scan (they must have APIs) and add it to the readme as you do. i'm probably overcomplicating the entire process but it could be a solution. |
True, I'm creating releases by hand. At a rate of two per year it isn't a big deal. I agree 100% though that setting up the Windows exe build with Github Actions is the way to go. I'll create a new issue to do that, cross link to this one. Will take some effort to learn about how to make Github Actions stuff gowrk. |
alright :) so far I've seen an issue with edit: installing an older version of PAR::Packer seems really hard and fails whatever the method is. |
update : i've been able to successfully build the exe (and it is confirmed to work in the context of this issue, so perfect for winget), automate the VirusTotal analysis and automate file changes too the problems of yesterday were just skill issues on my end |
Describe the bug
When I tried to install cloc through winget, every command I run (even cloc --version) fails with the message :
Can't locate PAR.pm in @INC (you may need to install the PAR module) (@INC contains:) at -e line 592.
. Note that Strawberry Perl is installedcloc; OS; OS version
%LOCALAPPDATA%\Microsoft\WinGet\Packages\AlDanial.Cloc_Microsoft.Winget.Source_8wekyb3d8bbwe
with 2.02 from the releases tab but nothing changedTo Reproduce
Install through winget. Note that the npm package works just fine.
Expected result
cloc should work out of the box without any extra step
Additional context
I tried to install manually PAR and PAR::Packer for Perl, without any success. Restarting didn't changed a thing either
The text was updated successfully, but these errors were encountered: