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

Linux Support #60

Open
Sirbucket opened this issue Jun 5, 2021 · 36 comments
Open

Linux Support #60

Sirbucket opened this issue Jun 5, 2021 · 36 comments
Labels
backlog Backlogged ticket with no activity. editor-request Suggestion or request for a new feature. help wanted Issue requires additional help.

Comments

@Sirbucket
Copy link

You need to create a configure.sh file for linux support in order to make a makefile to install the program. WINE version cannot detect hidden files due to using a crappy file manager so no steam files.

@Sirbucket
Copy link
Author

Basically you need to either rewrite the program to support linux or you need to change how to find files so the WINE version will work, I'd recommend creating a window where you can type the path to custom.

@CriticalFlaw CriticalFlaw added the backlog Backlogged ticket with no activity. label Jun 5, 2021
@CriticalFlaw CriticalFlaw added the help wanted Issue requires additional help. label Jun 16, 2021
@CriticalFlaw
Copy link
Owner

I'm not opposed to adding Linux support, but I don't have the spare time to set up a Linux machine to develop and test this right now. If anyone else wants to take this one, they are welcome to do so.

@CriticalFlaw CriticalFlaw changed the title Needs a configuration file for linux support. Configure the editor to work on Linux Jun 24, 2021
@CriticalFlaw CriticalFlaw changed the title Configure the editor to work on Linux Linux Support Jun 26, 2021
@CriticalFlaw CriticalFlaw self-assigned this Jun 27, 2021
@CriticalFlaw CriticalFlaw linked a pull request Jul 2, 2021 that will close this issue
@CriticalFlaw CriticalFlaw removed their assignment Jul 5, 2021
@SlawekNowy
Copy link

This is a .NET 5 program using WPF. WPF internally uses DX9, which is already emulated by Wine. Nobody made the proof of concept yet.

Alternatively we can replace WPF with Avalonia.

Hidden files start with a dot in Linux. To avoid cross-distro imcompability we need to use ~/.steam/root symlink and go from there.

@gmemstr
Copy link

gmemstr commented Aug 12, 2021

Taking a look into what can be done to natively support this. WPF not being available on Linux is a major blocker so we might need to do something else? Unsure, still in early stages of poking around.

@CriticalFlaw
Copy link
Owner

Perhaps the upcoming .NET MAUI will be the way to go. https://docs.microsoft.com/en-us/dotnet/maui/what-is-maui

@gmemstr
Copy link

gmemstr commented Aug 12, 2021

Certainly seems like a good way to go, but there is no mention of Linux on that page, and I can't find any evidence that they want to support it.

@CriticalFlaw
Copy link
Owner

CriticalFlaw commented Aug 13, 2021

I should have read more into it before posting it here, my bad. You're right, it looks like Microsoft is still holding a grudge against Linux and purposely making it hard to support it. Linux features are being built into Windows but it's a one way street.

@gmemstr
Copy link

gmemstr commented Aug 15, 2021

So I guess the question is, are we okay with moving to a totally different UI library/framework? It doesn't seem like there are any that are drop in replacements but I'm willing to put in the legwork to make the transition if that's something you're okay with @CriticalFlaw.

@CriticalFlaw
Copy link
Owner

I'm honestly not too keen on switching frameworks for this purpose. Instead I'm wondering if having a companion web app would be a better alternative. We may be able to carry over more of the code and have it be accessible for everyone.

@gmemstr
Copy link

gmemstr commented Aug 19, 2021

A webapp would be neat, sort of the same vein as the Toonhud customiser? I 100% agree that switching frameworks isn't the best move in this case, especially since the interface for each hud is generated so it's not a super straightforward port.

@CriticalFlaw CriticalFlaw removed a link to a pull request Aug 21, 2021
@CriticalFlaw CriticalFlaw added editor-request Suggestion or request for a new feature. and removed backlog Backlogged ticket with no activity. labels Sep 2, 2021
@CriticalFlaw
Copy link
Owner

Could this run on the Steam Deck OS w/proton?

@PoorPocketsMcNewHold
Copy link

