• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Tutorial] How to build Pokeruby/Pokeemerald using Cygwin (64 Bits)

Lunos

Random Uruguayan User
3,114
Posts
15
Years
EDIT2 (26/10/2022): Cygwin and devkitPro on Windows both work fine again, so I'm bringing this tutorial back from the dead.

EDIT (19/11/2021): I no longer consider Cygwin as a viable option to build the decomps.
devkitPro has been broken for about a year on my end, so I can no longer recommend it, or anything that requires using it, such as the process to build the decomps.
Windows 7 or 8.1 users should stick to MSys2


I'll be as quick as possible, just like in my previous tutorial about building the decomps in MSys2.
My objective here was to build the decomps as fast as possible, so forget about having me explain the meaning behind these steps.
It's not hard to figure out what are we doing here though.

Instructions

1) Download and install devkitPro.
For this tutorial we only really need the GBA Development Package, so feel free to leave the others unchecked if you want to save on hard drive space.
Note: If for some strange reason you get an error, try again after following these instructions.

To make things easier for everyone, I will assume that you installed it or will install it in its default location, which is C:\devkitPro.

2) Download Cygwin and then open up the installer.

3) As soon as you open it up, just click the "Next" button 6 times to reach the Package Selection.
Note: Needless to say, from this point onward I'll assume you've installed Cygwin in its default location (aka C:\cygwin64) for convenience's sake.

4) Once there, set the View parameter to "Full", so you can see all the packages that Cygwin has.

5) Using the Search Bar to the right, look up the following packages:
  • gcc-core
  • gcc-g++
  • git
  • libpng-devel
  • make
6) Once you've chosen their latest versions, just click Next twice and let Cygwin do its thing. Close the installer when it's done.

7) Open up C:\cygwin64\Cygwin.bat so Cygwin can set up a few config files and a home folder for you to work in.

8) Use the following commands in order:
export DEVKITPRO=/cygdrive/c/devkitPro
echo export DEVKITPRO=$DEVKITPRO >> ~/.bashrc
export DEVKITARM=$DEVKITPRO/devkitARM
echo export DEVKITARM=$DEVKITARM >> ~/.bashrc

git clone https://github.com/pret/agbcc
git clone https://github.com/pret/pokeruby (or git clone https://github.com/pret/pokeemerald)
cd agbcc
./build.sh
./install.sh ../pokeruby (or ./install.sh ../pokeemerald)
cd ../pokeruby (or cd ../pokeemerald)
make -jN​
Note: "N" stands for the number of CPU Threads you want to assign to the compiler. The more threads, the faster it'll go.

Protip: You can copy and paste these in your shell using right click, still, one by one.
If you can't, it's because you don't have the QuickEdit Mode enabled.
Do a left click in the icon on the upper left corner of the command prompt's window and go to Properties > Options. Once there, check "QuickEdit Mode", click OK and you're done.


I also recorded a quick video showing the whole process, just in case.
Note: The video is way longer than it should be, as I recorded every single thing included the times where I had to wait for X thing to finish.
Feel free to skip those parts. I couldn't be bothered to remove them myself, I'm way too lazy.



What can you do now? Well, whatever you want really. You have the source code of Game Freak's Pokémon Emerald in front of you, so go wild.
A lot of people like to clone the Pokeemerald-expansion and pull public feature branches to start their projects.
If you want to learn how to do that, you can visit my tutorial.
https://www.pokecommunity.com/showthread.php?t=432321

And that's pretty much it.
 
Last edited:
48
Posts
11
Years
  • Seen Jul 28, 2023
Thank you for this guide. Now I can dive in and try my hand with the pokeemerald disassbly.
 
21
Posts
4
Years
  • Age 29
  • Seen Feb 18, 2022
You're awesome! Thanks for the guides man.How do I download more than one package at a time?
 
21
Posts
4
Years
  • Age 29
  • Seen Feb 18, 2022
You select them all in the package selection screen before clicking "Next".

You're gonna hate me, but

user@LAPTOP-6LIT01A9 ~
$ C:\cygwin64\Cygwin.bat
-bash: C:cygwin64Cygwin.bat: command not found

user@LAPTOP-6LIT01A9 ~
$ export DEVKITPRO=/cygdrive/c/devkitPro

user@LAPTOP-6LIT01A9 ~
$ echo export DEVKITPRO=$DEVKITPRO >> ~/.bashrc

user@LAPTOP-6LIT01A9 ~
$ export DEVKITARM=$DEVKITPRO/devkitARM

user@LAPTOP-6LIT01A9 ~
$ echo export DEVKITARM=$DEVKITARM >> ~/.bashrc

user@LAPTOP-6LIT01A9 ~
$ git clone https://github.com/pret/agbcc
-bash: git: command not found

