Giter Site home page Giter Site logo

Question about xmake about borealis HOT 21 CLOSED

PoloNX avatar PoloNX commented on June 16, 2024
Question about xmake

from borealis.

Comments (21)

xfangfang avatar xfangfang commented on June 16, 2024

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.

from borealis.

PoloNX avatar PoloNX commented on June 16, 2024

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 ?

from borealis.

PoloNX avatar PoloNX commented on June 16, 2024

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.

from borealis.

xfangfang avatar xfangfang commented on June 16, 2024

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.

  1. Install the devkitpro environment
  2. use pacman to install some dependencies
  3. and follow the readme: Building the demo for Switch

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:devkitPro/newlib#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?

from borealis.

PoloNX avatar PoloNX commented on June 16, 2024

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

from borealis.

xfangfang avatar xfangfang commented on June 16, 2024

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

from borealis.

PoloNX avatar PoloNX commented on June 16, 2024

For devkitpro which command are you using ?

from borealis.

PoloNX avatar PoloNX commented on June 16, 2024

I tried on my arch linux and it works fine. I think my windows is broken :')

from borealis.

xfangfang avatar xfangfang commented on June 16, 2024

I just clone and tested the project on macOS, and it works fine.

from borealis.

PoloNX avatar PoloNX commented on June 16, 2024

F8DB929D-2E2A-43C1-B8FA-9A040A4804BA

from borealis.

xfangfang avatar xfangfang commented on June 16, 2024

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

from borealis.

PoloNX avatar PoloNX commented on June 16, 2024

I’m not a very good dev so I can’t help you more than asking to other people

from borealis.

PoloNX avatar PoloNX commented on June 16, 2024

89AB798A-8A53-499A-B55F-55BD65F6AFED

from borealis.

xfangfang avatar xfangfang commented on June 16, 2024

@PoloNX
I send you a message on the discord.

from borealis.

dragonflylee avatar dragonflylee commented on June 16, 2024

@PoloNX

Here is my Develop instruction using MSYS2

Download the installer: https://github.com/msys2/msys2-installer/releases and open msys2.exe

  • import keyring of devkitpro
wget https://pkg.devkitpro.org/devkitpro-keyring.pkg.tar.xz
pacman -U devkitpro-keyring.pkg.tar.xz
  • add following to end of /etc/pacman.conf
[dkp-libs]
Server = https://pkg.devkitpro.org/packages

[dkp-windows]
Server = https://pkg.devkitpro.org/packages/windows/$arch/
  • install switch dev packages
pacman -Sy --noconfirm --needed devkitA64 devkit-env switch-cmake switch-glfw libnx cmake ninja
source /etc/profile.d/devkit-env.sh
  • build demo
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

https://devkitpro.org/wiki/devkitPro_pacman

from borealis.

PoloNX avatar PoloNX commented on June 16, 2024

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!

from borealis.

xfangfang avatar xfangfang commented on June 16, 2024

@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)"

from borealis.

PoloNX avatar PoloNX commented on June 16, 2024

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 ?

from borealis.

PoloNX avatar PoloNX commented on June 16, 2024

docker works like a charm

from borealis.

dragonflylee avatar dragonflylee commented on June 16, 2024

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

from borealis.

xfangfang avatar xfangfang commented on June 16, 2024

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/xfangfang/wiliwili/blob/d53373cdaaa64c9759b5ec62253ea41ecf1a9b5b/.github/workflows/build.yaml#L240-L243

https://github.com/dragonflylee/switchfin/blob/6a18f9032500a719c8afee7260debbc60444ed98/.github/workflows/build.yaml#L63-L112

https://github.com/dragonflylee/switchfin/blob/dev/.github/workflows/switch-portlibs.yaml

from borealis.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.