Add Architecture Detection
This PR is a WIP draft working to implement ELF interpreter support from box64 and/or FEX-EMU and/or Wine Hangover in order to be able to install current Logos 64bit versions on Linux 32 bit, ARM 32 bit, ARM 64 bit, RISC-V 32 bit and RISC-V 64-bit.
The current code errors during install and exits the program if the architecture is not x86_64.
Technically the ELF interpreters could let us install modern Logos 10 on x86 machines (not x86_64).
cf. #24
The initial PR is to get the basics in place for us to play with.
Tested the latest push on my PineTab2 with box64 installed. The program loads after being compiled as an ARM64 binary.
I attempted to load the prebuilt binary and it errored. See:
https://github.com/ptitSeb/box64/issues/1841
When running the latest box64 source, the AppImage fails to run. See:
https://github.com/ptitSeb/box64/issues/1672
That being said, installing wine64 via pacman with --arch yields a working binary under box64.
Install Test
After installing a wine-staging binary on Manjaro (version 9.8) and adjusting the minimum wine version for Logos 30+ to 9.8 from 9.10, I ran the installer and the wine binary appeared in the list. I had to skip dependencies and the installer continued, downloading the latest msi file. After downloading, wine ran in order to create the wine bottle. Due to Plasma Mobile's default maximizing of all windows, the wineboot window appeared maximized.
The installer then errored here:
2024-09-20 00:08:02 ERROR: An error occurred in run_control_panel(): OS error: [Errno 24] Too many open files
Traceback (most recent call last):
File "dialog.py", line 259, in _OSErrorHandling
File "dialog.py", line 1332, in _call_program
OSError: [Errno 24] Too many open files
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "main.py", line 447, in <module>
main()
File "main.py", line 424, in main
config.ACTION()
File "main.py", line 307, in run_control_panel
raise e
File "main.py", line 292, in run_control_panel
curses.wrapper(tui_app.control_panel_app)
File "curses/__init__.py", line 94, in wrapper
File "tui_app.py", line 706, in control_panel_app
TUI(stdscr).run()
File "tui_app.py", line 245, in run
self.display()
File "tui_app.py", line 214, in display
self.active_screen.display()
File "tui_screen.py", line 370, in display
tui_dialog.progress_bar(self, self.text, self.percent)
File "tui_dialog.py", line 37, in progress_bar
dialog.gauge_start(text=text, percent=percent, **options)
File "dialog.py", line 2579, in gauge_start
File "dialog.py", line 1329, in _call_program
File "contextlib.py", line 158, in __exit__
File "dialog.py", line 261, in _OSErrorHandling
dialog.PythonDialogOSError: OS error: [Errno 24] Too many open files
[PYI-7462:ERROR] Failed to execute script 'main' due to unhandled exception!
I ran the installer again and it proceeded to the winetricks commands, which appeared to be executed flawlessly. During winetricks calls, I again hit the too many open files error above.
I ran the installer again, this time skipping winetricks. The ICU data files downloaded and were installed and verified. At which point it switched to installing Logos. LLI ran the command to install the MSI and the installer window opened. I proceeded through the installer (e.g., accepted terms).
As it ran, it errored again for having too many open files with PythonDialog, but the MSI installer window continued chugging along. I hit finish.
I removed dialog from the system and ran the install again. It found that Logos was installed and asked me to update the config file. It then created the desktop files.
00:45:35 [thwright@thw-pt2 ~] cat .config/Logos_on_Linux/Logos_on_Linux.json
{
"BACKUPDIR": null,
"FLPRODUCT": "Logos",
"FLPRODUCTi": "logos4",
"INSTALLDIR": "/home/thwright/LogosBible10",
"LAST_UPDATED": "2024-09-20T00:41:46",
"LLI_LATEST_VERSION": "4.0.0-alpha.14",
"LOGS": null,
"RECOMMENDED_WINE64_APPIMAGE_URL": "https://github.com/FaithLife-Community/wine-appimages/releases/download/9.12-devel/wine-devel_9.12-x86_64.AppImage",
"TARGETVERSION": "10",
"TARGET_RELEASE_VERSION": "36.1.0.0006",
"WINEBIN_CODE": "System",
"WINECMD_ENCODING": null,
"WINETRICKSBIN": "/home/thwright/LogosBible10/data/bin/winetricks",
"WINE_EXE": "/usr/bin/wine64",
"current_logos_version": "36.1.0.6"
}
Due to existing issues, the main menu was not updated (to be fixed with #164). I exited the program, launched it again, and hit Run Logos.
The log indicates the wine command was properly launched. The splash screen appeared, but the splash didn't transition to the login window. It threw this error:
2024-09-20 00:22:21 INFO: wine: Unhandled exception 0xe0434352 in thread 134 at address 00006FFFFFC23DE7 (thread 0134), starting debugger...
Because I skipped the winetricks portion earlier due to PythonDialog, I set the renderer, Windows version, and installed the fonts. Oh, how installing fonts is a drag!
Due to some issue, the winetricks menu options were not working, so I had to run these things through Winetricks itself. The program complained during font install that cabextract was missing, so I told it to install it. On restart, I ran the Install Dependencies command in order to install the fonts. It also found a few packages were missing, so I ran those, but I bumped into #143. 7-zip-full was not found, but I installed alsa-plugins and fuse2. With those installed, I skipped 7-zip-full with -K on another install deps. Oh… how installing… fonts… is… slow…
Other options applied, but d3dcompiler failed. Because I don't have 7zip?
Assuming that most of the dependencies were now in place, I ran Logos again. The splash loaded but I again saw:
2024-09-20 01:18:53 INFO: wine: Unhandled exception 0xe0434352 in thread 130 at address 00006FFFFFC23DE7 (thread 0130), starting debugger...
I ran Logos again with -D. I got the following error:
2024-09-20 01:21:12 INFO: 0134:err:eventlog:ReportEventW L"Application: Logos.exe\n"
2024-09-20 01:21:12 INFO: 0134:err:eventlog:ReportEventW L"CoreCLR Version: 8.0.724.31311\n"
2024-09-20 01:21:12 INFO: 0134:err:eventlog:ReportEventW L".NET Version: 8.0.7\n"
2024-09-20 01:21:12 INFO: 0134:err:eventlog:ReportEventW L"Description: The process was terminated due to an unhandled exception.\n"
2024-09-20 01:21:12 INFO: 0134:err:eventlog:ReportEventW L"Exception Info: System.UriFormatException: Invalid URI: The format of the URI could not be determined.\r\n"
2024-09-20 01:21:12 INFO: 0134:err:eventlog:ReportEventW L" at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind, UriCreationOptions& creationOptions)\r\n"
2024-09-20 01:21:12 INFO: 0134:err:eventlog:ReportEventW L" at System.Uri..ctor(Uri baseUri, Uri relativeUri)\r\n"
2024-09-20 01:21:12 INFO: 0134:err:eventlog:ReportEventW L" at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)\r\n"
2024-09-20 01:21:12 INFO: 0134:err:eventlog:ReportEventW L" at LDLS4.OurApp.InitializeComponent()\r\n"
2024-09-20 01:21:12 INFO: 0134:err:eventlog:ReportEventW L" at LDLS4.OurApp.InitializeAndRun(ReadOnlyCollection`1 listArgs, SingleInstanceManager sim, Scope telemetryStep)\r\n"
2024-09-20 01:21:12 INFO: 0134:err:eventlog:ReportEventW L" at LDLS4.OurApp.Main(String[] astrArgs)\n"
2024-09-20 01:21:12 INFO: 0134:fixme:advapi:DeregisterEventSource (00000000CAFE4242) stub
2024-09-20 01:21:12 INFO: wine: Unhandled exception 0xe0434352 in thread 134 at address 00006FFFFFC23DE7 (thread 0134), starting debugger...
2024-09-20 01:21:12 INFO: 0134:err:seh:start_debugger Couldn't start debugger L"winedbg --auto 304 1088" (1359)
2024-09-20 01:21:12 INFO: Read the Wine Developers Guide on how to set up winedbg or another debugger
Next step is getting a 9.10+ binary.
PythonDialog Error
The PythonDialog issue is most likely happening because the app basically launches a new PythonDialog window multiple times per second.
Because of these errors, apparently the AppImage symlinks were not made, which while unneeded since I'm not using the AppImage, it threw a critical warning for some command that was looking for it.
Latest updates to box64 and hangover show good promise. I am now seeing the following graphics error after the splash loads. No login screen appears.
0140:fixme:gdi:GdiEntry13 stub
0140:fixme:d3d:wined3d_guess_card No card selector available for card vendor 0000 (using GL_RENDERER "Mali-G52 r1 (Panfrost)").
0140:fixme:dwrite:dwritefactory_CreateMonitorRenderingParams (0000000000000001): monitor setting ignored
0118:fixme:vcruntime:__telemetry_main_invoke_trigger (000000007BB10000)
0118:fixme:vcruntime:__telemetry_main_invoke_trigger (000000007BC70000)
0118:fixme:advapi:RegisterEventSourceW ((null),L".NET Runtime"): stub
0118:fixme:advapi:ReportEventW (00000000CAFE4242,0x0001,0x0000,0x00000402,0000000000000000,0x0001,0x00000000,00007FFFFE379B70,0000000000000000): stub
0118:err:eventlog:ReportEventW L"Application: Logos.exe\n"
0118:err:eventlog:ReportEventW L"CoreCLR Version: 8.0.724.31311\n"
0118:err:eventlog:ReportEventW L".NET Version: 8.0.7\n"
0118:err:eventlog:ReportEventW L"Description: The process was terminated due to an unhandled exception.\n"
0118:err:eventlog:ReportEventW L"Exception Info: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication th
at other memory is corrupt.\n"
0118:err:eventlog:ReportEventW L"Stack:\n"
0118:err:eventlog:ReportEventW L" at Libronix.DigitalLibrary.Resources.Logos.NativeMethods.LogosLibraryInitializationWrapper_Initialize(Libronix.DigitalLib
rary.Resources.Logos.ManagedDebuggerBreakDelegate)\n"
0118:err:eventlog:ReportEventW L" at Libronix.DigitalLibrary.Resources.Logos.NativeMethods.LogosLibraryInitializationWrapper_Initialize(Libronix.DigitalLib
rary.Resources.Logos.ManagedDebuggerBreakDelegate)\n"
0118:err:eventlog:ReportEventW L" at Libronix.DigitalLibrary.Resources.Logos.LogosResourceDriver.Initialize()\n"
0118:err:eventlog:ReportEventW L" at LDLS4.OurApp.InitializeAndRun(System.Collections.ObjectModel.ReadOnlyCollection`1<System.String>, Libronix.Utility.Win
dows.Threading.SingleInstanceManager, Libronix.Utility.Scope)\n"
0118:err:eventlog:ReportEventW L" at LDLS4.OurApp.Main(System.String[])\n"
0118:fixme:advapi:DeregisterEventSource (00000000CAFE4242) stub
0118:fixme:seh:RaiseFailFastException (00007FFFFE37A890, 00007FFFFE37A930, 0) stub
GDI, GL, and Vulkan all yield the same result.
This suggests to me that the code is now more or less working, as ou dedetai was able to load following the close of https://github.com/ptitSeb/box64/issues/1841.
From my perspective, we have hit the initial goal: ou dedetai is supported on ARM64 running the x86_64 binary. At this point, it seems though that the AppImage is still not supported (see the box64 issue above).
Using HangOver gets me to the graphics issue above, which suggests it might work if I had a different ARM SoC with a different GPU. I could try an RPi4 or an RPi5 since they are so well supported. I may have a spare.
An issue with this PR is that if box64 is working, then there isn't a need for architecture detection and ELF package installation. That's a step that is required before running this. Such package installation would be necessary if we created an ARM64 distributable. I think that needs to be factored into this.
This PR will be followed up with another. The next PRs will aim to:
- Resolve #238
- Add ELF package installation when necessary