BizHawk icon indicating copy to clipboard operation
BizHawk copied to clipboard

[🐧] ARM (AArch64) Linux port discussion

Open InfamousKnight opened this issue 1 year ago • 38 comments

edit for future humans: Ignore this user's yapping, as soon as someone with a real ARM desktop tried it, it did for the most part "just work". If you run into any missing libraries (known: sqlite) then please let me know. --yoshi Original discussion of Android/VM hacks follows.


So the only solution i can think of is using mkbundle to make it x86_64 build so you won't have to install mono.

The only other thing needed is box64. If you install mono on an arm64 machine, it will just install mono arm64 which won't work. It will load the program, but no roms will load.

So far I have managed to get bizhawk running on winlator for android, but it's not very stable. I have ways to run linux on android.

InfamousKnight avatar Sep 24 '24 23:09 InfamousKnight

As I've told you before (https://github.com/TASEmulators/BizHawk/issues/2731#issuecomment-1473030238), it should "just work" if you have an AArch64 copy of Mono, and the same for any native libraries used by a core.

edit: As a workaround, you may also have some success with https://fex-emu.com/ (on macOS, https://mac.getutm.app/). edit edit: Nix ''exec '${pkgs.pkgsCross.*.stdenv.hostPlatform.emulator pkgs}' '${pkgs.pkgsCross.*.hello}' ''

YoshiRulz avatar Sep 25 '24 02:09 YoshiRulz

Oh, I didn't know it was that simple.. sorry

On Tue, Sep 24, 2024, 10:47 PM James Groom @.***> wrote:

As I've told you before (#2731 (comment) https://github.com/TASEmulators/BizHawk/issues/2731#issuecomment-1473030238), it should "just work" if you have a AArch64 copy of Mono, and the same for any native libraries used by a core.

— Reply to this email directly, view it on GitHub https://github.com/TASEmulators/BizHawk/issues/4052#issuecomment-2372780534, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAT4W4KXAZMDMO5A5HQHZV3ZYIP5ZAVCNFSM6AAAAABOZKYOB2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZSG44DANJTGQ . You are receiving this because you authored the thread.Message ID: @.***>

InfamousKnight avatar Sep 25 '24 03:09 InfamousKnight

c22f2ab4f5df93436a7513a54aaafb3fd5de6120

Retrying this with the same setup, and it crashes at startup with this message:

