Skip to content

Conversation

xerpi
Copy link

@xerpi xerpi commented Apr 1, 2025

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

@hrydgard
Copy link
Owner

hrydgard commented Apr 1, 2025

Oh very cool!

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

@xerpi xerpi force-pushed the ci-switch-build branch from dcd438f to 1bfbd72 Compare April 1, 2025 14:46
@hrydgard
Copy link
Owner

hrydgard commented Apr 1, 2025

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

@xerpi xerpi force-pushed the ci-switch-build branch from 1bfbd72 to 70142af Compare April 3, 2025 15:07
@xerpi
Copy link
Author

xerpi commented Apr 3, 2025

Still not fully building but it reaches much further.

@anr2me
Copy link
Collaborator

anr2me commented Apr 4, 2025

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

@xerpi xerpi force-pushed the ci-switch-build branch from 70142af to b31ed45 Compare April 4, 2025 04:51
@xerpi
Copy link
Author

xerpi commented Apr 4, 2025

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

@anr2me
Copy link
Collaborator

anr2me commented Apr 4, 2025

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.

set(GlslangLibs glslang OGLCompiler OSDependent SPIRV spirv-cross-glsl)

@xerpi xerpi force-pushed the ci-switch-build branch from b31ed45 to 23712e6 Compare April 6, 2025 06:42
@anr2me anr2me mentioned this pull request May 4, 2025
2 tasks
@anr2me
Copy link
Collaborator

anr2me commented May 6, 2025

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'
...

@m4xw
Copy link
Contributor

m4xw commented May 6, 2025

already resolved on my PR

@m4xw
Copy link
Contributor

m4xw commented May 6, 2025

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.

set(GlslangLibs glslang OGLCompiler OSDependent SPIRV spirv-cross-glsl)

glslang.patch

@anr2me
Copy link
Collaborator

anr2me commented May 6, 2025

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.

@m4xw
Copy link
Contributor

m4xw commented May 6, 2025

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
Copy link
Contributor

m4xw commented May 6, 2025

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

@ForceConstant
Copy link

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?

@anr2me
Copy link
Collaborator

anr2me commented May 13, 2025

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

@ForceConstant
Copy link

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

@anr2me
Copy link
Collaborator

anr2me commented May 14, 2025

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

@Quebrandosistema
Copy link

New version?

@m4xw
Copy link
Contributor

m4xw commented Jun 3, 2025

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

@Quebrandosistema
Copy link

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.

@StrikerTheHedgefox
Copy link

StrikerTheHedgefox commented Aug 22, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants