Building Atmosphère on Windows using MSYS2

Sometimes you need to build the binaries for Atmosphère, or you want to change something on the source code, for building your starting point should be: https://github.com/Atmosphere-NX/Atmosphere/blob/master/docs/building.md
On that document you can read:
Building Atmosphère is a very straightforward process that relies almost exclusively on tools provided by the devkitPro organization.​
Dependencies:
  • devkitA64
  • devkitARM
  • Python 2 (Python 3 may work as well, but this is not guaranteed)
  • LZ4
  • PyCryptodome (optional)
  • Hactool
Setup a DevKitPro environment: (https://devkitpro.org/wiki/Getting_Started)
Install the following packages via (dkp-)pacman:​
  • switch-dev
  • switch-glm
  • switch-libjpeg-turbo
  • devkitARM
  • devkitarm-rules
  • hactool
Install the following library via python's package manager pip, required by exosphere:​
  • lz4
Finally, clone the Atmosphère repository and run make under its root directory.​

That instructions are a little plain for we the noobs.

First you need Install a MSYS environment:
The latest instructions for install the MSYS environment are on https://gbatemp.net/threads/install-msys-environment.652234/ if you don't have one working, use them.

After you have the MSYS environment working you need to install DevKitPro
For that you can follow the instructions on the tutorial https://gbatemp.net/threads/setup-a-devkitpro-environment-on-windows.652238/

Now you can install DevKitPro packages:
Bash:
pacman -S --noconfirm switch-dev devkitA64 dkp-toolchain-vars libnx switch-tools switch-mesa switch-libdrm_nouveau switch-sdl2

And Atmosphère prerequisites
Bash:
Pacman -Sy --noconfirm devkitA64 devkitARM devkitarm-rules hactool mingw-w64-x86_64-python mingw-w64-x86_64-python-lz4 mingw-w64-x86_64-python-pycryptodome switch-dev switch-glm switch-libjpeg-turbo mingw-w64-x86_64-python-pip

For me I had to add zip package because even if wasn't explicit indicated on the build page, the code needs it.

Additional you need the packages git make lz4 for all to work, use the command:

Bash:
Pacman -Sy --noconfirm zip git make lz4


The package hactool need you to copy your own prod.keys file on $HOME/.switch folder. (c:\msys64\home\USERNAME\.switch if you use the default installation folder)

LibNX Dependency
Atmosphère depends heavily on LibNX, generally when a major version of firmware is released or great changes on the code are made, changes to LibNX are also made.
The Atmosphère team works on their own repo of LibNX (https://github.com/Atmosphere-NX/libnx) and forward Pull Request to official SwitchBrew LibNX repo (https://github.com/switchbrew/libnx).

So if there are changes on LibNX you need to build it and install on your setup.
If you haven't done already, setup the environment variables

Bash:
export DEVKITPRO=/opt/devkitpro
export DEVKITARM=${DEVKITPRO}/devkitARM
export DEVKITPPC=${DEVKITPRO}/devkitPPC
export PATH=${DEVKITPRO}/tools/bin:$PATH
Then go to the Atmosphere-NX/LibNX repo and look what is the new branch for the current firmware, by example, for Firmware 16.0.0 the branch name is "1600_Support"

1677718224337.png

Then go to your MSYS MinGW64 window and clone the Atmosphere-NX/LibNX repo

Bash:
cd ~
git clone --recursive https://github.com/Atmosphere-NX/libnx.git
cd libnx

And checkout the needed branch:

Bash:
git checkout 1600_support

Then build and install the new LibNX libraries

Bash:
make install -j$(nproc)

Now you can build Atmosphère with latest LibNX code; remember if you update the pacman LibNX package the changes get reversed and you need to build LibNX again.

Now is time to build the binaries
Clone the repository:
Bash:
cd ~
git clone --recursive https://github.com/Atmosphere-NX/Atmosphere

Go to new created Atmosphère folder
Bash:
cd Atmosphere

Never forget to create the environment variables for DevKitPro
Bash:
export DEVKITPRO=/opt/devkitpro
export DEVKITARM=/opt/devkitpro/devkitARM
export DEVKITPPC=/opt/devkitpro/devkitPPC

And now you are ready to start the building process:
Bash:
make -j$(nproc)

I do use the "-j$(nproc)" parameter to "bleed" all the available CPU to run the compiler, without that the whole process could take up to 1 hour.

I want to thank a lot to @binkinator and @godreborn for all the help and inspiration to make this guide, and want to ask you for help improving this guide.

Also special thanks to @godreborn for been a support of the users replies and suggestions to the OP.

Remember, as you are getting a new set of binaries, you need new set of sigpatches if you use it. So the great tool from @mrdude comes in hand, the latest release can be downloaded from: https://github.com/mrdude2478/IPS_Patch_Creator/releases/; you use the program to generate a new set of patches for your recently build package3 file.


Latest IPS Patch Creator:
Sigpatch-IPS-Creator_1.5.7_Yandex.png





-Edited: add sigpatches step and clean up a little-
-Edit 2, add LibNX build-
 

Attachments

  • 1695782853186.png
    1695782853186.png
    62.7 KB · Views: 57
  • 1695782902542.png
    1695782902542.png
    6.4 KB · Views: 58
Last edited by impeeza,

binkinator

Garfield’s Fitness Coach
Member
GBAtemp Patron
Joined
Mar 29, 2021
Messages
6,511
Trophies
2
XP
6,155
Country
United States
get error under ubuntu 20.04:

fatal error: deko3d.hpp: No such file or directory

dont understand what i forgot to follow in tuto for ubuntu...
help

https://github.com/devkitPro/deko3d#installation

Users don't need to do anything special on their own to install deko3d, as this is a core homebrew library in the switch-dev group supplied through devkitPro pacman. However, users who haven't received deko3d because they set up their toolchain installation prior to its release may want to run these commands:

(sudo) (dkp-)pacman -Syu
(sudo) (dkp-)pacman -S --noconfirm --needed switch-dev
 
  • Love
Reactions: impeeza

dj_skual

Code & Mix
Member
Joined
Mar 9, 2008
Messages
1,014
Trophies
1
Website
sourceforge.net
XP
2,634
Country
France

Thanks!!! but still the same:

Code:
dj_skual@djskual-virtual-machine:~/Atmosphere$ sudo dkp-pacman -Syu
:: Synchronizing package databases...
 dkp-libs is up to date
 dkp-linux is up to date
:: Starting full system upgrade...
 there is nothing to do
dj_skual@djskual-virtual-machine:~/Atmosphere$ sudo dkp-pacman -S --noconfirm --needed switch-dev
warning: deko3d-0.4.0-1 is up to date -- skipping
warning: devkita64-cmake-1.1.1-1 is up to date -- skipping
warning: libnx-4.2.2-1 is up to date -- skipping
warning: switch-cmake-1.5.0-1 is up to date -- skipping
warning: switch-examples-20201219-1 is up to date -- skipping
warning: switch-pkg-config-0.28-4 is up to date -- skipping
warning: devkit-env-1.0.1-2 is up to date -- skipping
warning: devkitA64-r20-1 is up to date -- skipping
warning: devkitA64-gdb-11.2-1 is up to date -- skipping
warning: general-tools-1.2.0-2 is up to date -- skipping
warning: switch-tools-1.12.0-1 is up to date -- skipping
warning: uam-1.1.0-1 is up to date -- skipping
 there is nothing to do

Seem like already installed...
 

godreborn

Welcome to the Machine
Member
Joined
Oct 10, 2009
Messages
38,471
Trophies
3
XP
29,180
Country
United States
Thanks!!! but still the same:

Code:
dj_skual@djskual-virtual-machine:~/Atmosphere$ sudo dkp-pacman -Syu
:: Synchronizing package databases...
 dkp-libs is up to date
 dkp-linux is up to date
:: Starting full system upgrade...
 there is nothing to do
dj_skual@djskual-virtual-machine:~/Atmosphere$ sudo dkp-pacman -S --noconfirm --needed switch-dev
warning: deko3d-0.4.0-1 is up to date -- skipping
warning: devkita64-cmake-1.1.1-1 is up to date -- skipping
warning: libnx-4.2.2-1 is up to date -- skipping
warning: switch-cmake-1.5.0-1 is up to date -- skipping
warning: switch-examples-20201219-1 is up to date -- skipping
warning: switch-pkg-config-0.28-4 is up to date -- skipping
warning: devkit-env-1.0.1-2 is up to date -- skipping
warning: devkitA64-r20-1 is up to date -- skipping
warning: devkitA64-gdb-11.2-1 is up to date -- skipping
warning: general-tools-1.2.0-2 is up to date -- skipping
warning: switch-tools-1.12.0-1 is up to date -- skipping
warning: uam-1.1.0-1 is up to date -- skipping
 there is nothing to do

Seem like already installed...
try the command: which deko3d or whereis deko3d.hpp
 

godreborn

Welcome to the Machine
Member
Joined
Oct 10, 2009
Messages
38,471
Trophies
3
XP
29,180
Country
United States
@impeeza , you were talking about combing linux, cmd prompt, and msys, depending on what the person uses? I think the main difference (at least with cmd prompt) is to use pip for all the python modules instead of pacman. that's what I remember anyway. you may have to do so with linux as well, but I can't remember. I think devkitpro will use the python outside of its directory if the python folder is at the top in paths iirc, so order could be important.
Post automatically merged:

btw, I just used make -j$(nproc) in linux. I built atmosphere in 4 minutes.
 
Last edited by godreborn,

urherenow

Well-Known Member
Member
Joined
Mar 8, 2009
Messages
4,809
Trophies
2
Age
48
Location
Japan
XP
3,714
Country
United States
For future reference, If you've added all of your EXPORT $DEVKITPRO stuff to your user's .bashrc in Ubuntu, then most commands that require sudo in this tut should be using sudo -E (meaning, preserve environment, including your $PATH).

@godreborn the things that require python always use pip, and as far as I can remember, are always specifically mentioned in the building instructions (such as for Atmosphere). Otherwise, you should always be using pacman, or dkp-pacman. Not that you can actually go wrong... I don't recall any packages of the same name that exist on both.
 

gdavies

Well-Known Member
Newcomer
Joined
Mar 1, 2023
Messages
67
Trophies
0
XP
115
Country
United Kingdom
yeah sometimes can take 30 minutes, sorry, is the compromise for the easy of MSYS :D
on windows 11 it creates MsSys2 when installing devprokit, but when I get time to play with my bootloader I will put debian on my desktop and have a play properly, it has produced more folders than the normal atmosphere build too, its certainly interesting to see what goes on behind closed doors so to speak
 

impeeza

¡Kabito!
OP
Member
Joined
Apr 5, 2011
Messages
6,417
Trophies
3
Age
46
Location
At my chair.
XP
19,039
Country
Colombia
on windows 11 it creates MsSys2 when installing devprokit, but when I get time to play with my bootloader I will put debian on my desktop and have a play properly, it has produced more folders than the normal atmosphere build too, its certainly interesting to see what goes on behind closed doors so to speak
Yep, you can install MSYS and then add DevKitPro using pacman or download a DevKitPro installer which install a selfcontained folder including a MSYS environment. booth are good options.
 
  • Like
Reactions: binkinator

godreborn

Welcome to the Machine
Member
Joined
Oct 10, 2009
Messages
38,471
Trophies
3
XP
29,180
Country
United States
on windows 11 it creates MsSys2 when installing devprokit, but when I get time to play with my bootloader I will put debian on my desktop and have a play properly, it has produced more folders than the normal atmosphere build too, its certainly interesting to see what goes on behind closed doors so to speak
might be easier to use wsl2 if you don't want to dual boot or use virtual box or vm or something. debian is on the microsoft store. it should build in there.
 

gdavies

Well-Known Member
Newcomer
Joined
Mar 1, 2023
Messages
67
Trophies
0
XP
115
Country
United Kingdom
Yep, you can install MSYS and then add DevKitPro using pacman or download a DevKitPro installer which install a selfcontained folder including a MSYS environment. booth are good options.
I started with DevKitPro and then did the pacman installs after, it all seemed to works quite well, I really wasn't expecting windows 11 to play along with it to be honest but guess microsoft are starting to be nice to developers or something
Post automatically merged:

might be easier to use wsl2 if you don't want to dual boot or use virtual box or vm or something. debian is on the microsoft store. it should build in there.
I would prefer to just let it sit on a seperate hard drive, that way I end up been more focused going as I would have to restart to go back into windows, stops me getting side tracked as easily that way, I started looking at how to do a boot logo and ended up giving this a whirl haha
 

godreborn

Welcome to the Machine
Member
Joined
Oct 10, 2009
Messages
38,471
Trophies
3
XP
29,180
Country
United States
I started with DevKitPro and then did the pacman installs after, it all seemed to works quite well, I really wasn't expecting windows 11 to play along with it to be honest but guess microsoft are starting to be nice to developers or something
Post automatically merged:


I would prefer to just let it sit on a seperate hard drive, that way I end up been more focused going as I would have to restart to go back into windows, stops me getting side tracked as easily that way, I started looking at how to do a boot logo and ended up giving this a whirl haha
yeah, I'm on windows 11 as well. I tested building it. after installing the libnx, I had no issues with the latest atmosphere. btw, do not run the commands on the first page again unless you reinstall libnx from github, because it will overwrite the github libnx and error again during either stratosphere or mesosphere building iirc.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    BigOnYa @ BigOnYa: After watching, that I feel like I'm on them already +1