Building RetroArch

From Emulation General Wiki
Revision as of 22:28, 10 June 2015 by MarkyVigoroth (talk | contribs) (I added some additional helps in building under Lignux and some issues with making.)
Jump to navigation Jump to search

Building on Windows

Note - the following is for 64-bit Windows only. 32-bit Windows will need to get 32-bit MinGW instead and use 32-bit headers and libs for RetroArch.

Download the prepackaged toolchain from here. (Other versions of the mingw-w64 toolchain can be found here, but they may not have the Git Bash.vbs script)

Extract it somewhere, for example C:\MinGW.

Run Git Bash.vbs. Then do the following commands:

git clone
cd libretro-super

You should now have all the libretro organization repositories cloned in the libretro-super folder within your MinGW folder. You can use again to update all repositories.

Just as a tip, always do a "git pull" to update the repository and "make clean" to clean up old build files before building anything. -j sets the number of jobs to do simultaneously, if you have a quad-core CPU, use -j4.

If you change a file in one of the cloned repositories and git won't let you update, do:

git reset --hard
git pull

It should update after that. If not, delete the whole repository and run again.

To change directories/folders do:

cd folder
cd folder/subfolder


To go up one directory:

cd ..

Other basic UNIX shell commands like "ls" can be useful as well.

Using MSYS2 with mingw-w64

You can use MSYS2 to set up a mingw-w64 environment instead of using the prepackaged toolchain, which has a package manager for easy updating and installation. A guide to setting this up as well as a guide for making a Unix-like build can be found here.

To build RetroArch:

Download the headers and libs and extract them to the folder where the RetroArch repository was cloned (in \libretro-super\retroarch if you used the fetch script). Then execute these commands from the Git Bash shell:

cd libretro-super
cd retroarch
git pull
make -f clean
make -f -j4

You should see a list of files being compiled, ending with "LD RetroArch.exe". You can then copy the newly compiled retroarch.exe and \tools\retroarch-joyconfig.exe from libretro-super\retroarch to wherever you keep your RetroArch installation.

SoftFilters and Audio DSP filters are compiled by going into gfx/filters and audio/filters, respectively, and running make on the Makefile. For example

cd retroarch
cd gfx/filters
make clean

After they build, you can copy the filters to your RetroArch installation.

To build libretro cores:

After running the fetch script, you should have a folder for each libretro core in your libretro-super folder.

Before you start building cores, you may need to set up your exports for some to build properly. If you're using the prepackaged toolchain, you will need to do this for to work:

export CC=gcc
export CXX=g++
export MAKE=make

These will be in effect until you close the Git Bash shell. You will have to set them again when you start it up again. To make this easier, create a shell script called (check the link for a suggested script), then you can run it with ".":


You can put any exports you want or need in this script and they will be set.

You can use to build all cores at once:

cd libretro-super

This will attempt to build almost every core available. This can take quite a while to complete, so you may wish to build cores individually:

cd libretro-super
./ build_libretro_bsnes

The exact build_libretro calls can be found in the script.

Cores that build successfully are put in /dist/win in your libretro-super folder. Be sure to run to update your local Git clones before building.

Building cores manually

If you wish, you can build cores manually if you want more control over the build process, though it's not recommended for inexperienced users. For most cores all you need to do is do:

git pull
make -f Makefile.libretro clean
make -f Makefile.libretro -j4

If there isn't a Makefile.libretro in the top level, try to find a "libretro" folder within the repository and there should be a makefile in there. After the core is built, it will be in the same folder as the makefile used to compile it.

Refer to the for exact commands for each core.

Some cores need special commands for building:

bSNES Performance

cd libretro-bsnes/perf
make ui='target-libretro' profile='performance' clean
make ui='target-libretro' profile='performance' -j4

bSNES Balanced

cd libretro-bsnes/balanced
make ui='target-libretro' profile='balanced' clean
make ui='target-libretro' profile='balanced' -j4

bSNES Accuracy

cd libretro-bsnes
make ui='target-libretro' profile='accuracy' clean
make ui='target-libretro' profile='accuracy' -j4


cd libretro-mednafen
make core=[CORE] clean
make core=[CORE] -j4

Replace [CORE] with psx for PlayStation, pce-fast for PC-Engine, wswan for WonderSwan, ngp for Neo-Geo Pocket, or vb for Virtual Boy. Do not bother with snes or gba, those cores do not function correctly on Windows and are based on old versions of bSNES and VBA-M.


To make a build with the dynarec available:

cd libretro-mupen64plus
make WITH_DYNAREC=x86_64 clean
make WITH_DYNAREC=x86_64 -j4


Download and install Python 2.7.5 to the default location.

Then do:

make -f Makefile.libretro TARGET=mame PTR64=1 PYTHON="C:/Python27/pythonw.exe" clean
make -f Makefile.libretro TARGET=mame PTR64=1 PYTHON="C:/Python27/pythonw.exe" -j4

This core will take a while to build, depending on how fast your CPU is, how many jobs you specify, and how many cores your CPU has. You can save some time updating the core by adding PARTIAL=1 when doing a clean. You can also build MESS and UME by changing TARGET to "mess" and "ume" respectively.


Libretro-super is a series of scripts used to ease the compilation and installation of each and every libretro emulation core and RetroArch itself. Thus this is the simplest route to a fully functional installation. If you need or want to build each core individually then you can refer to the script for direction.

git clone git://
cd libretro-super
sh <path where you'd like RetroArch installed>

Building on Linux

Building on Linux is similar to building on Windows.

After entering the RetroArch folder, do:


...and install any necessary dependencies before running ./configure again. Then, do:


NOTE: Compilation may fail if you do not have the following installed:

  • g++
  • libgl1-mesa-dev
  • libsdl2-dev
  • mesa-common-dev
  • pkg-config

Also, you may need one of the following if RetroArch is to run audio:

  • alsa (libsdl2-dev)
  • libpulse (libpulse-dev)
  • lossaudo
  • lopenal (libopenal-dev)
  • jack
  • libroar (libroar-dev) WARNING: This might break your compilation.
  • rsound

Making Cores

Some cores simply need that you run 'make'. Others require you to run 'make -f Makefile.libretro'. Sometimes, the makefile may be in a subfolder, usually called 'libretro'.

WARNING: the following lists are incomplete.

The following need only 'make':

  • 4do-libretro
  • any 'beetle' source
  • Dinothawr
  • dolphin (inside /libretro)
  • libretro-cap32
  • libretro-lutro
  • libretro-o2em
  • libretro-ppsspp (inside /libretro)
  • libretro-uae
  • mednfen-psx-libretro
  • nestopia (inside /libretro)
  • prosystem-libretro
  • stella
  • yabause (inside /libretro)

The following need 'make -f Makefile.libretro':

  • blueMSX-libretro
  • desmume (inside /desmume)
  • fuse-libretro
  • gambatte-libretro (inside /libgambatte)
  • Genesis-Plus-GX
  • gw-libretro
  • Hatari (You may need to run ./configure)
  • mgba
  • picodrive
  • snes9x-next
  • vba-next

The following cores also require the running of 'git submodule update --init':

  • dolphin
  • libretro-ppsspp
  • picodrive