ppsspp icon indicating copy to clipboard operation
ppsspp copied to clipboard

[WIP] GitHub actions: Switch build

Open xerpi opened this issue 8 months ago • 19 comments

Builds PPSSPP for the Nintendo Switch (libnx) and uploads the build artifacts (ELF and NRO).

xerpi avatar Apr 01 '25 13:04 xerpi

Oh very cool!

Hm, hasn't the switch version been built with ffmpeg support before?

hrydgard avatar Apr 01 '25 13:04 hrydgard

hm, apparently we need to keep ffmpeg turned off. @m4xw ?

hrydgard avatar Apr 01 '25 21:04 hrydgard

Still not fully building but it reaches much further.

xerpi avatar Apr 03 '25 15:04 xerpi

You will need this before building ppsspp to fix dubious ownership issue when using container.

# Fix dubious ownership issue when running git describe inside a container
git config --global --add safe.directory "$PWD" # Alternatively, chown -R $(id -u):$(id -g) $PWD

anr2me avatar Apr 04 '25 00:04 anr2me

Everything builds, but linking fails with:

[build] /opt/devkitpro/devkitA64/bin/../lib/gcc/aarch64-none-elf/14.2.0/../../../../aarch64-none-elf/bin/ld: cannot find -lOSDependent: No such file or directory

-lOSDependent should be created by glslang, but it only supports Win32 and Unix: https://github.com/KhronosGroup/glslang/blob/b34f619e1c85810dcb3c578107d2e48ba4ee2b37/glslang/CMakeLists.txt#L34-L40

xerpi avatar Apr 04 '25 04:04 xerpi

Everything builds, but linking fails with:

[build] /opt/devkitpro/devkitA64/bin/../lib/gcc/aarch64-none-elf/14.2.0/../../../../aarch64-none-elf/bin/ld: cannot find -lOSDependent: No such file or directory

-lOSDependent should be created by glslang, but it only supports Win32 and Unix: https://github.com/KhronosGroup/glslang/blob/b34f619e1c85810dcb3c578107d2e48ba4ee2b37/glslang/CMakeLists.txt#L34-L40

It seems UNIX identifier also includes linux. Answered by A.I:

UNIX Identifier: CMake uses the UNIX identifier to represent Unix-like operating systems, which includes Linux, macOS (Darwin), and other BSD-based systems.

CMAKE_SYSTEM_NAME: CMake uses the CMAKE_SYSTEM_NAME variable to identify the target operating system, and on Unix-like systems, this variable often defaults to "Linux", "Darwin" (for macOS), or a similar identifier.

Conditional Logic: You can use the if(UNIX) statement in your CMakeLists.txt file to execute code blocks specific to Unix-like systems, including Linux.

Similar issue https://github.com/OGRECave/ogre/issues/3248 Seems to be related to shared library of glslang, which fixed by https://github.com/OGRECave/ogre/pull/3249

The OSDependent glslang library is only available when it is built as a static library, not a shared one; look for the library but do not fail the build when it doesn't exist.

The OSDependent at here probably need to be taken out, and appended to GlslangLibs only when building it statically. https://github.com/hrydgard/ppsspp/blob/6cd9252ca911ef440fb7604b4578b97da3369c8c/CMakeLists.txt#L2453

anr2me avatar Apr 04 '25 06:04 anr2me

After fixing the dubious ownership issue, there are also issues with portable-file-dialogs (libnx does have waitpid/pipe?) and Vulkan (since libnx doesn't support vulkan, adding -DUSING_X11_VULKAN:BOOL=FALSE \ doesn't seems to work either)

