• 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 devkitPro's MSys2

Lunos

Random Uruguayan User
3,114
Posts
15
Years
I'll be as quick as possible.
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.

Before starting, I want to give a quick shout-out to UltimaSoul who told me the process of building libpng from its source code.

Alright, let's do this.

Instructions:
1) Download and install devkitPro.
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) Open C:\devkitPro\msys2\msys2_shell.bat and type the following commands:
pacman -Sy msys2-keyring
pacman -S make gcc zlib-devel git​

3) Download libpng.

4) Uncompress the folder that you just downloaded (libpng's) twice. libpng-1.6.34.tar.gz first, and then libpng-1.6.34.tar which is inside of it.
That will give you access to a folder called libpng-1.6.34 that contains the source code of libpng.
EDIT: Alternatively, you can try out a newer version like libpng-1.6.37 instead.
It should also work just fine, but I haven't tested it myself, so keep that in mind.


5) Back to msys2_shell, go to the libpng-1.6.34 folder by using the cd command and then type the following commands in order:
./configure --prefix=/usr
make check
make install​

6) Type cd to go back to your Home folder and then just use the following commands in order:
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.

Note: You can create an Environment Variable called "HOME" and give it a desired folder path in order to change the Home folder that MSys2 uses.
To create an Environment Variable, open Windows' Run command (Win Key + R), type "sysdm.cpl" and go to Advanced -> Environment Variables.
Here's an example of how I have it set up.
If you don't have a HOME variable, MSys2 will use your User Account's folder found in C:\Users to store stuff by default.


I also recorded a quick video showing the whole process, just in case.


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 inject DizzyEgg's works into their projects. Updates to many core parts of the game like the battle system, amount of items and amount of Pokémon.
If you want to learn how to do this, you can visit my tutorial.
https://www.pokecommunity.com/showthread.php?t=432321

And that's pretty much it.​
 
Last edited:
3
Posts
6
Years
  • Age 30
  • Seen Dec 4, 2019
this is a flawless tutorial. very helpful. for those coming from TheRisingSean's post regarding merging the different pokeemerald branches, you don't need to clone pokeemerald again.

I do have one question, i was able to get this to compile into a 32mb .gba file, but when i load it up in VBA (2005 revision or VBA-m), the screen is white and stays that way. do you have any idea for a solution?

EDIT: I forgot about changing the save type to flash128kb! for those who have the same issue, this is how you fix it! options>emulator>save type> flash 128kb
 
Last edited:
2
Posts
4
Years
  • Age 30
  • Seen Feb 18, 2023
Hi there, thanks for the tutorial! I've followed it exactly up to the 'make check' command, but it doesn't seem to be working - I don't get the same result as on the video tutorial. Here's what I get from 'make check':
Spoiler:

Any help or advice with this would be really appreciated! Thanks
 
Last edited:

Lunos

Random Uruguayan User
3,114
Posts
15
Years
Hi there, thanks for the tutorial! I've followed it exactly up to the 'make check' command, but it doesn't seem to be working - I don't get the same result as on the video tutorial. Here's what I get from 'make check':
Spoiler:

Any help or advice with this would be really appreciated! Thanks
Hmm... that's very strange.
Google led me to this post in SourceForge. Would you mind trying out the solution written there?
 
2
Posts
4
Years
  • Age 30
  • Seen Feb 18, 2023
Thanks - I ended up completely re-starting and re-downloading everything and it's all working fine now
 
7
Posts
5
Years
  • Age 24
  • Seen May 21, 2023
Help!! I get to the last step and when I type the command make -j2 i get "make: *** No targets specified and no makefile found. Stop." If it helps I'm coming from TheRisingSean's post. Where did I screw up?
 

Lunos