System.TypeInitializationException: The type initializer for 'BizHawk.Bizware.Graphics.ImGui2DRenderer' threw an exception. ---> System.DllNotFoundException: cimgui assembly:<unknown assembly> type:<unknown type> member:(null)
  at (wrapper managed-to-native) BizHawk.Bizware.Graphics.ImGui2DRenderer.ImDrawListSharedData_ImDrawListSharedData()
  at BizHawk.Bizware.Graphics.ImGui2DRenderer..cctor () [0x00000] in <6943343e38fc431da513df9dd525dff5>:0 
   --- End of inner exception stack trace ---
  at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_generic_class_init(intptr)
  at BizHawk.Bizware.Graphics.IGLExtensions.Create2DRenderer (BizHawk.Bizware.Graphics.IGL gl, BizHawk.Bizware.Graphics.ImGuiResourceCache resourceCache) [0x0000a] in <6943343e38fc431da513df9dd525dff5>:0 
  at BizHawk.Client.Common.DisplayManagerBase..ctor (BizHawk.Client.Common.Config config, BizHawk.Emulation.Common.IEmulator emulator, BizHawk.Client.Common.InputManager inputManager, BizHawk.Client.Common.IMovieSession movieSession, BizHawk.Bizware.Graphics.EDispMethod dispMethod, BizHawk.Bizware.Graphics.IGL gl, BizHawk.Bizware.Graphics.IGuiRenderer renderer) [0x00262] in <8aed7adcbd24456cb47ad9a31acf45af>:0 
  at BizHawk.Client.EmuHawk.DisplayManager..ctor (BizHawk.Client.Common.Config config, BizHawk.Emulation.Common.IEmulator emulator, BizHawk.Client.Common.InputManager inputManager, BizHawk.Client.Common.IMovieSession movieSession, BizHawk.Bizware.Graphics.IGL gl, BizHawk.Client.EmuHawk.PresentationPanel presentationPanel, System.Func`1[TResult] getIsSecondaryThrottlingDisabled) [0x00016] in <5707a324a080454ba4a87492040bbff0>:0 
  at BizHawk.Client.EmuHawk.MainForm..ctor (BizHawk.Client.Common.ParsedCLIFlags cliFlags, BizHawk.Bizware.Graphics.IGL gl, System.Func`1[TResult] getConfigPath, System.Func`1[TResult] getGlobalConfig, System.Action`1[T] updateGlobalSound, System.String[] args, BizHawk.Client.Common.IMovieSession& movieSession, System.Boolean& exitEarly) [0x002d4] in <5707a324a080454ba4a87492040bbff0>:0 
  at (wrapper remoting-invoke-with-check) BizHawk.Client.EmuHawk.MainForm..ctor(BizHawk.Client.Common.ParsedCLIFlags,BizHawk.Bizware.Graphics.IGL,System.Func`1<string>,System.Func`1<BizHawk.Client.Common.Config>,System.Action`1<BizHawk.Client.EmuHawk.Sound>,string[],BizHawk.Client.Common.IMovieSession&,bool&)
  at BizHawk.Client.EmuHawk.Program.SubMain (System.String[] args) [0x003c8] in <5707a324a080454ba4a87492040bbff0>:0 

InfamousKnight avatar Sep 26 '24 11:09 InfamousKnight

I forget if that's used with every display method or just OpenGL, so you could try switching to the GDI+ display method. But I think you'll have to compile libcimgui.so. Or use a build without https://github.com/TASEmulators/BizHawk/commit/476ac94d801beecb284041b1b7c6d5518df0154b.

YoshiRulz avatar Sep 26 '24 19:09 YoshiRulz

I managed to compile libcimgui but the same result happens..

I didn't really follow the instructions on the page, but what I did was: after using git to download the source files, I then changed directory into cimgui and made a new folder called build. Changed to that folder and then cmake.. followed by make.

And I tried to get an older build before the one you posted. Gitlab didn't have any files to download for it. I guess they expire to save storage..

InfamousKnight avatar Sep 26 '24 20:09 InfamousKnight

You would also have the issue of SDL2 being used, which you would also need to compile.

cimgui is also somewhat fragile, you can't just plop in any version, it must be the same version as ImGui.NET expects (otherwise expect weird crashes due to mismatching ABI).

CasualPokePlayer avatar Sep 28 '24 14:09 CasualPokePlayer

Oh yeah, I remember having to install libsdl because it wouldn't even open a window without it.

Seems this has gotten more complicated than I expected..

InfamousKnight avatar Sep 28 '24 14:09 InfamousKnight

The system SDL2 will not be used (and generally cannot be used, there is no guarantee the system SDL2 is new enough). BizHawk will always use the vendored SDL2.

CasualPokePlayer avatar Sep 28 '24 15:09 CasualPokePlayer

So what about sdl3?

InfamousKnight avatar Sep 28 '24 16:09 InfamousKnight

No, that is completely incompatible (hence why it is "3" and not "2")

CasualPokePlayer avatar Sep 28 '24 16:09 CasualPokePlayer

I see.

What are all the required dependencies for ubuntu linux? I feel like I'm missing something still..

InfamousKnight avatar Sep 28 '24 18:09 InfamousKnight

Last I checked, libc6-dev and libopenal1 (which are both likely pre-installed) and mono-complete. Everything else is included with BizHawk and those are going to be what cause problems.

YoshiRulz avatar Sep 28 '24 20:09 YoshiRulz

I guess a solution to this would be to install missing dependencies automatically? Libtas does that. If it can tell me what sort of dependency is missing, it should be able to download and install it.

InfamousKnight avatar Oct 02 '24 14:10 InfamousKnight

You're describing a package as used by a package manager.

YoshiRulz avatar Oct 02 '24 23:10 YoshiRulz

You already have any "missing dependencies" "installed." The issue is again native libraries that we vendor. These are libraries which you cannot install, they have to come with BizHawk. We only offer x64 builds. For us to actually "support" other platforms, we would need to provide native libraries for those other platforms, it would not be on the user. If you want to somehow get another platform working, you need to self-compile all these dependencies. These do not have instructions, as they are not supported, and they might end up failing to compile with our current scripts for all we know.

If you are incapable of figuring out how to self-compile all these dependencies (which frankly, we don't expect you nor any other user to be capable of such), then you should not try to get BizHawk working natively on a non-x64 platform. You should wait for whatever day we decide to support whatever other platforms users want to run BizHawk on and thus actually have builds for such platforms (that, or somehow try to run some x64 emulation setup, although that is likely going to work poorly; if anything, just get any x64 device if you really want to use BizHawk).

CasualPokePlayer avatar Oct 03 '24 00:10 CasualPokePlayer

Yeah, well, at least we're not too far away from this.

Long story short, some IRL events happened that made my laptop kinda useless.

Thank you for trying to explain.

InfamousKnight avatar Oct 03 '24 01:10 InfamousKnight

Update over here: It seems that android 13 supports kvm hypervisor. And root is required to use it.

So I'm afraid if this was to work on an android device, you would need root because of overprotective android.

Irrelevant note: got my x86_64 laptop working fixed. Very impressed by how much bizhawk has improved since 2.9.1.

InfamousKnight avatar Oct 29 '24 18:10 InfamousKnight

Im trying to build cd4e58eacabf04e5a05a4cf2ef15200ac1676e9a for non-86_64 users, and dist/releasebuild.sh has the following errors:

home/sean/Downloads/BizHawk-cd4e58eacabf04e5a05a4cf2ef15200ac1676e9a/src/BizHawk.Common/VersionInfo.cs(42,31): error CS0103: The name 'GIT_BRANCH' does not exist in the current context [/home/sean/Downloads/BizHawk-cd4e58eacabf04e5a05a4cf2ef15200ac1676e9a/src/BizHawk.Common/BizHawk.Common.csproj]
/home/sean/Downloads/BizHawk-cd4e58eacabf04e5a05a4cf2ef15200ac1676e9a/src/BizHawk.Common/VersionInfo.cs(42,44): error CS0103: The name 'GIT_SHORTHASH' does not exist in the current context [/home/sean/Downloads/BizHawk-cd4e58eacabf04e5a05a4cf2ef15200ac1676e9a/src/BizHawk.Common/BizHawk.Common.csproj]

And yes, I'm building it on a x86_64 machine

InfamousKnight avatar Dec 02 '24 18:12 InfamousKnight

The Source Generator must have failed. Do you have Git installed?

YoshiRulz avatar Dec 02 '24 19:12 YoshiRulz

Yes

On Mon, Dec 2, 2024, 2:35 PM YoshiRulz @.***> wrote:

The Source Generator must have failed. Do you have Git installed?

— Reply to this email directly, view it on GitHub https://github.com/TASEmulators/BizHawk/issues/4052#issuecomment-2512582702, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAT4W4KPKZWC372KC7YXE7L2DSY75AVCNFSM6AAAAABOZKYOB2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMJSGU4DENZQGI . You are receiving this because you authored the thread.Message ID: @.***>

InfamousKnight avatar Dec 02 '24 19:12 InfamousKnight

Pass -p:EmitCompilerGeneratedFiles=true and check /src/BizHawk.Common/obj/Release/generated/BizHawk.SrcGen.VersionInfo/BizHawk.SrcGen.VersionInfo.VersionInfoGenerator/VersionInfo.g.cs.

YoshiRulz avatar Dec 03 '24 01:12 YoshiRulz

Pass that where? dist/BuildRelease.sh? when I did that, I got this:

'/home/sean/Downloads/BizHawk-cd4e58eacabf04e5a05a4cf2ef15200ac1676e9a/Dist/BuildRelease.sh' p:EmitCompilerGeneratedFiles=true
running 'dotnet build' in Release configuration, extra args: p:EmitCompilerGeneratedFiles=true
Microsoft (R) Build Engine version 17.0.4+85d71072f for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

MSBUILD : error MSB1008: Only one project can be specified.
Switch: p:EmitCompilerGeneratedFiles=true

For switch syntax, type "MSBuild -help"

InfamousKnight avatar Dec 03 '24 01:12 InfamousKnight

Looks like you missed the hyphen.

YoshiRulz avatar Dec 03 '24 02:12 YoshiRulz

Oh, I noticed that. When I did it correctly, nothing shows in generated

This is what the console outputs:

'/home/sean/Downloads/BizHawk-cd4e58eacabf04e5a05a4cf2ef15200ac1676e9a/Dist/BuildRelease.sh' -p:EmitCompilerGeneratedFiles=true
running 'dotnet build' in Release configuration, extra args: -p:EmitCompilerGeneratedFiles=true
Microsoft (R) Build Engine version 17.0.4+85d71072f for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  All projects are up-to-date for restore.
/home/sean/.nuget/packages/polysharp/1.10.0/buildTransitive/PolySharp.targets(45,5): error : The PolySharp source generators have been disabled on the current configuration, as they need Roslyn 4.3 in order to work. PolySharp requires the source generators to run in order to process shaders, so the library cannot be used without a more up to date IDE (eg. VS 2022 17.3 or greater) or .NET SDK version (.NET 6.0.400 SDK or greater). [/home/sean/Downloads/BizHawk-cd4e58eacabf04e5a05a4cf2ef15200ac1676e9a/src/BizHawk.Bizware.Input/BizHawk.Bizware.Input.csproj]
/home/sean/.nuget/packages/polysharp/1.10.0/buildTransitive/PolySharp.targets(45,5): error : The PolySharp source generators have been disabled on the current configuration, as they need Roslyn 4.3 in order to work. PolySharp requires the source generators to run in order to process shaders, so the library cannot be used without a more up to date IDE (eg. VS 2022 17.3 or greater) or .NET SDK version (.NET 6.0.400 SDK or greater). [/home/sean/Downloads/BizHawk-cd4e58eacabf04e5a05a4cf2ef15200ac1676e9a/src/BizHawk.Bizware.Audio/BizHawk.Bizware.Audio.csproj]
/home/sean/.nuget/packages/polysharp/1.10.0/buildTransitive/PolySharp.targets(45,5): error : The PolySharp source generators have been disabled on the current configuration, as they need Roslyn 4.3 in order to work. PolySharp requires the source generators to run in order to process shaders, so the library cannot be used without a more up to date IDE (eg. VS 2022 17.3 or greater) or .NET SDK version (.NET 6.0.400 SDK or greater). [/home/sean/Downloads/BizHawk-cd4e58eacabf04e5a05a4cf2ef15200ac1676e9a/src/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj]
CSC : warning CS8032: An instance of analyzer BizHawk.Analyzers.FeatureNotImplementedAnalyzer cannot be created from /home/sean/Downloads/BizHawk-cd4e58eacabf04e5a05a4cf2ef15200ac1676e9a/References/BizHawk.Analyzer.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.. [/home/sean/Downloads/BizHawk-cd4e58eacabf04e5a05a4cf2ef15200ac1676e9a/src/BizHawk.Common/BizHawk.Common.csproj]
CSC : warning CS8032: An instance of analyzer BizHawk.Analyzers.FirstOrDefaultOnStructAnalyzer cannot be created from /home/sean/Downloads/BizHawk-cd4e58eacabf04e5a05a4cf2ef15200ac1676e9a/References/BizHawk.Analyzer.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.. [/home/sean/Downloads/BizHawk-cd4e58eacabf04e5a05a4cf2ef15200ac1676e9a/src/BizHawk.Common/BizHawk.Common.csproj]
CSC : warning CS8032: An instance of analyzer BizHawk.Analyzers.HawkSourceAnalyzer cannot be created from /home/sean/Downloads/BizHawk-cd4e58eacabf04e5a05a4cf2ef15200ac1676e9a/References/BizHawk.Analyzer.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.. [/home/sean/Downloads/BizHawk-cd4e58eacabf04e5a05a4cf2ef15200ac1676e9a/src/BizHawk.Common/BizHawk.Common.csproj]
CSC : warning CS8032: An instance of analyzer BizHawk.Analyzers.OrderBySelfAnalyzer cannot be created from /home/sean/Downloads/BizHawk-cd4e58eacabf04e5a05a4cf2ef15200ac1676e9a/References/BizHawk.Analyzer.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.. [/home/sean/Downloads/BizHawk-cd4e58eacabf04e5a05a4cf2ef15200ac1676e9a/src/BizHawk.Common/BizHawk.Common.csproj]
CSC : warning CS8032: An instance of analyzer BizHawk.Analyzers.TryGetValueImplicitDiscardAnalyzer cannot be created from /home/sean/Downloads/BizHawk-cd4e58eacabf04e5a05a4cf2ef15200ac1676e9a/References/BizHawk.Analyzer.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.. [/home/sean/Downloads/BizHawk-cd4e58eacabf04e5a05a4cf2ef15200ac1676e9a/src/BizHawk.Common/BizHawk.Common.csproj]
CSC : warning CS8032: An instance of analyzer BizHawk.Analyzers.UseNameofOperatorAnalyzer cannot be created from /home/sean/Downloads/BizHawk-cd4e58eacabf04e5a05a4cf2ef15200ac1676e9a/References/BizHawk.Analyzer.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.. [/home/sean/Downloads/BizHawk-cd4e58eacabf04e5a05a4cf2ef15200ac1676e9a/src/BizHawk.Common/BizHawk.Common.csproj]
CSC : warning CS8032: An instance of analyzer BizHawk.Analyzers.UseTypeofOperatorAnalyzer cannot be created from /home/sean/Downloads/BizHawk-cd4e58eacabf04e5a05a4cf2ef15200ac1676e9a/References/BizHawk.Analyzer.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.. [/home/sean/Downloads/BizHawk-cd4e58eacabf04e5a05a4cf2ef15200ac1676e9a/src/BizHawk.Common/BizHawk.Common.csproj]
CSC : warning CS8032: An instance of analyzer BizHawk.SrcGen.ReflectionCache.ReflectionCacheGenerator cannot be created from /home/sean/Downloads/BizHawk-cd4e58eacabf04e5a05a4cf2ef15200ac1676e9a/References/BizHawk.SrcGen.ReflectionCache.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.. [/home/sean/Downloads/BizHawk-cd4e58eacabf04e5a05a4cf2ef15200ac1676e9a/src/BizHawk.Common/BizHawk.Common.csproj]
CSC : warning CS8032: An instance of analyzer BizHawk.SrcGen.VersionInfo.VersionInfoGenerator cannot be created from /home/sean/Downloads/BizHawk-cd4e58eacabf04e5a05a4cf2ef15200ac1676e9a/References/BizHawk.SrcGen.VersionInfo.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.. [/home/sean/Downloads/BizHawk-cd4e58eacabf04e5a05a4cf2ef15200ac1676e9a/src/BizHawk.Common/BizHawk.Common.csproj]
/home/sean/Downloads/BizHawk-cd4e58eacabf04e5a05a4cf2ef15200ac1676e9a/src/BizHawk.Common/checksums/CRC32.cs(72,15): warning CS8602: Dereference of a possibly null reference. [/home/sean/Downloads/BizHawk-cd4e58eacabf04e5a05a4cf2ef15200ac1676e9a/src/BizHawk.Common/BizHawk.Common.csproj]
/home/sean/Downloads/BizHawk-cd4e58eacabf04e5a05a4cf2ef15200ac1676e9a/src/BizHawk.Common/VersionInfo.cs(42,31): error CS0103: The name 'GIT_BRANCH' does not exist in the current context [/home/sean/Downloads/BizHawk-cd4e58eacabf04e5a05a4cf2ef15200ac1676e9a/src/BizHawk.Common/BizHawk.Common.csproj]
/home/sean/Downloads/BizHawk-cd4e58eacabf04e5a05a4cf2ef15200ac1676e9a/src/BizHawk.Common/VersionInfo.cs(42,44): error CS0103: The name 'GIT_SHORTHASH' does not exist in the current context [/home/sean/Downloads/BizHawk-cd4e58eacabf04e5a05a4cf2ef15200ac1676e9a/src/BizHawk.Common/BizHawk.Common.csproj]

InfamousKnight avatar Dec 03 '24 02:12 InfamousKnight

You're expected to use the .NET 8 SDK at least, whatever SDK you're using is too old.

CasualPokePlayer avatar Dec 03 '24 03:12 CasualPokePlayer

Got it compiled.. Just weird issues I'm facing with android for now

InfamousKnight avatar Dec 03 '24 04:12 InfamousKnight

I managed to compile a build right before 476ac94 and this is what I achieved so far:

Screenshot_20241227_143517_NOMone Desktop

Unfortunately, it's doesn't tell me much this time around. That's what happens when opening a ds rom. Opening a gba rom doesn't work and just says something about .so file not existing. Likely because it's not compiled for arm. As for fex-emu, I don't have a real arm64 machine until android 16 is available for my device. I can test it on my computer with a preview build.

InfamousKnight avatar Dec 27 '24 19:12 InfamousKnight

Many cores in fact come from native libraries, none of which are compiled for ARM64 (and many of which are not trivial to be compiled for ARM64, i.e. literally every wbx core). For non-wbx cores, it should be possible to recompile the cores for ARM64, and pure C# cores should mostly work out of the box (except most will likely need to have blip_buf also recompiled for ARM64).

CasualPokePlayer avatar May 11 '25 06:05 CasualPokePlayer

After cutting out Magick.NET from the testroms project and building a native blip_buf, SMSHawk was confirmed to work on ARM by @Masterjun3 (tysm). So it didn't include WinForms or any unmanaged libraries besides blip_buf, but it's a good sign. edit: And after building cimgui and our fork of SDL2, EmuHawk runs! edit edit: I've also gotten confirmation from dwango of it running on a Pi 5(?).

YoshiRulz avatar Oct 27 '25 22:10 YoshiRulz

Oh cool. Does it have to be recompiled on an arm64 machine to use? In that case, you may need a separate arm64 binary for convience.

InfamousKnight avatar Oct 28 '25 13:10 InfamousKnight