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

godreborn

Welcome to the Machine
Member
Joined
Oct 10, 2009
Messages
38,471
Trophies
3
XP
29,116
Country
United States
Can does not mean SHOULD. Even Microsoft's own WSL keeps mostly separate from the rest of the system. People may have python installed for Windows, that wasn't meant for msys/WSL.




That is just 1 example. Whether or not you frankenstined your setup to *seemingly* work, you're doing it WRONG.
It doesn't matter in this instance, because I do almost all Nintendo compiles in cmd prompt, and I've never had problems.
 
  • Like
Reactions: impeeza

urherenow

Well-Known Member
Member
Joined
Mar 8, 2009
Messages
4,762
Trophies
2
Age
48
Location
Japan
XP
3,659
Country
United States
It doesn't matter in this instance, because I do almost all Nintendo compiles in cmd prompt, and I've never had problems.
Well, you do you, but that setup is in no way meant for an easy, no hassle newb setup, which is what this thread is for.
Post automatically merged:

They should be identical iirc on wsl. I think lz4 is installed through pip, so make sure you have that installed.
WSL is actually Ubuntu (without graphics), so anybody using that should pretty much follow Linux tutorials.
 
  • Like
Reactions: impeeza

godreborn

Welcome to the Machine
Member
Joined
Oct 10, 2009
Messages
38,471
Trophies
3
XP
29,116
Country
United States
Well, you do you, but that setup is in no way meant for an easy, no hassle newb setup, which is what this thread is for.
Post automatically merged:


WSL is actually Ubuntu (without graphics), so anybody using that should pretty much follow Linux tutorials.
I compiled it through msys for that reason. I wanted to see if u encountered the same issues, which I didn't. I'm just saying pip install is the same cmd across the board, wsl, msys, or cmd prompt. You're not following the conversation, and you're taking things out of context.
 
  • Like
Reactions: impeeza

urherenow

Well-Known Member
Member
Joined
Mar 8, 2009
Messages
4,762
Trophies
2
Age
48
Location
Japan
XP
3,659
Country
United States
Yes, I'm bouncing around this thread trying to catch where issues are, and losing my mind seeing all of these cmd prompts, and bad information. The OP is using msys, so if you're (collective "you", not personal) not using that, you did NOT follow this tutorial. Trying to help people who are not correctly following this tutorial is simply clutter and could be confusing for those trying to do it right. There are other compiling threads in these forums for other setups, some of which I made (and/or corrected) myself.
 

godreborn

Welcome to the Machine
Member
Joined
Oct 10, 2009
Messages
38,471
Trophies
3
XP
29,116
Country
United States
Didn't I just tell you I tried compiling atmosphere on msys? Cmd prompt and msys are nearly identical commands for compiling this. You're talking to me like I'm an idiot. I'm just going to put you on my ignore list, already wasted enough time on you.
 

TT-ghost_semir

Member
Newcomer
Joined
Aug 17, 2022
Messages
15
Trophies
0
Location
Gronau (Westfalen)
XP
130
Country
Germany
Last edited by TT-ghost_semir,

godreborn

Welcome to the Machine
Member
Joined
Oct 10, 2009
Messages
38,471
Trophies
3
XP
29,116
Country
United States
I guess something may have been wrong with your msys installation. I have five distros, devkitpro, msys, and visual studio, for everything. For unknown reasons, some things will compile with one thing and not another. It can be frustrating.
 
  • Love
Reactions: impeeza

TT-ghost_semir

Member
Newcomer
Joined
Aug 17, 2022
Messages
15
Trophies
0
Location
Gronau (Westfalen)
XP
130
Country
Germany
I guess something may have been wrong with your msys installation. I have five distros, devkitpro, msys, and visual studio, for everything. For unknown reasons, some things will compile with one thing and not another. It can be frustrating.
I have msys2 completely deleted and reinstalled and I got same errors then I have my Windows completely new installed and I got the Same errors -_-
Idk what I do wrong :cry:
 

godreborn

Welcome to the Machine
Member
Joined
Oct 10, 2009
Messages
38,471
Trophies
3
XP
29,116
Country
United States
I have msys2 completely deleted and reinstalled and I got same errors then I have my Windows completely new installed and I got the Same errors -_-
Idk what I do wrong :cry:
it could just be one of those unknown mysteries. I had explorer crash randomly whenever I'd search for something on my old computer, so I had to install a third party app. I could never figure out what was wrong as it worked originally.
 
  • Haha
Reactions: impeeza

impeeza

