jsuarezruiz / maui-linux

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://devblogs.microsoft.com/dotnet/introducing-net-multi-platform-app-ui/
MIT License
822 stars 33 forks source link

Can't build on Linux #93

Open webwarrior-ws opened 3 weeks ago

webwarrior-ws commented 3 weeks ago

Description

Can't build Maui main-linux branch on Linux. Neither using cake command, nor building Maui.Controls.Sample project, nor by referencing from another project. I get errors about missing wasi-experimental workload (see attached log). I specify --framework=net8.0-gtk in dotnet build command. I have .NET 8 (8.0.105 sdk) with gtk workload installed.

Steps to Reproduce

No response

Link to public reproduction project repository

No response

Version with bug

Nightly / CI build (Please specify exact version)

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

6.0

Affected platforms

Other (Tizen, Linux, etc. not supported by Microsoft directly)

Affected platform versions

GTK

Did you find any workaround?

No response

Relevant log output

dotnet build --framework=net8.0-gtk ./src/Controls/samples/Controls.Sample/Maui.Controls.Sample.csproj
MSBuild version 17.8.5+b5265ef37 for .NET
  Determining projects to restore...
  Skipping project "/home/ubuntu/geewallet-build/geewallet/dependencies/maui/src/Controls/src/Core/Controls.SourceGen.csproj" because it was not found.
  Skipping project "/home/ubuntu/geewallet-build/geewallet/dependencies/maui/src/Controls/src/Core/Controls.SourceGen.csproj" because it was not found.
/usr/lib/dotnet/sdk/8.0.105/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To build this project, the following workloads must be installed: wasi-experimental [/home/ubuntu/geewallet-build/geewallet/dependencies/maui/src/BlazorWebView/src/Maui/Microsoft.AspNetCore.Components.WebView.Maui.csproj::TargetFramework=net8.0-ios]
/usr/lib/dotnet/sdk/8.0.105/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To install these workloads, run the following command: dotnet workload restore [/home/ubuntu/geewallet-build/geewallet/dependencies/maui/src/BlazorWebView/src/Maui/Microsoft.AspNetCore.Components.WebView.Maui.csproj::TargetFramework=net8.0-ios]
/usr/lib/dotnet/sdk/8.0.105/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To build this project, the following workloads must be installed: wasi-experimental [/home/ubuntu/geewallet-build/geewallet/dependencies/maui/src/Essentials/src/Essentials.csproj::TargetFramework=net8.0-ios]
/usr/lib/dotnet/sdk/8.0.105/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To install these workloads, run the following command: dotnet workload restore [/home/ubuntu/geewallet-build/geewallet/dependencies/maui/src/Essentials/src/Essentials.csproj::TargetFramework=net8.0-ios]
/usr/lib/dotnet/sdk/8.0.105/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To build this project, the following workloads must be installed: wasi-experimental [/home/ubuntu/geewallet-build/geewallet/dependencies/maui/src/Controls/src/Core/Controls.Core.csproj::TargetFramework=net8.0-ios]
/usr/lib/dotnet/sdk/8.0.105/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To install these workloads, run the following command: dotnet workload restore [/home/ubuntu/geewallet-build/geewallet/dependencies/maui/src/Controls/src/Core/Controls.Core.csproj::TargetFramework=net8.0-ios]
/usr/lib/dotnet/sdk/8.0.105/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To build this project, the following workloads must be installed: wasi-experimental [/home/ubuntu/geewallet-build/geewallet/dependencies/maui/src/Controls/src/Xaml/Controls.Xaml.csproj::TargetFramework=net8.0-ios]
/usr/lib/dotnet/sdk/8.0.105/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To install these workloads, run the following command: dotnet workload restore [/home/ubuntu/geewallet-build/geewallet/dependencies/maui/src/Controls/src/Xaml/Controls.Xaml.csproj::TargetFramework=net8.0-ios]
/usr/lib/dotnet/sdk/8.0.105/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To build this project, the following workloads must be installed: wasi-experimental [/home/ubuntu/geewallet-build/geewallet/dependencies/maui/src/Core/src/Core.csproj::TargetFramework=net8.0-ios]
/usr/lib/dotnet/sdk/8.0.105/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To install these workloads, run the following command: dotnet workload restore [/home/ubuntu/geewallet-build/geewallet/dependencies/maui/src/Core/src/Core.csproj::TargetFramework=net8.0-ios]
/usr/lib/dotnet/sdk/8.0.105/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To build this project, the following workloads must be installed: wasi-experimental [/home/ubuntu/geewallet-build/geewallet/dependencies/maui/src/Controls/Foldable/src/Controls.Foldable.csproj::TargetFramework=net8.0-ios]
/usr/lib/dotnet/sdk/8.0.105/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To install these workloads, run the following command: dotnet workload restore [/home/ubuntu/geewallet-build/geewallet/dependencies/maui/src/Controls/Foldable/src/Controls.Foldable.csproj::TargetFramework=net8.0-ios]
/usr/lib/dotnet/sdk/8.0.105/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To build this project, the following workloads must be installed: wasi-experimental [/home/ubuntu/geewallet-build/geewallet/dependencies/maui/src/Graphics/src/Graphics/Graphics.csproj::TargetFramework=net8.0-ios]
/usr/lib/dotnet/sdk/8.0.105/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To install these workloads, run the following command: dotnet workload restore [/home/ubuntu/geewallet-build/geewallet/dependencies/maui/src/Graphics/src/Graphics/Graphics.csproj::TargetFramework=net8.0-ios]
/usr/lib/dotnet/sdk/8.0.105/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To build this project, the following workloads must be installed: wasi-experimental [/home/ubuntu/geewallet-build/geewallet/dependencies/maui/src/Core/maps/src/Maps.csproj::TargetFramework=net8.0-ios]
/usr/lib/dotnet/sdk/8.0.105/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To install these workloads, run the following command: dotnet workload restore [/home/ubuntu/geewallet-build/geewallet/dependencies/maui/src/Core/maps/src/Maps.csproj::TargetFramework=net8.0-ios]
/usr/lib/dotnet/sdk/8.0.105/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To build this project, the following workloads must be installed: wasi-experimental [/home/ubuntu/geewallet-build/geewallet/dependencies/maui/src/Controls/Maps/src/Controls.Maps.csproj::TargetFramework=net8.0-ios]
/usr/lib/dotnet/sdk/8.0.105/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To install these workloads, run the following command: dotnet workload restore [/home/ubuntu/geewallet-build/geewallet/dependencies/maui/src/Controls/Maps/src/Controls.Maps.csproj::TargetFramework=net8.0-ios]
webwarrior-ws commented 3 weeks ago