You mean to say wine, as Proton is not meant to be used for Applications, really.
After installing Microsoft DotNet in the wine prefix (Create a prefix, install it via the Windows installer, as it seems winetricks doesn't support this version), it works fine.
image
Is perfectly able to work with the native TF2 linux directory (It's not really that different, however, you should consider renaming the downloaded hud folders to lowercase as it is case-sensitive !)
Capture d’écran du 2022-11-20 19-16-23
The checkboxes aren't visible however Seems a classic .net 6 thing
image
Note the little selection box.
The application, however, is unable to make any modifications to the downloaded HUD.

@CriticalFlaw
Copy link
Owner

@PoorPocketsMcNewHold Interesting. Thank you for looking into it. Could you please do a write up of how you set it up in Linux? It will be useful for other users who are on it.

Will need to see how the checkedbox and modifications can be fixed for that build. I'm sure the latter can be fixed someway

@CriticalFlaw CriticalFlaw pinned this issue Nov 20, 2022
@CriticalFlaw CriticalFlaw added the backlog Backlogged ticket with no activity. label Dec 17, 2022
@DuendeInexistente
Copy link

You need to create a configure.sh file for linux support in order to make a makefile to install the program. WINE version cannot detect hidden files due to using a crappy file manager so no steam files.

Wine can work with hidden files, it's just disabled by default. Check the drive tab in winecfg.

@CriticalFlaw CriticalFlaw self-assigned this Apr 5, 2023
@CriticalFlaw CriticalFlaw unpinned this issue Apr 5, 2023
@CriticalFlaw CriticalFlaw removed their assignment May 25, 2023
@CriticalFlaw CriticalFlaw pinned this issue Jul 23, 2023
@CriticalFlaw
Copy link
Owner

Need someone to download the latest from the master branch, compile and test in Linux. Just to get a better sense of where it's at currently.

@SlawekNowy
Copy link

Welp...

[slawomir@slawomir-hppavilionlaptop15cc5xx src]$ LANG=C dotnet build
MSBuild version 17.6.3+07e294721 for .NET
  Determining projects to restore...
/usr/share/dotnet/sdk/7.0.304/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(90,5): error NETSDK1100: To build a project targeting Windows on this operating system, set the EnableWindowsTargeting property to true. [/home/slawomir/TF2HUD.Editor/src/TF2HUD.Editor/HUDEditor.csproj]

Build FAILED.

/usr/share/dotnet/sdk/7.0.304/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(90,5): error NETSDK1100: To build a project targeting Windows on this operating system, set the EnableWindowsTargeting property to true. [/home/slawomir/TF2HUD.Editor/src/TF2HUD.Editor/HUDEditor.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.61

@CriticalFlaw
Copy link
Owner

Welp...

[slawomir@slawomir-hppavilionlaptop15cc5xx src]$ LANG=C dotnet build
MSBuild version 17.6.3+07e294721 for .NET
  Determining projects to restore...
/usr/share/dotnet/sdk/7.0.304/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(90,5): error NETSDK1100: To build a project targeting Windows on this operating system, set the EnableWindowsTargeting property to true. [/home/slawomir/TF2HUD.Editor/src/TF2HUD.Editor/HUDEditor.csproj]

Build FAILED.

/usr/share/dotnet/sdk/7.0.304/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(90,5): error NETSDK1100: To build a project targeting Windows on this operating system, set the EnableWindowsTargeting property to true. [/home/slawomir/TF2HUD.Editor/src/TF2HUD.Editor/HUDEditor.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.61

What happens if you set EnableWindowsTargeting to true in the project settings file as instructed in the error?

@SlawekNowy
Copy link

tf2hud.log
Really? Refs to windows exlusive bins?

@CriticalFlaw
Copy link
Owner

In Visual Studio, we have a post-build script to remove certain language files. Looks like the command to do so does not work on Linux. Try removing it and building again.

image

Here's the section in the csproj file: https://github.com/CriticalFlaw/TF2HUD.Editor/blob/master/src/TF2HUD.Editor/HUDEditor.csproj#L147

@SlawekNowy
Copy link

SlawekNowy commented Jul 24, 2023

While now it runs, it does not like all "System.Windows" refs.

[slawomir@slawomir-hppavilionlaptop15cc5xx net7.0-windows]$ ./TF2HUD.Editor 
You must install or update .NET to run this application.

App: /home/slawomir/TF2HUD.Editor/src/TF2HUD.Editor/bin/Debug/net7.0-windows/TF2HUD.Editor
Architecture: x64
Framework: 'Microsoft.WindowsDesktop.App', version '7.0.0' (x64)
.NET location: /usr/share/dotnet

No frameworks were found.

Learn about framework resolution:
https://aka.ms/dotnet/app-launch-failed

To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.WindowsDesktop.App&framework_version=7.0.0&arch=x64&rid=manjaro-x64


This is clear due to dotnet/core#4743

@CriticalFlaw
Copy link
Owner

@SlawekNowy was this test attempted with wine?

@SlawekNowy
Copy link

No. Not yet. "dotnet build" packages native dotnet runtime into an application. I would need to package the windows one.

@SlawekNowy
Copy link

SlawekNowy commented Jul 27, 2023

After "LANG=C dotnet build --os win" in project directory, run fails with:

0090:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
0090:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
0090:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
0090:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
A fatal error occurred, the required library hostfxr.dll could not be found in [
Z:\usr\share\dotnet\host\fxr\7.0.9]
0138:fixme:advapi:RegisterEventSourceW ((null),L".NET Runtime"): stub
0138:fixme:advapi:ReportEventW (00000000CAFE4242,0x0001,0x0000,0x000003ff,0000000000000000,0x0001,0x00000000,000000000019FC90,0000000000000000): stub
0138:err:eventlog:ReportEventW L"Description: A .NET application failed.\n"
0138:err:eventlog:ReportEventW L"Application: TF2HUD.Editor.exe\n"
0138:err:eventlog:ReportEventW L"Path: Z:\\home\\slawomir\\TF2HUD.Editor\\src\\TF2HUD.Editor\\bin\\Debug\\net7.0-windows\\win-x64\\TF2HUD.Editor.exe\n"
0138:err:eventlog:ReportEventW L"Message: A fatal error occurred, the required library hostfxr.dll could not be found in [Z:\\usr\\share\\dotnet\\host\\fxr\\7.0.9]\n"
0138:err:eventlog:ReportEventW L"\n"
0138:fixme:advapi:DeregisterEventSource (00000000CAFE4242) stub

It seems that the path to hostfxr is a linux one. Howver no Linux path exists in the built json files. Let's try adding the .net runtime to wineprefix.

EDIT: That did not work. I have to bundle the whole dotnet runtime.

@SlawekNowy
Copy link

In linux we don't seem to bundle the whole runtime... That is pushed via special nuget packages

@SlawekNowy
Copy link

SlawekNowy commented Jul 27, 2023

I fidlled some more. Adding "RuntimeIdentifiers" property to csproj (win-x64 and win-x86) fixed the problem.
Only self-contained builds are functional though.

@CriticalFlaw
Copy link
Owner

That shouldn't be an issue. I can mark a self-contained build as Linux specific. If this change works could you please 1. Create a PR for any changes that need to be included in the editor and 2. Do a write up of the steps needed to get this to running on Linux please?

@SlawekNowy
Copy link

SlawekNowy commented Jul 27, 2023

Here's the thing. I presume the build I would publish would have no difference in functionality and stability as the Windows one.

This is due to a fact, that since .net core (and version 5 since) both use same underlying nuget package as an base overlay for such apps. Namely "Microsoft.NETCore.App.Host.win-x64" "Microsoft.NETCore.App.Runtime.win-x64". Internally Runtime package is copied without changes, and the AppHost one would have slight modification to run our compiled application.

Both ours and Runtime's code would be the same either way.

@SlawekNowy
Copy link

Plus now I don't even have TF2 installed right now.

@SlawekNowy
Copy link

In order to build that on linux (after removing the PostBuild step) you would have to run "dotnet publish -r win-x64 -c Release --self-contained". The command explicitely metions the RID of the runtime, configuration and the "Bundle the runtime" flag. Similiar command would be run on linux, but RID of the runtime would be by default "win-x64".

@SlawekNowy
Copy link

Additionnally the exported executable would not have an icon.

@SlawekNowy
Copy link

It's kinda worse: The executable on linux (for me) freezes on start with dxvk, or crashes without.

@SlawekNowy
Copy link

Funnily enough running build done on Linux in Windows works perfectly.

@SlawekNowy
Copy link

So we're going in circles.

@CriticalFlaw
Copy link
Owner

I think the conclusion is that unless we re-write the editor in a cross-compatible language there's no proper way to get the editor (in its current state) to work on Linux.

@Ristovski
Copy link

The only issue is the WPF GUI framework, which is not supported natively on Linux. Otherwise, there is nothing preventing it from running on Linux (that is, doing a dotnet build that targets native linux, instead of wine/windows).

Some projects opt into https://avaloniaui.net/ for this very reason.

@CriticalFlaw CriticalFlaw unpinned this issue Apr 17, 2024
@CriticalFlaw CriticalFlaw self-assigned this Aug 31, 2024
@CriticalFlaw
Copy link
Owner

The only issue is the WPF GUI framework, which is not supported natively on Linux. Otherwise, there is nothing preventing it from running on Linux (that is, doing a dotnet build that targets native linux, instead of wine/windows).

Some projects opt into https://avaloniaui.net/ for this very reason.

A year late but thank you for the suggestion. I'm working on the next release (dev branch) and will see how feasible it is to adopt Avalonia into the codebase for Linux support

@CriticalFlaw CriticalFlaw removed their assignment Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Backlogged ticket with no activity. editor-request Suggestion or request for a new feature. help wanted Issue requires additional help.
Projects
None yet
Development

No branches or pull requests

7 participants