Random Uruguayan User
3,114
Posts
15
Years
Help!! I get to the last step and when I type the command make -j2 i get "make: *** No targets specified and no makefile found. Stop." If it helps I'm coming from TheRisingSean's post. Where did I screw up?
Can you post a pic of your shell/terminal?
The error is saying that, in the folder that it's currently pointing to, there isn't a makefile (the file that tells make what it's supposed to do).
 
7
Posts
5
Years
  • Age 24
  • Seen May 21, 2023
That's what I was thinking so I looked into my pokeemerald folder and a make file was there so I was even more confused. I will post a picture once I am out of work
 
7
Posts
5
Years
  • Age 24
  • Seen May 21, 2023
Can you post a pic of your shell/terminal?
The error is saying that, in the folder that it's currently pointing to, there isn't a makefile (the file that tells make what it's supposed to do).
 

Attachments

  • Snapchat-1587732757.jpg
    Snapchat-1587732757.jpg
    811 KB · Views: 41

Lunos

Random Uruguayan User
3,114
Posts
15
Years
Just so we're clear, you did install all the packages required and as instructed in the main post, yes?
You also did build and install agbcc into your Pokeemerald folder, which is also explained there, right?

I'm honestly not really sure what is causing your problem. The only thing I can suggest is to start from scratch and follow every step carefully and as they're written.
 
7
Posts
5
Years
  • Age 24
  • Seen May 21, 2023
Just so we're clear, you did install all the packages required and as instructed in the main post, yes?
You also did build and install agbcc into your Pokeemerald folder, which is also explained there, right?

I'm honestly not really sure what is causing your problem. The only thing I can suggest is to start from scratch and follow every step carefully and as they're written.

Don't I need to put an emerald rom somewhere before I use the make command? I think that's where I screwed up
 

Lunos

Random Uruguayan User
3,114
Posts
15
Years
Don't I need to put an emerald rom somewhere before I use the make command?
No, you don't. If you did need one, I would have mentioned it in the main post.
Baserom calls in Pokeemerald have been killed a year ago or two, so a base ROM is not needed at all.
 
7
Posts
5
Years
  • Age 24
  • Seen May 21, 2023
No, you don't. If you did need one, I would have mentioned it in the main post.
Baserom calls in Pokeemerald have been killed a year ago or two, so a base ROM is not needed at all.

So I ran through the process again and I got the same error. I think where I could be messing up is is step 6 where we have to go back to the "home folder". Is that referencing the pokeemerald folder or the or my user file which for you would be C:/Users/Lunos
 

AsparagusEdu

AsparagusEduardo
30
Posts
10
Years
  • Age 30
  • Seen Apr 14, 2024
I'm having the same problem as s_grayh1, followed every single step but when excute the command ./configure --prefix=/usr it caused an error
SCqFFGH.png
 

Lunos

Random Uruguayan User
3,114
Posts
15
Years
So I ran through the process again and I got the same error. I think where I could be messing up is is step 6 where we have to go back to the "home folder". Is that referencing the pokeemerald folder or the or my user file which for you would be C:/Users/Lunos
The home folder is the folder where you have agbcc and Pokeemerald stored.

In the notes at the end of the post, I quickly explain how to define a Home folder using Windows' Environment Variables if you want to have a specific location for it, but by default, the "Home" folder of MSys2 is "C:\Users\USER".
I'm having the same problem as s_grayh1, followed every single step but when excute the command ./configure --prefix=/usr it caused an error
SCqFFGH.png
Do you have an AntiVirus operating at the same time you're compiling libpng?
After Googling a little bit, I found out that AntiViruses may interfere with the comftest.exe file and thus not allowing it to do its part to compile libpng.
 
11
Posts
3
Years
  • Age 28
  • Seen Jun 1, 2023
Hi, I'm at the last step trying to make pokeemerald and I'm getting errors saying scaninc.exe and other tools are not there. I have previously successfully made pokeruby, but at the time there was a separate 'pokeruby-tools' repository which included scaninc and other tools that aren't present in my pokeemerald tools folder. I'm now not sure what to do because I've followed the steps exactly up to this point. Thanks for your time!
 

Lunos

Random Uruguayan User
3,114
Posts
15
Years
Hi, I'm at the last step trying to make pokeemerald and I'm getting errors saying scaninc.exe and other tools are not there. I have previously successfully made pokeruby, but at the time there was a separate 'pokeruby-tools' repository which included scaninc and other tools that aren't present in my pokeemerald tools folder. I'm now not sure what to do because I've followed the steps exactly up to this point. Thanks for your time!

Pokeruby-tools was taken down sometime ago, because the tools are now built along with the rest of the game's source code when you use make. It looks like they're not building on your end though, and that's weird.
You can force-build them by using the make tools command.
 
11
Posts
3
Years
  • Age 28
  • Seen Jun 1, 2023
Pokeruby-tools was taken down sometime ago, because the tools are now built along with the rest of the game's source code when you use make. It looks like they're not building on your end though, and that's weird.
You can force-build them by using the make tools command.

Thanks for your help, ah I see that makes sense. "make tools" results in this (sorry I don't know how to format code in a forum post):

$ make tools
cc -Wall -Wextra -Wno-switch -Werror -std=c11 -O2 main.c extended.c -o aif2pcm -lm
cc -Wall -Wextra -Werror -std=c11 -O2 bin2c.c -o bin2c
cc gbafix.c -o gbafix
cc -Wall -Wextra -Werror -Wno-sign-compare -std=c11 -O2 -DPNG_SKIP_SETJMP_CHECK main.c convert_png.c gfx.c jasc_pal.c lz.c rl.c util.c font.c huff.c -o gbagfx -lpng -lz
convert_png.c:5:10: fatal error: png.h: No such file or directory
5 | #include <png.h>
| ^~~~~~~
compilation terminated.
make[1]: *** [Makefile:18: gbagfx] Error 1
make: *** [Makefile:162: tools/gbagfx] Error 2

I have been through each folder within 'tools' and used 'make' individually, and they all make successfully apart from gbagfx and rsfont which both give the same error message
 
Last edited:
Back
Top