HarbourMasters / 2ship2harkinian

Creative Commons Zero v1.0 Universal
776 stars 64 forks source link

Fails to compile on Slackware Linux (32-bit): JOYCON_PAIR #789

Closed Lantern47 closed 5 days ago

Lantern47 commented 6 days ago

Console output:

cc1plus: warning: command-line option ‘-Wno-implicit-function-declaration’ is valid for C/ObjC but not for C++ [281/479] Building CXX object libultraship/src/CMakeFiles/libultraship.dir/controller/controldevice/controller/mapping/sdl/SDLMapping.cpp.o FAILED: libultraship/src/CMakeFiles/libultraship.dir/controller/controldevice/controller/mapping/sdl/SDLMapping.cpp.o /usr/bin/c++ -DCVAR_CONSOLE_WINDOW_OPEN=\"gOpenWindows.Console\" -DCVAR_CONTROLLER_CONFIGURATION_WINDOW_OPEN=\"gOpenWindows.ControllerConfiguration\" -DCVAR_CONTROLLER_DISCONNECTED_WINDOW_OPEN=\"gOpenWindows.ControllerDisconnected\" -DCVAR_CONTROLLER_REORDERING_WINDOW_OPEN=\"gOpenWindows.ControllerReordering\" -DCVAR_DROPPED_FILE=\"gGeneral.DroppedFile\" -DCVAR_ENABLE_MULTI_VIEWPORTS=\"gSettings.EnableMultiViewports\" -DCVAR_GAME_OVERLAY_FONT=\"gSettings.OverlayFont\" -DCVAR_GFX_DEBUGGER_WINDOW_OPEN=\"gOpenWindows.GfxDebugger\" -DCVAR_IMGUI_CONTROLLER_NAV=\"gSettings.ControlNav\" -DCVAR_INTERNAL_RESOLUTION=\"gSettings.InternalResolution\" -DCVAR_LOW_RES_MODE=\"gSettings.LowResMode\" -DCVAR_MENU_BAR_OPEN=\"gSettings.OpenMenuBar\" -DCVAR_MSAA_VALUE=\"gSettings.MSAAValue\" -DCVAR_NEW_FILE_DROPPED=\"gGeneral.NewFileDropped\" -DCVAR_PREFIX_ADVANCED_RESOLUTION=\"gSettings.AdvancedResolution\" -DCVAR_PREFIX_AUDIO=\"gAudioEditor\" -DCVAR_PREFIX_CHEAT=\"gCheats\" -DCVAR_PREFIX_CONTROLLERS=\"gSettings.Controllers\" -DCVAR_PREFIX_COSMETIC=\"gCosmetics\" -DCVAR_PREFIX_DEVELOPER_TOOLS=\"gDeveloperTools\" -DCVAR_PREFIX_ENHANCEMENT=\"gEnhancements\" -DCVAR_PREFIX_GENERAL=\"gGeneral\" -DCVAR_PREFIX_RANDOMIZER_ENHANCEMENT=\"gRandoEnhancements\" -DCVAR_PREFIX_RANDOMIZER_SETTING=\"gRandoSettings\" -DCVAR_PREFIX_REMOTE=\"gRemote\" -DCVAR_PREFIX_SETTING=\"gSettings\" -DCVAR_PREFIX_TRACKER=\"gTrackers\" -DCVAR_PREFIX_WINDOW=\"gOpenWindows\" -DCVAR_SDL_WINDOWED_FULLSCREEN=\"gSettings.SdlWindowedFullscreen\" -DCVAR_SIMULATED_INPUT_LAG=\"gSettings.SimulatedInputLag\" -DCVAR_STATS_WINDOW_OPEN=\"gOpenWindows.Stats\" -DCVAR_TEXTURE_FILTER=\"gSettings.TextureFilter\" -DCVAR_VSYNC_ENABLED=\"gSettings.VsyncEnabled\" -DCVAR_Z_FIGHTING_MODE=\"gSettings.ZFightingMode\" -DENABLE_OPENGL -DF3DEX_GBI_2 -DFMT_SHARED -DGFX_DEBUG_DISASSEMBLER -DNDEBUG -DSPDLOG_ACTIVE_LEVEL=1 -DSPDLOG_COMPILED_LIB -DSPDLOG_SHARED_LIB -DSTORMLIB_NO_AUTO_LINK -I/home/user/2ship2harkinian/libultraship/src/../extern -I/home/user2ship2harkinian/build-cmake/libultraship/src -I/home/user/2ship2harkinian/libultraship/src/../../ZAPDTR/lib/libgfxd -I/home/user/2ship2harkinian/libultraship/src -I/home/user/2ship2harkinian/libultraship/src/../include -I/home/user2ship2harkinian/build-cmake/_deps/imgui-src -I/home/user/2ship2harkinian/build-cmake/_deps/imgui-src/backends -I/home/user/2ship2harkinian/build-cmake/_deps/stormlib-src/src -I/home/user/2ship2harkinian/build-cmake/_deps/stb -I/home/user/2ship2harkinian/build-cmake/_deps/threadpool-src/include -I/home/user/2ship2harkinian/build-cmake/_deps/libgfxd-src -isystem /usr/include/SDL2 -O2 -DNDEBUG -std=gnu++20 -Wall -Wextra -Wno-error -Wno-unused-variable -Wno-unused-parameter -Wno-unused-function -Wno-parentheses -Wno-narrowing -Wno-missing-field-initializers -Wno-implicit-function-declaration -MD -MT libultraship/src/CMakeFiles/libultraship.dir/controller/controldevice/controller/mapping/sdl/SDLMapping.cpp.o -MF libultraship/src/CMakeFiles/libultraship.dir/controller/controldevice/controller/mapping/sdl/SDLMapping.cpp.o.d -o libultraship/src/CMakeFiles/libultraship.dir/controller/controldevice/controller/mapping/sdl/SDLMapping.cpp.o -c /home/user/2ship2harkinian/libultraship/src/controller/controldevice/controller/mapping/sdl/SDLMapping.cpp cc1plus: warning: command-line option ‘-Wno-implicit-function-declaration’ is valid for C/ObjC but not for C++ /home/user/2ship2harkinian/libultraship/src/controller/controldevice/controller/mapping/sdl/SDLMapping.cpp: In member function ‘bool Ship::SDLMapping::UsesSwitchLayout()’: /home/user/2ship2harkinian/libultraship/src/controller/controldevice/controller/mapping/sdl/SDLMapping.cpp:102:71: error: ‘SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_PAIR’ was not declared in this scope; did you mean ‘SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO’? 102 | return type == SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO || type == SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_PAIR; | ^~~~~~~~~~~ | SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO [282/479] Building CXX object libultraship/src/CMakeFiles/libultraship.dir/controller/controldevice/controller/mapping/sdl/SDLRumbleMapping.cpp. cc1plus: warning: command-line option ‘-Wno-implicit-function-declaration’ is valid for C/ObjC but not for C++ [283/479] Building CXX object libultraship/src/CMakeFiles/libultraship.dir/controller/deviceindex/ControllerDisconnectedWindow.cpp.o cc1plus: warning: command-line option ‘-Wno-implicit-function-declaration’ is valid for C/ObjC but not for C++ ninja: build stopped: subcommand failed.