If I install wasi-experimental workload, I get errors like:

/usr/lib/dotnet/sdk/8.0.105/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(117,5): error NETSDK1139: The target platform identifier ios was not recognized. [/home/ubuntu/geewallet-build/geewallet/dependencies/maui/src/Controls/src/Core/Controls.Core.csproj::TargetFramework=net8.0-ios]

Even though I specify net8.0-gtk target framework.

knocte commented 3 weeks ago

@jsuarezruiz we are using successfully a fork of your fork in .NET6: http://github.com/nblockchain/Mali

However, when trying to rebase our work on top of your latest commits, we are facing the build issues above. Can you help?

@lytico ping? maybe you know?

BTW, where did the folder src/Core/src/Platform/Gtk/ go???

webwarrior-ws commented 3 weeks ago

I was able to get rid of those errors by modifying Directory.Build.Props to include only gtk platform: https://github.com/webwarrior-ws/maui/commit/96194ceff79a8204f275a38690148364b1645176. Still, can't bulid Maui.Controls.Sample project because there is no Main method for Gtk:

CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point [/home/ubuntu/geewallet-build/geewallet/dependencies/maui/src/Controls/samples/Controls.Sample/Maui.Controls.Sample.csproj::TargetFramework=net8.0-gtk]

And I can't port Main.cs from .NET6 fork because there is no MauiGtkApplication class.

knocte commented 2 weeks ago

@jsuarezruiz we have found out that the issue is that your default branch is set to main-linux but it should be set to main, because main-linux doesn't contain the latest GTK bits (it only has the XamarinForms old GTK backend), while main branch has it. Once you change the default branch, this issue can be closed.