Closed PoloNX closed 1 year ago
xmake is currently only used for Windows UWP support and is provided by another contributor.
He placed some dependencies in his own maintenance repo:https://github.com/zeromake/xrepo
AFAIK there is no xmake repo for storing borealis, one of the reason is borealis was directly included as a subrepo in my project.
Okay I see thanks. And if I want to use cmake for switch build I don't understand steps to follow. I have to use pacman to install packages ?
I'm thinking about it, but there's a toolchain for the Nintendo Switch that is currently being developed and is available on xmake if you're interested. You can find it at https://github.com/Arthapz/switch-llvm-sysroot.
Okay I see thanks. And if I want to use cmake for switch build I don't understand steps to follow. I have to use pacman to install packages ?
It is the same as the original borealis.
there's a toolchain for the Nintendo Switch that is currently being developed and is available on xmake if you're interested.
This looks very good. I now use devkitpro's docker image to compile the switch product, which is very convenient because many dependencies have been precompiled. Using a new Toolchain may require a lot of work to reach the current state. Maybe I will try it in the next project.
Speaking of toolchain, I recently discovered an issue with devkitpro's newlib: I can't use sprintf with multiple threads. This occurred after devkitpro upgraded newlib from 4.2.0 to 4.3.0 .
I submitted an issue but no one responded to me:https://github.com/devkitPro/newlib/issues/27
ffmpeg and mpv will heavily call these functions, and the new version of newlib will cause the program to quickly report an error and exit. I tend to think it is a bug in the new version of newlib, because the old version of newlib does not have this issue, but no one has replied to me with any content.
Do you know anyone else who can help me solve this problem?
I have never tried using printf with threads before. I wouldn't know exactly what to do for you. I shared it in the Nintendo Homebrew Discord server to see if someone might have an idea.
Regarding CMake, my Visual Studio solution is generated correctly. However, when I build "ALL_BUILD," I encounter many errors:
1>------ Build started: Project: ZERO_CHECK, Configuration: Debug x64 ------
1>Checking File Globs
2>------ Build started: Project: yogacore, Configuration: Debug x64 ------
2>Microsoft (R) C/C++ Optimization Compiler version 19.35.32215 for x64
2>Copyright (C) Microsoft Corporation. All rights reserved.
2>cl /c /IC:\devkitPro\libnx\include /IC:\devkitPro\portlibs\switch\include /IC:\Users\geyre\repos\switch\borealis\library\lib\extern\yoga\yoga.. /IC:\devkitPro\libnx\include /Wall /WX- /diagnostics:column /O2 /D _MBCS /D DEBUG /D "CMAKE_INTDIR="Debug"" /Gm- /MD /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /std:c++14 /Fo"yogacore.dir\Debug\" /Fd"C:\Users\geyre\repos\switch\borealis\build_switch\library\lib\extern\yoga\yoga\Debug\libyogacore.pdb" /external:W4 /Gd /TP /errorReport:prompt -g -Og -fno-omit-frame-pointer -fexceptions -Werror -fno-rtti -fvisibility=default C:\Users\geyre\repos\switch\borealis\library\lib\extern\yoga\yoga\Utils.cpp C:\Users\geyre\repos\switch\borealis\library\lib\extern\yoga\yoga\YGConfig.cpp C:\Users\geyre\repos\switch\borealis\library\lib\extern\yoga\yoga\YGEnums.cpp C:\Users\geyre\repos\switch\borealis\library\lib\extern\yoga\yoga\YGLayout.cpp C:\Users\geyre\repos\switch\borealis\library\lib\extern\yoga\yoga\YGNode.cpp C:\Users\geyre\repos\switch\borealis\library\lib\extern\yoga\yoga\YGNodePrint.cpp C:\Users\geyre\repos\switch\borealis\library\lib\extern\yoga\yoga\YGStyle.cpp C:\Users\geyre\repos\switch\borealis\library\lib\extern\yoga\yoga\YGValue.cpp C:\Users\geyre\repos\switch\borealis\library\lib\extern\yoga\yoga\Yoga.cpp C:\Users\geyre\repos\switch\borealis\library\lib\extern\yoga\yoga\event\event.cpp C:\Users\geyre\repos\switch\borealis\library\lib\extern\yoga\yoga\log.cpp
2>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(703,5): error MSB6006: "CL.exe" exited with code 2.
2>cl : command line warning D9035: 'Og' option is deprecated and will be removed in a future release
2>cl : command line error D8021: invalid numeric argument '/Werror'
2>Project "yogacore.vcxproj" failed -- FAILED.
3>------ Build started: Project: borealis, Configuration: Debug x64 ------
3>cl : command line warning D9035: 'Og' option is deprecated and will be removed in a future release
3>cl : command line error D8021: invalid numeric argument '/Wno-volatile'
3>Project "borealis.vcxproj" failed -- FAILED.
4>------ Build started: Project: borealis_demo, Configuration: Debug x64 ------
4>cl : command line warning D9035: 'Og' option is deprecated and will be removed in a future release
4>cl : command line error D8021: invalid numeric argument '/Wno-volatile'
4>Project "borealis_demo.vcxproj" failed -- FAILED.
========== Build: 1 succeeded, 3 failed, 2 up-to-date, 0 skipped ==========
========= Build started at 1:24 PM and took 02.419 seconds ===========.
Thanks.
I have never used VS for development.
For PC builds: I use clion on macOS and Linux, and VSCode with MSYS2 on Windows. For Switch builds: I use devkitpro under macOS for development
For devkitpro which command are you using ?
I tried on my arch linux and it works fine. I think my windows is broken :')
I just clone and tested the project on macOS, and it works fine.
@PoloNX Thank you for your continued attention to my issue.
I don't know how to use libnx threads, but as far as I know, newlib's std::thread is internally handled through libnx __syscall_thread_create
. It indirectly calls threadCreate
(libnx threads), so they should be the same.
You can use a old Docker image( devkitpro/devkita64:20221113 ) to compile that code, in which case the problem will completely disappear.
I’m not a very good dev so I can’t help you more than asking to other people
@PoloNX ~ I send you a message on the discord.
@PoloNX
Download the installer: https://github.com/msys2/msys2-installer/releases and open msys2.exe
wget https://pkg.devkitpro.org/devkitpro-keyring.pkg.tar.xz
pacman -U devkitpro-keyring.pkg.tar.xz
/etc/pacman.conf
[dkp-libs]
Server = https://pkg.devkitpro.org/packages
[dkp-windows]
Server = https://pkg.devkitpro.org/packages/windows/$arch/
pacman -Sy --noconfirm --needed devkitA64 devkit-env switch-cmake switch-glfw libnx cmake ninja
source /etc/profile.d/devkit-env.sh
cmake -B build_switch -G Ninja -DPLATFORM_SWITCH=ON -DCMAKE_BUILD_TYPE=Release
MSYS2_ARG_CONV_EXCL="-DBRLS_RESOURCES=" cmake --build build_switch --target borealis_demo.nro
Thanks @dragonflylee !
When i use the cmake -B build_switch -G Ninja -DPLATFORM_SWITCH=ON -DCMAKE_BUILD_TYPE=Release
command I have the following error. It's weird because I'm using msys2 :
$ cmake -B build_switch -G Ninja -DPLATFORM_SWITCH=ON -DCMAKE_BUILD_TYPE=Release
-- Build Type: Release
-- building for SWITCH
CMake Error at C:/msys64/opt/devkitpro/cmake/dkp-initialize-path.cmake:4 (message):
CMake must be installed and launched from msys2: pacman -S cmake
Call Stack (most recent call first):
C:/msys64/opt/devkitpro/cmake/devkitA64.cmake:1 (include)
C:/msys64/opt/devkitpro/cmake/Switch.cmake:8 (include)
library/cmake/toolchain.cmake:71 (include)
CMakeLists.txt:23 (include)
-- Configuring incomplete, errors occurred!
@PoloNX I don't know how to solve this problem, but there is another way to compile on Windows: docker
docker run --rm -v $(pwd):/data devkitpro/devkita64:latest \
bash -c "cd data && \
cmake -B cmake-build-switch -DPLATFORM_SWITCH=ON && \
make -C cmake-build-switch borealis_demo.nro -j$(nproc)"
Thanks for your reply. I'll try this. Is there a way to use devkitpro-pacman-packages with your cmake conf ? Or I have to do something like here ?
docker works like a charm
Thanks @dragonflylee !
When i use the
cmake -B build_switch -G Ninja -DPLATFORM_SWITCH=ON -DCMAKE_BUILD_TYPE=Release
command I have the following error. It's weird because I'm using msys2 :$ cmake -B build_switch -G Ninja -DPLATFORM_SWITCH=ON -DCMAKE_BUILD_TYPE=Release -- Build Type: Release -- building for SWITCH CMake Error at C:/msys64/opt/devkitpro/cmake/dkp-initialize-path.cmake:4 (message): CMake must be installed and launched from msys2: pacman -S cmake Call Stack (most recent call first): C:/msys64/opt/devkitpro/cmake/devkitA64.cmake:1 (include) C:/msys64/opt/devkitpro/cmake/Switch.cmake:8 (include) library/cmake/toolchain.cmake:71 (include) CMakeLists.txt:23 (include) -- Configuring incomplete, errors occurred!
launch from c:/msys64/msys.exe , not mingw64
Thanks for your reply. I'll try this. Is there a way to use devkitpro-pacman-packages with your cmake conf ? Or I have to do something like here ?
The Docker image used earlier contains all the devkitpro packages internally. That is just some extra deps that wiliwili needed.
https://hub.docker.com/r/devkitpro/devkita64
However, directly using Docker to compile is not very suitable for situations where you have many other dependencies. In this case, you can create an image based on that image yourself, or develop it directly within the image, etc. (You need to know some Docker content if you still don't know it)
The github action workflow of both Switchfin and wiliwili is compiled using that image. You can refer to the workflows of these two projects.
https://github.com/dragonflylee/switchfin/blob/dev/.github/workflows/switch-portlibs.yaml
Hi, what repo are you using with xmake build ?