¡Kabito!
OP
Member
Joined
Apr 5, 2011
Messages
6,318
Trophies
3
Age
46
Location
At my chair.
XP
18,559
Country
Colombia
I have msys2 completely deleted and reinstalled and I got same errors then I have my Windows completely new installed and I got the Same errors -_-
Idk what I do wrong :cry:
Letme tey again this night and back to you
Post automatically merged:

I Just test the steps on my PC:
  • Deleted my C:\MSYS64 folder.
  • Followed each step from this tutorial, copying and pasting the commands.
The first time I get an error about no enough memory. restarted my PC, deleted c:\msys64\home\USER\Atmosphere folder, clone the repo and execute make -j again, then the process end fine.

just for be sure, deleted the c:\msys64 folder and started all over again this time works just fine on the first time.

for now, the steps are working fine to me.
 
Last edited by impeeza,
  • Like
Reactions: godreborn

godreborn

Welcome to the Machine
Member
Joined
Oct 10, 2009
Messages
38,471
Trophies
3
XP
29,116
Country
United States
1676767319494.png


seems to work on windows 11, but it no longer works via cmd line, and I think I know why. I think it's that .switch folder for hactool. I'm not really sure how you'd replicate that within cmd line.
 

godreborn

Welcome to the Machine
Member
Joined
Oct 10, 2009
Messages
38,471
Trophies
3
XP
29,116
Country
United States
I has been using Windows 11 for almost 2 years now and all the guides and test with MSYS has been on it.
Someday I try to compile on cmd using a guide to install Git for Windows SDK but never worked for me. that's why I stay on MSYS and for some pico had to use linux debian VM.
most things work with cmd line, but some things don't. like I built sonic mania's 3dsx with cmd line, but the cia used a sh file, which in this case required linux. you may be able to change the sh file to use windows type files.
 
  • Love
Reactions: impeeza

godreborn

Welcome to the Machine
Member
Joined
Oct 10, 2009
Messages
38,471
Trophies
3
XP
29,116
Country
United States
On the Git for Windows guide was a section for install bash for windows, so the sh files could work, but is too complicated for me :P
it's not the sh that's the problem. I can get them to work. the problem is that the files used by the sh to build the cia are using linux versions of the files (no extensions). it may be possible to replace them with windows' versions, but I didn't try it.
 

binkinator

Garfield’s Fitness Coach
Member
GBAtemp Patron
Joined
Mar 29, 2021
Messages
6,511
Trophies
2
XP
6,155
Country
United States
I use Windows Terminal and swap between WSL, MSYS2, CMD, PowerShell, GitBash and even Cygwin (which also lets you run Linux style commands)

https://github.com/microsoft/terminal or better yet, get it through the Windows App Store

Example setup: https://leo3418.github.io/2020/05/24/cygwin-git-bash-in-wt.html


Didn't I just tell you I tried compiling atmosphere on msys? Cmd prompt and msys are nearly identical commands for compiling this. You're talking to me like I'm an idiot. I'm just going to put you on my ignore list, already wasted enough time on you.

LOL. I’ve had the same frustrations with the same person. Dropping in the middle of convos, talking down to people and changing the context when proven wrong. Same solution too! A wise move. Maybe if enough people do the same the behavior will change? Until then…

E85B839A-A0CC-4C0F-B771-F6589C3EF113.jpeg
 

godreborn

Welcome to the Machine
Member
Joined
Oct 10, 2009
Messages
38,471
Trophies
3
XP
29,116
Country
United States
I use Windows Terminal and swap between WSL, MSYS2, CMD, PowerShell, GitBash and even Cygwin (which also lets you run Linux style commands)

https://github.com/microsoft/terminal or better yet, get it through the Windows App Store

Example setup: https://leo3418.github.io/2020/05/24/cygwin-git-bash-in-wt.html




LOL. I’ve had the same frustrations with the same person. Dropping in the middle of convos, talking down to people and changing the context when proven wrong. Same solution too! A wise move. Maybe if enough people do the same the behavior will change? Until then…

View attachment 354245
I got the sh for sonic mania on the 3ds, the one that used linux files, to work in cmd prompt:
1676796019645.png


I just replaced linux with windows' versions of files.
 

binkinator

Garfield’s Fitness Coach
Member
GBAtemp Patron
Joined
Mar 29, 2021
Messages
6,511
Trophies
2
XP
6,155
Country
United States

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    K3Nv2 @ K3Nv2: https://youtu.be/IihvJBjUpNE?si=CsvoEbwzNKFf0GAm cool