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: 56
  • 1695782902542.png
    1695782902542.png
    6.4 KB · Views: 57
Last edited by impeeza,

godreborn

Welcome to the Machine
Member
Joined
Oct 10, 2009
Messages
38,471
Trophies
3
XP
29,170
Country
United States
about that other thing, it's a shame that some people aren't nicer to others in the scene. as for me, I just try to help as much as possible, as well as make people laugh with the wtf posts in the eof. I don't like being attacked and stuff, but who does really?? those sorts of people chase others away, and it's sad. :(
 

binkinator

Garfield’s Fitness Coach
Member
GBAtemp Patron
Joined
Mar 29, 2021
Messages
6,511
Trophies
2
XP
6,155
Country
United States
about that other thing, it's a shame that some people aren't nicer to others in the scene. as for me, I just try to help as much as possible, as well as make people laugh with the wtf posts in the eof. I don't like being attacked and stuff, but who does really?? those sorts of people chase others away, and it's sad. :(
Agree 1000. It really does and it’s a shame. Nuff said.
 

godreborn

Welcome to the Machine
Member
Joined
Oct 10, 2009
Messages
38,471
Trophies
3
XP
29,170
Country
United States
Could no longer compile this in Linux, and I think it's due to the mingw dependencies. There may be equivalents though, but I did find either my python or pip was corrupted for python 2 and 3 for Ubuntu 20.04 only. I fixed it, but I think I lost all modules for python in the process.
 

binkinator

Garfield’s Fitness Coach
Member
GBAtemp Patron
Joined
Mar 29, 2021
Messages
6,511
Trophies
2
XP
6,155
Country
United States
Could no longer compile this in Linux, and I think it's due to the mingw dependencies. There may be equivalents though, but I did find either my python or pip was corrupted for python 2 and 3 for Ubuntu 20.04 only. I fixed it, but I think I lost all modules for python in the process.
You can rebuild it man. I know you can. :-)
 

impeeza

¡Kabito!
OP
Member
Joined
Apr 5, 2011
Messages
6,406
Trophies
3
Age
46
Location
At my chair.
XP
18,969
Country
Colombia
Just finished to built Atmosphère on a Ubunto 22_10 virtual machine, it goes smooth.

The steps followed was:
Bash:
sudo dkp-pacman -Sy --noconfirm --needed zip git make lz4 libnx devkitA64 devkitARM devkitarm-rules hactool switch-dev dkp-toolchain-vars switch-tools switch-mesa switch-libdrm_nouveau switch-sdl2 switch-libjpeg-turbo switch-glm
sudo dkp-pacman -Syuu --noconfirm
sudo apt install python3
sudo apt install python3-pip
sudo pip install lz4 pycryptodome
sudo apt install python-is-python3
alias python='python3'

export DEVKITPRO=/opt/devkitpro
export DEVKITARM=${DEVKITPRO}/devkitARM
export DEVKITPPC=${DEVKITPRO}/devkitPPC
export PATH=${DEVKITPRO}/tools/bin:$PATH

Important!! you need to copy prod.keys file on $HOME/.switch/

  • Clone the repo
git clone --recursive https://github.com/Atmosphere-NX/Atmosphere
  • and then, run make
Bash:
cd Atmosphere
make

so the today's Atmosphère repo build well on Linux (At least Ubuntu 20)
 

godreborn

Welcome to the Machine
Member
Joined
Oct 10, 2009
Messages
38,471
Trophies
3
XP
29,170
Country
United States
Just finished to built Atmosphère on a Ubunto 22_10 virtual machine, it goes smooth.

The steps followed was:
Bash:
sudo dkp-pacman -Sy --noconfirm --needed zip git make lz4 libnx devkitA64 devkitARM devkitarm-rules hactool switch-dev dkp-toolchain-vars switch-tools switch-mesa switch-libdrm_nouveau switch-sdl2 switch-libjpeg-turbo switch-glm
sudo dkp-pacman -Syuu --noconfirm
sudo apt install python3
sudo apt install python3-pip
sudo pip install lz4 pycryptodome
sudo apt install python-is-python3
alias python='python3'

export DEVKITPRO=/opt/devkitpro
export DEVKITARM=${DEVKITPRO}/devkitARM
export DEVKITPPC=${DEVKITPRO}/devkitPPC
export PATH=${DEVKITPRO}/tools/bin:$PATH

Important!! you need to copy prod.keys file on $HOME/.switch/

  • Clone the repo
git clone --recursive https://github.com/Atmosphere-NX/Atmosphere
  • and then, run make
Bash:
cd Atmosphere
make

so the today's Atmosphère repo build well on Linux (At least Ubuntu 20)
I got it to build in ubuntu 20.04, which is my main distro:

1677041571253.png


the problem was using -j to speed it up. I guess it got overwhelmed.

I also got it to build in cmd prompt. the problem there was a corrupted pip. it was somehow version 7.x while the latest is like 23.0 or something around there.

1676989750758.png
 

impeeza

¡Kabito!
OP
Member
Joined
Apr 5, 2011
Messages
6,406
Trophies
3
Age
46
Location
At my chair.
XP
18,969
Country
Colombia
I got it to build in ubuntu 20.04, which is my main distro:

View attachment 354785

the problem was using -j to speed it up. I guess it got overwhelmed.

I also got it to build in cmd prompt. the problem there was a corrupted pip. it was somehow version 7.x while the latest is like 23.0 or something around there.

View attachment 354786
yeah, make -j on ubuntu even crash the VM, so I just run make or sometimes make -j$(nproc) do the job.

Great to ear you was able to compile on cmd. if you like may be we can change the OP and add steps for MSYS, Linux and Windows CMD :D
 

godreborn

Welcome to the Machine
Member
Joined
Oct 10, 2009
Messages
38,471
Trophies
3
XP
29,170
Country
United States
yeah, make -j on ubuntu even crash the VM, so I just run make or sometimes make -j$(nproc) do the job.

Great to ear you was able to compile on cmd. if you like may be we can change the OP and add steps for MSYS, Linux and Windows CMD :D
the .switch folder needs to go in c/devkitpro/msys2/home/user name for cmd prompt. btw, you may want to mention putting the environmental variables for msys and linux in the .bashrc. then, you won't have to use the export commands every time. ;)
 
  • Wow
Reactions: impeeza

impeeza

¡Kabito!
OP
Member
Joined
Apr 5, 2011
Messages
6,406
Trophies
3
Age
46
Location
At my chair.
XP
18,969
Country
Colombia
Ok, last night asked to SciresM and learned what Atmosphere 1.5.0 requires a new version of LIBNX that version is on a Pull Request.

So if you need to compile Atmosphere before the LIBNX get updated you need to update your local LIBNX version manually:


Bash:
export DEVKITPRO=/opt/devkitpro
export DEVKITARM=${DEVKITPRO}/devkitARM
export DEVKITPPC=${DEVKITPRO}/devkitPPC
export PATH=${DEVKITPRO}/tools/bin:$PATH

git clone --recursive https://github.com/switchbrew/libnx.git
cd libnx
git fetch origin pull/603/head
git checkout -b pullrequest FETCH_HEAD
make install -j


The SciresM pull request is 603

After you got the new LibNX version you can compile Atmosphère as usual, I just did It and works fine
 

godreborn

Welcome to the Machine
Member
Joined
Oct 10, 2009
Messages
38,471
Trophies
3
XP
29,170
Country
United States
I just tested in cmd prompt. success:


1677279747913.png

Post automatically merged:

just tested with linux using make -j$(nproc). I didn't try msys. it worked by way of installing with make install -E to avoid issues with permissions:

1677280842062.png

Post automatically merged:

and, msys:



1677281694925.png
 
Last edited by godreborn,
  • Love
Reactions: impeeza

josete2k

Well-Known Member
Member
Joined
Apr 24, 2009
Messages
680
Trophies
1
Age
43
Location
Spain
XP
1,618
Country
Spain
Ok, last night asked to SciresM and learned what Atmosphere 1.5.0 requires a new version of LIBNX that version is on a Pull Request.

So if you need to compile Atmosphere before the LIBNX get updated you need to update your local LIBNX version manually:


Bash:
export DEVKITPRO=/opt/devkitpro
export DEVKITARM=${DEVKITPRO}/devkitARM
export DEVKITPPC=${DEVKITPRO}/devkitPPC
export PATH=${DEVKITPRO}/tools/bin:$PATH

git clone --recursive https://github.com/switchbrew/libnx.git
cd libnx
git fetch origin pull/603/head
git checkout -b pullrequest FETCH_HEAD
make install -j


The SciresM pull request is 603

After you got the new LibNX version you can compile Atmosphère as usual, I just did It and works fine
I did the same but with


cd libnx
git checkout 1600_support
make
make install
 

urherenow

Well-Known Member
Member
Joined
Mar 8, 2009
Messages
4,802
Trophies
2
Age
48
Location
Japan
XP
3,706
Country
United States
It doesn't matter to me which commit works, just as long as it does. ;)
Well, the new commits will often break building other projects that may not otherwise have broken from internal api changes, so I tend to keep 2 copies of libnx in my vm. After cloning, I name one folder Official_libnx, then clone whatever branch is needed from Atmosphere-nx and name it something obvious as well.
I just do a quick sudo make install on the appropriate one before building something.

Still waiting on a CPU which gets released in Japan on Friday (rest of the world gets it today :( ). Then I can do all of this again from scratch. But it looks like this tut has been well sorted out by now.
 
  • Haha
Reactions: impeeza

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Jayro @ Jayro: Thanks for that bundle, I had the games already but got all the DLC for them for just $5. What a... +1