ionide / Fornax

Scriptable static site generator using type safe F# DSL to define page templates.
MIT License
241 stars 44 forks source link

How to install on MacOS arm64? #121

Closed mturilin closed 1 year ago

mturilin commented 1 year ago

I'm trying to install Fornax on macOS on Apple Silicon. As a prerequisite, I installed .NET SDK 6 and 7 using homebrew.

So far I tried the following:

Method 1: dotnet tool install fornax -g

The install was successful. However the tool doesn't run:

$ fornax
Failed to load /usr/local/share/dotnet/host/fxr/7.0.1/libhostfxr.dylib, error: dlopen(/usr/local/share/dotnet/host/fxr/7.0.1/libhostfxr.dylib, 0x0001): tried: '/usr/local/share/dotnet/host/fxr/7.0.1/libhostfxr.dylib' (mach-o file, but is an incompatible architecture (have (arm64), need (x86_64)))
The library libhostfxr.dylib was found, but loading it from /usr/local/share/dotnet/host/fxr/7.0.1/libhostfxr.dylib failed
  - Installing .NET prerequisites might help resolve this problem.
     https://go.microsoft.com/fwlink/?linkid=2063366

Method 2: Install from source

  1. Cloned github repo
  2. dotnet tool install - works
  3. dotnet fake build - complained to dotnet 7 instead of 6
  4. Switched to dotnet 6
  5. dotnet fake build
    The last restore is still up to date. Nothing left to do.
    Starting task 'DotNet:version': running dotnet --version
    6.0.404
    Finished (Success) 'DotNet:version' in 00:00:00.4763610
    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.
    Hint: Detected paket version '5.257.0' in your paket.dependencies file bootstrapper arguments, consider locking the version to '6.2.1' in your dependencies file (/Users/mikhail/Development/tools/Fornax/paket.dependencies).
    Read https://github.com/fsharp/FAKE/issues/2193 for details.
  6. Change the first line in packet.dependencies to version 6.2.1
  7. dotnet fake build
    dotnet fake build
    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.

    At this point 🤷‍♂️

Any ideas where to go from here?

baronfel commented 1 year ago

can you try specifying the --arch parameter on the tool install command, like so: dotnet tool install fornax -g --arch arm64?

mturilin commented 1 year ago

It worked!

baronfel commented 1 year ago

This is one of a series of fixes to .NET SDK tools that we hope to address in the .NET 8 time frame. In the meantime, happy this worked for you :)

mturilin commented 1 year ago

build fails thought

mikhail@MacBook-Air blog3 % fornax build
Load Errors: [|/Users/mikhail/Development/personal/blog3/generators/layout.fsx (67,53)-(67,59) typecheck error The union cases or fields of the type 'HtmlElement' are not accessible from this code location;
  /Users/mikhail/Development/personal/blog3/generators/layout.fsx (67,53)-(67,89) typecheck error All elements of a list must be implicitly convertible to the type of the first element, which here is 'HtmlProperties'. This element has type 'HtmlElement'.|]
Open Errors: [|input.fsx (1,6)-(1,11) typecheck error The namespace or module 'Index' is not defined.|]
Get generator Errors: [|input.fsx (1,16)-(1,24) typecheck error The value or constructor 'generate' is not defined. Maybe you want one of the following:
   Generating
   GenerationPhase
   GeneratorConfig
   GeneratorOutput
   GeneratorTrigger|]
[11:27:13] multiple files generation failed

it's a completely new site generated by fornax new - could it be related to the architecture?