user@LAPTOP-6LIT01A9 ~
$ git clone https://github.com/pret/pokeemerald
-bash: git: command not found

user@LAPTOP-6LIT01A9 ~
$ cd agbcc
-bash: cd: agbcc: No such file or directory

user@LAPTOP-6LIT01A9 ~
$ ./build.sh
-bash: ./build.sh: No such file or directory

user@LAPTOP-6LIT01A9 ~
$


Completely ineffective.
 
1,403
Posts
10
Years
  • Seen Apr 18, 2024
user@LAPTOP-6LIT01A9 ~
$ C:\cygwin64\Cygwin.bat
-bash: C:cygwin64Cygwin.bat: command not found

You shouldn't be running this command from within your cygwin shell.

As for some of the others, it stands to reason that once the "git command not found" error has happened that you can't just continue and expect it to work. You need to ensure that you've installed git in your cygwin environment.
 

Lunos

Random Uruguayan User
3,114
Posts
15
Years
user@LAPTOP-6LIT01A9 ~
$ C:\cygwin64\Cygwin.bat
-bash: C:cygwin64Cygwin.bat: command not found
I'm not sure what did you try to do here. You just have to open C:\Cygwin64\cygwin.bat, nothing else.
user@LAPTOP-6LIT01A9 ~
$ export DEVKITPRO=/cygdrive/c/devkitPro

user@LAPTOP-6LIT01A9 ~
$ echo export DEVKITPRO=$DEVKITPRO >> ~/.bashrc

user@LAPTOP-6LIT01A9 ~
$ export DEVKITARM=$DEVKITPRO/devkitARM

user@LAPTOP-6LIT01A9 ~
$ echo export DEVKITARM=$DEVKITARM >> ~/.bashrc
And you did use these commands inside the window that is C:\Cygwin64\cygwin.bat, yes?
user@LAPTOP-6LIT01A9 ~
$ git clone https://github.com/pret/agbcc
-bash: git: command not found

user@LAPTOP-6LIT01A9 ~
$ git clone https://github.com/pret/pokeemerald
-bash: git: command not found
You didn't install the Git package. All of the packages mentioned in the main post are equally needed for this to work.
user@LAPTOP-6LIT01A9 ~
$ cd agbcc
-bash: cd: agbcc: No such file or directory
Without Git you couldn't have cloned agbcc, without cloning agbcc you can't go to its folder because there isn't one.
user@LAPTOP-6LIT01A9 ~
$ ./build.sh
-bash: ./build.sh: No such file or directory
Without having cloned agbcc, you can't build it because it doesn't exist in your computer.
Completely ineffective.
There's many things completely ineffective here, but I can 100% assure you that my tutorial is not one of them.
If somehow you can't read simple and straight forward instructions like the ones I wrote in this thread, then focus on the video. It shows every single step exactly as you should be doing it.
 
21
Posts
4
Years
  • Age 29
  • Seen Feb 18, 2022
I know I downloaded it but now I can't find it and its taking forever for my computer to search My pc and C drive..
 

Lunos

Random Uruguayan User
3,114
Posts
15
Years
I know I downloaded it but now I can't find it and its taking forever for my computer to search My pc and C drive..
...?
When you say that you "downloaded it", are you talking about Cygwin or Git?
Because in this case, Git is downloaded as a package of Cygwin and thus it's a part of Cygwin's directory.
 
13
Posts
4
Years
  • Age 20
  • Seen Jan 21, 2024
When i get to ./install.sh ../pokeemerald, i always get cp: cannot stat 'libgcc.a': No such file or directory, and I'm not sure what I did wrong
 
36
Posts
13
Years
When i get to ./install.sh ../pokeemerald, i always get cp: cannot stat 'libgcc.a': No such file or directory, and I'm not sure what I did wrong

Are you sure you remembered to run the build.sh step? If you're on Windows & WSL, are you doing all of this entirely within WSL bash not cmd/PowerShell, including the original git commands?
 
13
Posts
4
Years
  • Age 20
  • Seen Jan 21, 2024
I did the build.sh step and i did everything within bash. I deleted cygwin and did all the steps over again just in case I messed something up, but I still got cp: cannot stat 'libgcc.a': No such file or directory, when I did ./install.sh ../pokeemerald. I'm new to this stuff so I'm not sure what else I could have possibly done wrong
 

Lunos

Random Uruguayan User
3,114
Posts
15
Years
I did the build.sh step and i did everything within bash. I deleted cygwin and did all the steps over again just in case I messed something up, but I still got cp: cannot stat 'libgcc.a': No such file or directory, when I did ./install.sh ../pokeemerald. I'm new to this stuff so I'm not sure what else I could have possibly done wrong
Are you sure that you have installed all the packages specified in the main post? They're all needed.
What happened in your shell/terminal when you used the ./build.sh command?
Did you watch the video linked in the main post, to check that you really didn't miss any step?
 