...
[949/951] Linking CXX executable PPSSPPSDL.elf
FAILED: PPSSPPSDL.elf 
...
/opt/devkitpro/devkitA64/bin/../lib/gcc/aarch64-none-elf/14.2.0/../../../../aarch64-none-elf/bin/ld: lib/libnative.a(SDLMain.o): in function `pfd::internal::executor::ready(int)':
/__w/ppsspp/ppsspp/build-switch/../ext/portable-file-dialogs/portable-file-dialogs.h:856:(.text._ZN3pfd8internal8executor5readyEi[_ZN3pfd8internal8executor5readyEi]+0x60): undefined reference to `waitpid'
/opt/devkitpro/devkitA64/bin/../lib/gcc/aarch64-none-elf/14.2.0/../../../../aarch64-none-elf/bin/ld: lib/libnative.a(SDLMain.o): in function `SDLVulkanGraphicsContext::SDLVulkanGraphicsContext()':
/__w/ppsspp/ppsspp/build-switch/../SDL/SDLVulkanGraphicsContext.h:20:(.text.startup.main+0x998): undefined reference to `vtable for SDLVulkanGraphicsContext'
/opt/devkitpro/devkitA64/bin/../lib/gcc/aarch64-none-elf/14.2.0/../../../../aarch64-none-elf/bin/ld: /__w/ppsspp/ppsspp/build-switch/../SDL/SDLVulkanGraphicsContext.h:20:(.text.startup.main+0x99c): undefined reference to `vtable for SDLVulkanGraphicsContext'
/opt/devkitpro/devkitA64/bin/../lib/gcc/aarch64-none-elf/14.2.0/../../../../aarch64-none-elf/bin/ld: lib/libnative.a(SDLMain.o): in function `main':
/__w/ppsspp/ppsspp/build-switch/../SDL/SDLMain.cpp:1535:(.text.startup.main+0x9cc): undefined reference to `SDLVulkanGraphicsContext::Init(SDL_Window*&, int, int, int, int, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
/opt/devkitpro/devkitA64/bin/../lib/gcc/aarch64-none-elf/14.2.0/../../../../aarch64-none-elf/bin/ld: lib/libnative.a(SDLMain.o): in function `pfd::internal::executor::start_process(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)':
/__w/ppsspp/ppsspp/build-switch/../ext/portable-file-dialogs/portable-file-dialogs.h:771:(.text._ZN3pfd8internal8executor13start_processERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS8_EE[_ZN3pfd8internal8executor13start_processERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS8_EE]+0x44): undefined reference to `pipe'
...

anr2me avatar May 06 '25 00:05 anr2me

already resolved on my PR

m4xw avatar May 06 '25 09:05 m4xw

Everything builds, but linking fails with:

[build] /opt/devkitpro/devkitA64/bin/../lib/gcc/aarch64-none-elf/14.2.0/../../../../aarch64-none-elf/bin/ld: cannot find -lOSDependent: No such file or directory

-lOSDependent should be created by glslang, but it only supports Win32 and Unix: https://github.com/KhronosGroup/glslang/blob/b34f619e1c85810dcb3c578107d2e48ba4ee2b37/glslang/CMakeLists.txt#L34-L40

It seems UNIX identifier also includes linux. Answered by A.I:

UNIX Identifier: CMake uses the UNIX identifier to represent Unix-like operating systems, which includes Linux, macOS (Darwin), and other BSD-based systems. CMAKE_SYSTEM_NAME: CMake uses the CMAKE_SYSTEM_NAME variable to identify the target operating system, and on Unix-like systems, this variable often defaults to "Linux", "Darwin" (for macOS), or a similar identifier. Conditional Logic: You can use the if(UNIX) statement in your CMakeLists.txt file to execute code blocks specific to Unix-like systems, including Linux.

Similar issue OGRECave/ogre#3248 Seems to be related to shared library of glslang, which fixed by OGRECave/ogre#3249

The OSDependent glslang library is only available when it is built as a static library, not a shared one; look for the library but do not fail the build when it doesn't exist.

The OSDependent at here probably need to be taken out, and appended to GlslangLibs only when building it statically.

https://github.com/hrydgard/ppsspp/blob/6cd9252ca911ef440fb7604b4578b97da3369c8c/CMakeLists.txt#L2453

glslang.patch

m4xw avatar May 06 '25 09:05 m4xw

Yeah, i saw you're removing the OSDependent on your fork, but i didn't saw it being appended for other platforms. According to the PR i quoted, OSDependent is only needed/available when building it statically, when using shared lib doesn't needed it.

anr2me avatar May 06 '25 10:05 anr2me

Yeah, i saw you're removing the OSDependent on your fork, but i didn't saw it being appended for other platforms. According to the PR i quoted, OSDependent is only needed/available when building it statically, when using shared lib doesn't needed it.

Switch is a static platform, we dont use shared libs

m4xw avatar May 06 '25 10:05 m4xw

iirc i just moved it into the main cmake file and bypassed it that way.

m4xw avatar May 06 '25 10:05 m4xw

I would like to help with the PR, I have forked @xerpi 's branch and seeing if I get anywhere. @anr2me were your comments based on the original action from xerpi, or are you working on this also?

ForceConstant avatar May 13 '25 13:05 ForceConstant

I would like to help with the PR, I have forked @xerpi 's branch and seeing if I get anywhere. @anr2me were your comments based on the original action from xerpi, or are you working on this also?

i was testing out xerpi's branch, since he haven't fixed the dubious ownership issue.

And then i checked on m4xw's repo to see what other changes he made. Unfortunately, it was based on old fork which didn't have the portable-file-dialog & imgui library yet.

PS: My branch is at https://github.com/ANR2MERefork/ppsspp/pull/35

anr2me avatar May 13 '25 22:05 anr2me

I got it pretty close but fail linking due to issues with libEGL looking at that now.

ForceConstant avatar May 14 '25 01:05 ForceConstant

I got it pretty close but fail linking due to issues with libEGL looking at that now.

xerpi's branch have the EGL disabled with -DUSING_EGL:BOOL=FALSE

anr2me avatar May 14 '25 01:05 anr2me

New version?

Quebrandosistema avatar Jun 03 '25 02:06 Quebrandosistema

I would like to help with the PR, I have forked @xerpi 's branch and seeing if I get anywhere. @anr2me were your comments based on the original action from xerpi, or are you working on this also?

i was testing out xerpi's branch, since he haven't fixed the dubious ownership issue.

And then i checked on m4xw's repo to see what other changes he made. Unfortunately, it was based on old fork which didn't have the portable-file-dialog & imgui library yet.

PS: My branch is at ANR2MERefork#35

I know i have too much branches but its all there grafik

Imgui we dont use as standalone is using the SDL backend currently, file dialogs we dont have on a system level so i deactivated it

m4xw avatar Jun 03 '25 10:06 m4xw

I speak on behalf of everyone who has a Nintendo Switch. Could you give this port some special attention? You could even open a Patreon. It would all help.

Quebrandosistema avatar Jun 20 '25 15:06 Quebrandosistema

Looking forward to seeing this. The currently available one on Switch runs like crap.

StrikerTheHedgefox avatar Aug 22 '25 22:08 StrikerTheHedgefox