commands ran:

  1. git submodule update --init
  2. cp -rv ~user/Downloads/Legend\ of\ Zelda\,\ The\ -\ Majora\'s\ Mask\ (USA).z64 /home/user/PC/2ship2harkinian/OTRExporter/
  3. cmake -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=Release
  4. cmake --build build-cmake --target Generate2ShipOtr

I've checked and the ROM's hash is compatible with 2ship. Did I enter a command wrong ? I should have all of the relevant dependencies. I'm just trying to compile it for my laptop. Why is it trying to encode Joycon controller compatability by default and failing ?

System Information:

Archez commented 6 days ago

Hi, your sdl2 version is too old. Please install at least 2.26.1 or higher

Lantern47 commented 6 days ago

Hi, your sdl2 version is too old. Please install at least 2.26.1 or higher

Thanks, I'll try upgrading my SDL, though in re-reading that error log, I don't think it mentioned my SDL version. I'm curious how you could tell it was too old ?

My installed version is currently: 2.0.20

Archez commented 6 days ago

From past experience seeing this error message about SDL_CONTROLLER_TYPE_.

Our ImGui dependency has support for switch controllers and so it is expecting those enums to exist, which came in a later SDL2 version (I can't find right now "which" version introduced them, but I can confirm that our linux CI scripts manually install SDL2 2.26.1 because the version in apt-get is too old)

Lantern47 commented 6 days ago

Thanks. I appreciate the explanation, and in such little time. I'm upgrading my packages as I write this and I'll try again. Though while you're here, does moving the .z64 ROM into the OTRExporter need to be done at any specific point in the chain of commands necessary / does it require any specific naming conventions for the ROM, to be recognised before compilation ?

Archez commented 6 days ago

If you mean regarding using the ExtractAssets cmake target, it strictly only works with the US N64 rom in big endian format (can be named anything).

My recommendation however would be to not use the ExtractAssets step, and instead just do GenerateSohOtr. Then you can launch the program as-is and you'll be prompted to supply a rom which supports both N64 and GC US in any format. This utilizes OTR generation that is built into the main executable.

The building docs are a bit unclear of this path, and I'll probably update them soon to switch to this recommendation.

Lantern47 commented 6 days ago

Thanks. Though I'm curious, could you expand a little more on what the disadvantages are of using the ExtractAssets step ? Or link me to where I could read more about the two options ? The docs seem to recommend that one run cmake --build build-cmake --target Generate2ShipOtr before running cmake --build build-cmake --config Release

but that seems to be about it. The mention of ExtractAssets and GenerateSoh0tr are new to me.

Archez commented 6 days ago

Sorry, I was looking at the wrong repo. I meant Generate2ShipOtr. But looks like the linux part of the building instructions is correct, it's just windows/macOS that are still referencing old things.

Anyways, you are not required to move any rom files into OTRExporter. Simply run the 2ship and you'll be prompted to generate the otr if it is missing.

The reason there is two ways to generate otrs is mainly historical/legacy (coming from SoH). The cmake target was first, then later in the project life we made a built-in extractor. The both use the same tools under the hood (ZAPDTR and OTRExporter) meaning the resulting otr/o2r file is identical, the difference is that the cmake step uses python scripts to generate the otr via cli, vs the built-in one happening in c++ via the game executable.

The python scripts have simple rom validation that only accounts for big-endian and only works correctly with US N64. The built-in process has slightly more robust rom validation supporting both US N64 and US GC correctly

Lantern47 commented 5 days ago

I was unable to find the Generate2ShipOtr program like you suggested. For some reason, running the find command within the source and build directories came up with nothing.

I tried running the extract_assets.py script but it kept throwing the following errors:

Traceback (most recent call last): File "/home/user/2ship2harkinian/OTRExporter/./extract_assets.py", line 85, in main() File "/home/user/2ship2harkinian/OTRExporter/./extract_assets.py", line 81, in main BuildOTR(os.path.join(args.xml_root, rom.version.xml_ver), rom.file_path, zapd_exe=args.zapd_exe, genHeaders=args.gen_headers, File "/usr/lib/python3.9/posixpath.py", line 76, in join a = os.fspath(a) TypeError: expected str, bytes or os.PathLike object, not NoneType

I'm not sure why that didn't work, given that the hash matches the sha1 hash for approved ROMS. It's the USA version, Big Endian.

I tried copying the ROM into the directory of build_cmake/mm/ and running 2s2h.elf like you suggested, and it began the extraction process there, seemingly recognising it as a compatible ROM, but then it ran in to some problems.

The STDOUT upon trying to run 2s2h.elf

[2024-10-03 00:04:59.612] [/home/user/2ship2harkinian/libultraship/src/resource/archive/ArchiveManager.cpp:152] [info] Reading archive: /home/user/2ship2harkinian/build-cmake/mm/./mm.o2r [2024-10-03 00:05:00.114] [/home/user/2ship2harkinian/libultraship/src/resource/archive/ArchiveManager.cpp:182] [info] Adding Archive /home/user/2ship2harkinian/build-cmake/mm/./mm.o2r to Archive Manager [2024-10-03 00:05:00.183] [/home/user/2ship2harkinian/libultraship/src/resource/archive/ArchiveManager.cpp:152] [info] Reading archive: /home/user/2ship2harkinian/build-cmake/mm/2ship.o2r [2024-10-03 00:05:00.185] [/home/user/2ship2harkinian/libultraship/src/resource/archive/ArchiveManager.cpp:182] [info] Adding Archive /home/user/2ship2harkinian/build-cmake/mm/2ship.o2r to Archive Manager [00:05:00.700] [os.cpp:27] [error] Failed add SDL game controller mappings from "./gamecontrollerdb.txt" (Invalid RWops) [00:05:04.110] [CrashHandler.cpp:72] [critical] Signal: 11 INVALID ACCESS TO STORAGE Registers: EDI: 0x0AD73F70 ESI: 0x0AD73F8C EBP: 0xBFC5F448 ESP: 0xBFC5F390 EBX: 0x0BE47F4C EDX: 0xBFC5F388 ECX: 0x0BE477CC EAX: 0x00000000 EIP: 0x089FA178 EFL: 0x00210202 Traceback: 1 kernel_rt_sigreturn (+0x0) 2 ImGui_ImplOpenGL3_NewFrame() (+0x18) 3 Ship::Gui::DrawMenu() (+0x15) 4 gfx_run(Gfx, std::unordered_map<MtxS, MtxF, std::hash<MtxS>, std::equal_to<MtxS>, std::allocator<std::pair<MtxS* const, MtxF> > > const&) (+0x4A) 5 Graph_ProcessGfxCommands (+0x31F) 6 ./2s2h.elf() [0x83bd5d1] 7 Graph_Update (+0x43) 8 RunFrame (+0x1D5) 9 Graph_ThreadEntry (+0xD) 10 main (+0xEA) 11 libc_start_main (+0xF9) 12 _start (+0x21) t� ��

The STDERR upon trying to run 2s2h.elf:

Failed to initialize OpenGL loader!

Lantern47 commented 5 days ago

Users in the Discord server have notified me that the crash is due to my CPU only supporting up to OpenGL 1.4.

2ship2harkinian requires at least OpenGL 3.0 as a dependency as it is a modern port for modern machines, and as rightly pointed out, an Intel T2400 is around 20 years old. As consequence, there are only 3 solutions unfortunately, as recommended to myself by a user:

  1. See if wine can run a directx version through opengl1/software implementation (slowly)
  2. Implement opengl1 support for lus/soh/2s2h (hard)
  3. Buy a new graphics card compatible with OpenGL 3. (expensive).

As such, I will now mark this issue as closed. Many thanks to xelivous and Malkierian for help with this issue.