FAKE
FAKE copied to clipboard
Apple Silicon Error FS0193: The specified file name or path is too long
Description
When running dotnet fake run build.fsx
(with a super-minimalistic build.fsx) on my MacBook Air (M1) I keep getting the error:
Script is not valid:
unknown (1,0)-(1,0): Error FS0193: The specified file name or path is too long, or a component of the specified path is too long.
I tried several versions of fake-cli
(including the latest prereleases) and all of them give the same result.
Verbose output shows me the fsc
arguments and fails with said error.
Any help would be greatly appreciated.
Repro steps
A small repro can be found at krauthaufen/FakeAppleProblem
Known workarounds
none, sadly
Related information
-
MacOS X 12.0.1
-
dotnet --info
.NET SDK (reflecting any global.json):
Version: 6.0.100
Commit: 9e8b04bbff
Runtime Environment:
OS Name: Mac OS X
OS Version: 12.0
OS Platform: Darwin
RID: osx-arm64
Base Path: /usr/local/share/dotnet/sdk/6.0.100/
Host (useful for support):
Version: 6.0.0
Commit: 4822e3c3aa
.NET SDKs installed:
6.0.100 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Welcome to the FAKE community! Thank you so much for creating your first issue and therefore improving the project!
Hint: To further diagnose the problem you can run fake in verbose mode `fake -v run ...` or set the 'FAKE_DETAILED_ERRORS' environment variable to 'true'
Can you try setting that environment variable and running in verbose mode and pasting the output? Maybe that can give a hint to a potential workaround.
Hey, sadly that doesn't yield any additional information.
I See the fsc-args and directly after that I get:
..............
"--compilertool:/Users/schorsch/.nuget/packages/fake-cli/5.21.0-alpha003/tools/net6.0/any";
"-o";
"/Users/schorsch/Development/faketest/.fake/test.fsx/test_424B5E9C8D7B71B0ED70B33E42D41047EB1158399A4AE6FD604D7315DFCB2C9E.dll";
"/Users/schorsch/Development/faketest/test.fsx"]
saving cache...
Script is not valid, see standard error for details.
Script is not valid:
unknown (1,0)-(1,0): Error FS0193: The specified file name or path is too long, or a component of the specified path is too long.
I'd try the following:
- Can you run fsc standalone with those arguments printed?
- Can you fix it by changing the
-o
argument (maybe the hash in the filename or the command line itself is too long for MACs?)
Hey, I managed to build it using fsc
directly, however I had to change the output-path.
When using the "original" output-path I don't get any error, nonetheless no output-file is created.
after running fsc ... -o /Users/XXX/Development/faketest/.fake/test.fsx/test_424B5E9C8D7B71B0ED70B33E42D41047EB1158399A4AE6FD604D7315DFCB2C9E.dll
the directory /Users/XXX/Development/faketest/.fake/test.fsx/
gets created but the dll is missing
Can you check that no anti-virus program is just deleting the file?
Can you create such a file by hand, for example by touch /Users/XXX/Development/faketest/.fake/test.fsx/test_424B5E9C8D7B71B0ED70B33E42D41047EB1158399A4AE6FD604D7315DFCB2C9E.dll
?
Can you research where this limitation might come from?
Technically, we add the hash to ensure to recompile when something changes, we could do that differently but there is really no reason why that wouldn't work on MACs
Hey, I can manually create the file without any problem (the alternative would have been very weird) I don't have any antivirus/etc. software installed, so I really don't know what else could cause this...
Maybe someone else with a M1-Mac could confirm that this doesn't work? Cheers
Then you might have a workaround: Build manually and rename the file :)
hey, I was trying to find the problem in fake-cli and it actually happens somewhere in FSharp.Compiler.Service. I tried updating FSCS to the latest (41.0.1) version and fixed all the tiny problems locally, however I run into MissingMethodExceptions related to PrintFormat in FSharp.Core (maybe some dependency built with a very old FSharp.Core?)
Any hints how to properly upgrade dependencies without destroying something on some other end?
However the new FSCS version made the original problem go away.
P.S.: the exception I get is MissingMethodException: Method not found: 'Void Microsoft.FSharp.Core.PrintfFormat`5..ctor(System.String)'.
in [email protected](Unit unitVar0) in /Users/schorsch/Development/FAKE/src/app/Fake.Runtime/CompileRunner.fs:line 74
The forked repo is here
I can confirm this does not work at the moment. Unfortunately I cannot add anything to help with debugging. My setup:
dotnet --info
.NET SDK (reflecting any global.json):
Version: 6.0.101
Commit: ef49f6213a
Runtime Environment:
OS Name: Mac OS X
OS Version: 12.1
OS Platform: Darwin
RID: osx.12-arm64
Base Path: /usr/local/share/dotnet/sdk/6.0.101/
Host (useful for support):
Version: 6.0.1
Commit: 3a25a7f1cc
.NET SDKs installed:
6.0.101 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
And FAKE:
dotnet fake --version
FAKE 5 - F# Make (5.21.1) (this line is written to standard error, see https://github.com/fsharp/FAKE/issues/2066)
FakePath: /Users/****/.nuget/packages/fake-cli/5.21.1/tools/net6.0/any/Fake.Runtime.dll
Paket.Core: 6.2.1
I had this exact problem, but I think I found a workaround.
So the problem is with .NET Arm64 version, when I switched to .NET x64 version it started to working.
Quick tip is also to create a link from x64 version, so all dotnet commands could work from terminal.
sudo ln -s /usr/local/share/dotnet/x64/dotnet /usr/local/bin/
Could this be the same as https://github.com/dotnet/runtime/issues/63240 ?
I'm having the same issue. My configuration is almost exactly as is @TomiLahtinen 's.
@michaljosek, Can you give more details on your switch to .NET x64?
@malclear I uninstalled ARM64 version. You can navigate to Microsoft page and download x64 version.
Create symbolic link as I mentioned earlier so you don't have to use "dotnetx64" in CLI (then "dotnet" command is available in CLI).
sudo ln -s /usr/local/share/dotnet/x64/dotnet /usr/local/bin/
Here you can read about Breaking changes - installation location for ARM64/x64.
(If my diagnosis above is correct, this should be fixed in .NET 6.0.3, by https://github.com/dotnet/runtime/pull/64266 .)
problem seems to still exist on my system at least, with an empty build file
% cat build.fsx
% dotnet tool run fake build
Consider adding your dependencies via `#r` dependencies, for example add '#r "paket: nuget FSharp.Core //"'.
See https://fake.build/fake-fake5-modules.html for details.
If you know what you are doing you can silence this warning by setting the environment variable 'FAKE_ALLOW_NO_DEPENDENCIES' to 'true'
The last restore is still up to date. Nothing left to do.
Script is not valid:
unknown (1,0)-(1,0): Error FS0193: The specified file name or path is too long, or a component of the specified path is too long.
Performance:
- Cli parsing: 95 milliseconds
- Packages: 31 milliseconds
- Script compiling: 283 milliseconds
- Runtime: 507 milliseconds
edit: realized I could just run dotnet info
😅
% dotnet --info
.NET SDK (reflecting any global.json):
Version: 6.0.301
Commit: 43f9b18481
Runtime Environment:
OS Name: Mac OS X
OS Version: 12.4
OS Platform: Darwin
RID: osx.12-arm64
Base Path: /usr/local/share/dotnet/sdk/6.0.301/
Host (useful for support):
Version: 6.0.6
Commit: 7cca709db2
.NET SDKs installed:
6.0.301 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
% dotnet --version
6.0.301
% dotnet --list-sdks
6.0.301 [/usr/local/share/dotnet/sdk]
% sw_vers
ProductName: macOS
ProductVersion: 12.4
BuildVersion: 21F79
% uname -prsv
Darwin 21.5.0 Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:29 PDT 2022; root:xnu-8020.121.3~4/RELEASE_ARM64_T8101 arm
% dotnet tool run fake --version
FAKE 5 - F# Make (5.22.0) (this line is written to standard error, see https://github.com/fsharp/FAKE/issues/2066)
FakePath: /Users/rdewaele/.nuget/packages/fake-cli/5.22.0/tools/net6.0/any/Fake.Runtime.dll
Paket.Core: 6.2.1
Is there a way to force FAKE to run with a particular SDK version? My issue is that I need a net6 SDK to build my project, but I cannot run FAKE itself with net6 because of this bug. The only workaround I've found so far is to uninstall the net6 SDK, run FAKE far enough through the build that something seems to get cached on disk that prevents recurrence of this bug when running again, then re-installing the net6 SDK. Needless to say this isn't exactly ergonomic and has turned out to be error-prone for other reasons.
@macklindemetrix You can choose to use a specific version of dotnet SDK, by specifying it in a global.json file, see https://learn.microsoft.com/en-gb/dotnet/core/tools/global-json. If you want to run FAKE using one Sdk, and want to run the app using another, I believe this can be accomplished using multiple global.json files.
Does it still fail? Is only .NET 7 supported on Mac ARM?