13
Posts
4
Years
  • Age 20
  • Seen Jan 21, 2024
I do have all the packages and they are the versions that are shown in the main post. I checked and made sure I didn't miss a step, but at the end of ./build.sh
Makefile:1: /cygdrive/c/devkitPro/devkitARM/base_tools: No such file or directory
make: *** No rule to make target '/cygdrive/c/devkitPro/devkitARM/base_tools'. Stop.
 

Lunos

Random Uruguayan User
3,114
Posts
15
Years
I do have all the packages and they are the versions that are shown in the main post. I checked and made sure I didn't miss a step, but at the end of ./build.sh
Makefile:1: /cygdrive/c/devkitPro/devkitARM/base_tools: No such file or directory
make: *** No rule to make target '/cygdrive/c/devkitPro/devkitARM/base_tools'. Stop.
That means Cygwin is not finding your installation of devkitPro.

1) Did you install it in its default location? (C:\devkitPro)?
2) Are you sure that you introduced the 4 commands that register the paths to devkitPro and devkitARM on Cygwin? They're in the main post.

Also, make sure that in your C:\devkitPro folder you have more or less these folders and files:
XBBHuTj.png


If for example, you're missing the devkitARM folder, that means devkitPro did not install successfully on your end.
 

pokefreak890

The One that will make everything great
853
Posts
9
Years
  • Age 26
  • Seen May 18, 2023
for the cygwin method i get to the gitclone steps and the cd agbcc and when i type it in it says theres no such file or directory when its on my desktop
 

Lunos

Random Uruguayan User
3,114
Posts
15
Years
for the cygwin method i get to the gitclone steps and the cd agbcc and when i type it in it says theres no such file or directory when its on my desktop
It shouldn't be on your desktop.
In this tutorial, we work with the C:\cygwin64\home\USER directory. By default, Cygwin.bat points to that folder, hence why.

Move the agbcc folder there, open Cygwin.bat and follow the rest of the tutorial normally.
 

pokefreak890

The One that will make everything great
853
Posts
9
Years
  • Age 26
  • Seen May 18, 2023
Okay so now I'm at the part where I do ./install.sh ../pokeemerald and I get cannot stay 'agbcc' no such file or directory

I'm not sure what I'm doing wrong at this point
 

Lunos

Random Uruguayan User
3,114
Posts
15
Years
Okay so now I'm at the part where I do ./install.sh ../pokeemerald and I get cannot stay 'agbcc' no such file or directory

I'm not sure what I'm doing wrong at this point
Without knowing your exact steps, it's hard to say. I suggest you to start from scratch, and read the tutorial slowly. Take your time.
 
6
Posts
8
Years
  • Age 40
  • Seen May 27, 2020
Hi, so I've been trying to get this to work all day. I've completely uninstalled and re-attempted 3 times. I'm copying & pasting as much of your instructions as I can to minimize any errors due to typos. I have followed the instructions explicity in order.

Each attempt gives me a problem somewhere. My first attempt I was able to get all the way to adding be2 & items & pokemon, but ran into an error at -make jN where it failed because 'stddef.h' couldn't be found anywhere. Googling that problem led me to a stackexchange post where the accepted answer (70 votes) was that it happens when gcc-core and gcc-g++ are different versions which doesn't make sense but whatever. I completely uninstalled everything and re-attempted it. From here, all my new attempts are on my G drive instead of C due to space.

Attempt #2 and #3 gave me the same issue as the user above about "cannot stat libgcc.a". Yes, I've made sure every attempt has been in order and accurate based on your guide. I know C:\ is the default drive but is it the *required* drive? I usually prefer installing game-related software to my Games drive (G:\).

Anyway, I just tried Attempt #4 and now run into "Makefile:1: /cygdrive/c/devkitPro/devkitARM/base_tools: No such file or directory. make: *** No rule to make target '/cygdrive/c/devkitPro/devkitARM/base_tools'."

Except I *have* G:\devkitPro\devkitARM\base_tools (can't post link or attachment yet). I saw your post saying that means devkit isn't linked to cygwin but that's what the first 4 commands are supposed to do, right? Which I am doing, so I have no idea why this process refuses to work for me...

Edit 1: Ok I got past the "base tools" error when attempting ./build.sh. I apparently didn't link things earlier. What I did was change

"export DEVKITPRO=/cygdrive/c/devkitPro"

into

"export DEVKITPRO=/cygdrive/g/devkitPro", since the stuff is now on my G drive. I *think* this will let me proceed normally. I hope. Will update again.

Edit 2: Welp, that fixed it. gba file successfully created. Now to hopefully get the inclusion of Egg's stuff to work as well. Leaving this here in case it may help someone in the future.
 
Last edited:
Back
Top