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,

impeeza

¡Kabito!
OP
Member
Joined
Apr 5, 2011
Messages
6,419
Trophies
3
Age
46
Location
At my chair.
XP
19,042
Country
Colombia

binkinator

Garfield’s Fitness Coach
Member
GBAtemp Patron
Joined
Mar 29, 2021
Messages
6,511
Trophies
2
XP
6,156
Country
United States
Works a treat! Tried my best to be a mindless fool just clicking what I was told and had no issues. Nicely done!

I’m going to destroy it all and see if I can run it like this:

go to https://switchbrew.org/wiki/Setting_up_Development_Environment and hit this link to download latest Windows graphical installer.

open up MSYS2 and run these two commands (basically just combining all yours into one)

Code:
pacman -Syu

pacman -Sy --noconfirm switch-dev devkitA64 dkp-toolchain-vars libnx switch-tools switch-mesa switch-libdrm_nouveau switch-sdl2 devkitARM devkitarm-rules hactool mingw-w64-x86_64-python mingw-w64-x86_64-python-lz4 mingw-w64-x86_64-python-pycryptodome switch-glm switch-libjpeg-turbo zip

(From here everything flows the same as the rest of the tut…
 

fvig2001

Well-Known Member
Member
Joined
Aug 21, 2006
Messages
940
Trophies
1
XP
2,955
Country
Philippines
Can you enable debug outputs? Will probably be useful if I have to debug on a 1 bit mode switch (normally does not boot atmosphere without hacks)
 
  • Like
Reactions: impeeza

DerBusVomFriedhof

Member
Newcomer
Joined
Jul 27, 2022
Messages
5
Trophies
0
Age
37
Location
Germany
XP
81
Country
Germany
Thank you for this Guide, after reading that this set of instructions worked for a "mindless fool", I was a bit dumbstruck when the "git" command would not execute. I had to use pacman -S git for it to clone the repository.

I am trying to apply the ram overclock .diff from the RetroNX discord provided by ZachyCatGames, and while patchin the .diff file seemingly works, I sadly cant compile Atmosphere. When entering make -j it returns "command not found".

Still, without your guide i would not even be at this point id wager, so thanks again.
 

binkinator

Garfield’s Fitness Coach
Member
GBAtemp Patron
Joined
Mar 29, 2021
Messages
6,511
Trophies
2
XP
6,156
Country
United States
Thank you for this Guide, after reading that this set of instructions worked for a "mindless fool", I was a bit dumbstruck when the "git" command would not execute. I had to use pacman -S git for it to clone the repository.

I am trying to apply the ram overclock .diff from the RetroNX discord provided by ZachyCatGames, and while patchin the .diff file seemingly works, I sadly cant compile Atmosphere. When entering make -j it returns "command not found".

Still, without your guide i would not even be at this point id wager, so thanks again.
Mindless fool checking in…when you followed @impeeza‘s instructions did you see any errors with this step? (you can run it again…it won’t hurt anything)

Code:
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 zip

if you installed everything with the install binary make sure you did the following.
  • Ensure at least "Switch Development" is ticked - you can also leave the other options ticked if you wish.

either way that should include make and git and all the other tools needed to do proper builds.
 

DerBusVomFriedhof

Member
Newcomer
Joined
Jul 27, 2022
Messages
5
Trophies
0
Age
37
Location
Germany
XP
81
Country
Germany
Thanks for getting back to me, I shall try again later today and try your suggestions. Really appreciated. Also duckbill and dogty. I’m completely new to this and while it sucks being a fool it’s really fun to aquire new „skills“.
 

binkinator

Garfield’s Fitness Coach
Member
GBAtemp Patron
Joined
Mar 29, 2021
Messages
6,511
Trophies
2
XP
6,156
Country
United States
If you building atmosphere yourself why to bother with IPS patches? Just patch sources one time and forget about generating patches for each build.
Wouldn’t the patches conflict with the next build from upstream? or is the thought that since you’re doing it for a particular reason you would be merging that portion anyway, you might as well make the exception for sigpatches while you’re at it.
I would like to also add that sometimes the official libnx is not up to date compared to the atmosphere build (it was the case when atmosphere came out as 1.3.0) you might sometimes want to build libnx (with the same dependencies as atmosphere) with this fork https://github.com/Atmosphere-NX/libnx and choose the correct branch.
This topic requires some thought (hadn’t done so before). If you had already updated your build environment via the package manager you’d have to go back and pull the installed version of libnx out, correct? Not sure I’m sofisticated enough (yet) t know How to cleanly do this.



these are both great thoughts…
 

dogcsty

Well-Known Member
Newcomer
Joined
Dec 2, 2021
Messages
47
Trophies
0
XP
227
Country
United States
Wouldn’t the patches conflict with the next build from upstream? or is the thought that since you’re doing it for a particular reason you would be merging that portion anyway, you might as well make the exception for sigpatches while you’re at it.

This topic requires some thought (hadn’t done so before). If you had already updated your build environment via the package manager you’d have to go back and pull the installed version of libnx out, correct? Not sure I’m sofisticated enough (yet) t know How to cleanly do this.



these are both great thoughts…
The patches wouldn't conflict with the next build. If you look at the official sigpatches zip files you will notice that there are a lot of .ips files. There's only one file that is being used with your current Atmosphere build, the rest of the files are for the old ones (and there are some other files for the firmware). You can add the newest sigpatches afterwards without needing to delete yours

When it comes to libnx the package will be automatically added to your Devkitpro folder once you've built it from source (you can make a backup of the original libnx folder if you want to in Devkitpro/libnx or you can just re-update it if needed, or you can just rebuild it from the master branch).

I'm glad that there are threads like this I wish I had something like this to help me out I had to figure everything out by myself (but I guess you learn better this way). I appreciate the effort.

Another thread that could be useful is how to add the atmosphere-libs to your application for developping atmsophere modules, the makefile configuration can be a little bit tricky.
 

binkinator

Garfield’s Fitness Coach
Member
GBAtemp Patron
Joined
Mar 29, 2021
Messages
6,511
Trophies
2
XP
6,156
Country
United States
The patches wouldn't conflict with the next build. If you look at the official sigpatches zip files you will notice that there are a lot of .ips files. There's only one file that is being used with your current Atmosphere build, the rest of the files are for the old ones (and there are some other files for the firmware). You can add the newest sigpatches afterwards without needing to delete yours
*eureka moment* Thank you, that clicked for me. Ofc
When it comes to libnx the package will be automatically added to your Devkitpro folder once you've built it from source (you can make a backup of the original libnx folder if you want to in Devkitpro/libnx or you can just re-update it if needed, or you can just rebuild it from the master branch).
ahhhh. Cool. It’s in one place and easy to sub out. Sweet!
I'm glad that there are threads like this I wish I had something like this to help me out I had to figure everything out by myself (but I guess you learn better this way). I appreciate the effort.
Many thanks to @impeeza for putting it together.

It really helps to be walked through something instead of just saying “unzip X at the top of your SD Card and hope for the best!”

Also give us rubes a platform to learn a little and step off onto the next dumb question…little by little…going places.
Another thread that could be useful is how to add the atmosphere-libs to your application for developping atmsophere modules, the makefile configuration can be a little bit tricky.
I understand each word you’re saying here, I just get lost when you put them in this particular order…
(in other words hells yes it would be useful!)
 

impeeza

¡Kabito!
OP
Member
Joined
Apr 5, 2011
Messages
6,419
Trophies
3
Age
46
Location
At my chair.
XP
19,042
Country
Colombia

BeckysFootSlave

Well-Known Member
Newcomer
Joined
Jan 4, 2022
Messages
52
Trophies
0
Age
50
XP
671
Country
Germany
Screenshot 2022-09-15 132758.png


Always get this!
WTF am I doing wrong???

Did everything step by step, and also deleted everything completely and installed again!

I need help please! :(
 

BeckysFootSlave

Well-Known Member
Newcomer
Joined
Jan 4, 2022
Messages
52
Trophies
0
Age
50
XP
671
Country
Germany
I even found a libjpeg turbo package on the Msys2 website!

Should I install that!
Forgot also to post a image of the environmental variables to ask if everything is correct!
Will do later!

@impeeza thank you again for your time!
 
  • Love
Reactions: impeeza

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
  • BigOnYa @ BigOnYa:
    Biomutant looks cool tho, may have to try that
  • Quincy @ Quincy:
    Usually when such a big title leaks the Temp will be the first to report about it (going off of historical reports here, Pokemon SV being the latest one I can recall seeing pop up here)
  • K3Nv2 @ K3Nv2:
    I still like how a freaking mp3 file hacks webos all that security defeated by text yet again
  • BigOnYa @ BigOnYa:
    They have simulators for everything nowdays, cray cray. How about a sim that shows you playing the Switch.
  • K3Nv2 @ K3Nv2:
    That's called yuzu
    +1
  • BigOnYa @ BigOnYa:
    I want a 120hz 4k tv but crazy how more expensive the 120hz over the 60hz are. Or even more crazy is the price of 8k's.
  • K3Nv2 @ K3Nv2:
    No real point since movies are 30fps
  • BigOnYa @ BigOnYa:
    Not a big movie buff, more of a gamer tbh. And Series X is 120hz 8k ready, but yea only 120hz 4k games out right now, but thinking of in the future.
  • K3Nv2 @ K3Nv2:
    Mostly why you never see TV manufacturers going post 60hz
  • BigOnYa @ BigOnYa:
    I only watch tv when i goto bed, it puts me to sleep, and I have a nas drive filled w my fav shows so i can watch them in order, commercial free. I usually watch Married w Children, or South Park
  • K3Nv2 @ K3Nv2:
    Stremio ruined my need for nas
  • BigOnYa @ BigOnYa:
    I stream from Nas to firestick, one on every tv, and use Kodi. I'm happy w it, plays everything. (I pirate/torrent shows/movies on pc, and put on nas)
  • K3Nv2 @ K3Nv2:
    Kodi repost are still pretty popular
  • BigOnYa @ BigOnYa:
    What the hell is Kodi reposts? what do you mean, or "Wut?" -xdqwerty
  • K3Nv2 @ K3Nv2:
    Google them basically web crawlers to movie sites
  • BigOnYa @ BigOnYa:
    oh you mean the 3rd party apps on Kodi, yea i know what you mean, yea there are still a few cool ones, in fact watched the new planet of the apes movie other night w wifey thru one, was good pic surprisingly, not a cam
  • BigOnYa @ BigOnYa:
    Damn, only $2.06 and free shipping. Gotta cost more for them to ship than $2.06
  • BigOnYa @ BigOnYa:
    I got my Dad a firestick for Xmas and showed him those 3rd party sites on Kodi, he loves it, all he watches anymore. He said he has got 3 letters from AT&T already about pirating, but he says f them, let them shut my internet off (He wants out of his AT&T contract anyways)
  • K3Nv2 @ K3Nv2:
    That's where stremio comes to play never got a letter about it
  • BigOnYa @ BigOnYa:
    I just use a VPN, even give him my login and password so can use it also, and he refuses, he's funny.
  • BigOnYa @ BigOnYa:
    I had to find and get him an old style flip phone even without text, cause thats what he wanted. No text, no internet, only phone calls. Old, old school.
    K3Nv2 @ K3Nv2: @BigOnYa...