Changes

Jump to navigation Jump to search

Building RetroArch

3,575 bytes added, 03:22, 31 January 2019
m
Protected "Building RetroArch" ([Move=Allow only administrators] (indefinite))
This page contains instructions of building [[RetroArch]] from source. Most average users should use prebuilt binaries instead.
=Building on Windows=
Note The recommended toolchain for building RetroArch on Windows is MinGW- w64 running inside the following is MSYS2 environment. Installers for 64-bit Windows onlyMSYS2 can be found at [https://msys2.github.io/ msys2.github.io]. 32Other toolchains like TDM-bit Windows GCC or Visual Studio can work, but this guide will need to get 32-bit MinGW instead and use 32-bit headers and libs for RetroArchonly cover MSYS2.
Download ==Preparing the prepackaged toolchain from [https://www.dropbox.com/sh/91sakv0qdyxjx9f/AABDTCrcE8pNpcGVgMwDGPPfa/dev_tools/mingw64-4.9.0.7z?dlenvironment==0 here].
Extract Once you have installed MSYS2, you will need to update it somewhere, for example C:\MinGWand install the toolchain packages.
Run Git Bash===Updating MSYS2=== First, start the MSYS2 Shell entry that should be present in your Start Menu. Updating your install is a multiple step operation: first you update the core, then you have to rehash the environment and finally you'll be able to properly update the rest of the system. Once you are in the MSYS2 Shell terminal, run the following commands to upgrade the core MSYS2 packages:  pacman --noconfirm -Sy pacman --needed --noconfirm -S bash pacman pacman-mirrors msys2-runtime Once the window closes, open the MSYS2 Shell again and type <code>pacman --noconfirm -Su</code> then repeat the previous operation to finish the process.Note: If you get fork errors, the second step may have failed. You should go to your msys2 install directory and run <code>autorebase.bat</code> manually.vbsIf that didn't solve the problem consider reinstalling msys2. Then do  ===Installing the build time dependencies=== The following commandswill install everything you need to build RetroArch in your MSYS2 environment. *For 32 bit builds run:  pacman -S --noconfirm --needed git make mingw-w64-i686-toolchain mingw-w64-i686-pkg-config mingw-w64-i686-SDL2 mingw-w64-i686-libxml2 mingw-w64-i686-freetype mingw-w64-i686 python3 mingw-w64-i686-ffmpeg *For 64 bit builds:  pacman -S --noconfirm --needed git make mingw-w64-x86_64-toolchain mingw-w64-x86_64-pkg-config mingw-w64-x86_64-SDL2 mingw-w64-x86_64-libxml2 mingw-w64-x86_64-freetype mingw-w64-x86_64-python3 mingw-w64-x86_64-ffmpeg For the nvidia-cg-toolkit packages, you will need to download the pkg manually from Sourceforge to your home directory for [http://sourceforge.net/projects/msys2/files/REPOS/MINGW_GCC_4_9/i686/mingw-w64-i686-nvidia-cg-toolkit-3.1-2-any.pkg.tar.xz/download 32-bit] or [http://sourceforge.net/projects/msys2/files/REPOS/MINGW_GCC_4_9/x86_64/mingw-w64-x86_64-nvidia-cg-toolkit-3.1-2-any.pkg.tar.xz/download 64-bit], then use pacman to install them. *32-bit:  pacman -U --noconfirm mingw-w64-i686-nvidia-cg-toolkit-3.1-2-any.pkg.tar.xz *64-bit pacman -U --noconfirm mingw-w64-x86_64-nvidia-cg-toolkit-3.1-2-any.pkg.tar.xz After installing the packages, close the MSYS2 shell and open either MinGW-w64 Win64 Shell for 64 bit builds or MinGW-w64 Win32 Shell if you want to build for 32 bit systems. Both should be available in your Start Menu. ==Cloning RetroArch and libretro repositories== Once you are running the MSY2 MinGW-w64 Shell, then you will need to clone the RetroArch and libretro Git repositories.
git clone https://github.com/libretro/libretro-super.git
./libretro-fetch.sh
You should now have all This will fetch every repository in the libretro organization on Github into <code>%MSYS2%/home/%USERNAME%/</code> . Since there are a lot of repositories cloned in the libretro-super folder within your MinGW folderto download, this will take a while to complete. You can use <code>libretro-fetch.sh </code> 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 anythingyou can fetch repositories individually by specifying their name e.g. <code>. /libretro-j sets the number of jobs to do simultaneously, if you have a quad-core CPU, use -j4fetch. sh mednafen_psx</code>
If you change a file in one of the cloned repositories and git won't let you update, do:
git pull
It should update after that. If not, delete the whole repository and run <code>libretro-fetch.sh </code> again.
To change directories/folders do:
Other basic UNIX shell commands like "ls" can be useful as well.
==Building RetroArch=Using MSYS2 = To build RetroArch from the MSY2 MinGW-w64 Shell, execute the following:  cd libretro-super/retroarch && git pull && git submodule update --init && ./configure && make clean && make -j4 You should see a list of files being compiled, ending with mingw<code>LD retroarch</code>. You can then copy the newly compiled <code>retroarch.exe</code> from <code>libretro-w64===super\retroarch</code> to wherever you keep your RetroArch installation.
You can use [http://sourceforge.net/projects/msys2/ MSYS2] If you want to set up do a mingw-w64 environment instead of using debug build, then execute 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 Unixfollowing:  make clean make DEBUG=1 GL_DEBUG=1 -like build can be found [https://gist.githubj4 mv retroarch.com/heuripedes/b6da0fea68b648bdd2ae#file-pure-msys2-build-md here]exe retroarch_debug.exe
==To This build RetroArch:==Download will have all of the [http://themaister.net/retroarch-dl/RetroArch-win64-headers.zip headers] debug symbols intact and [http://themaisterwill be built with compiler optimizations turned off, so it can be run through a debugger like gdb.net/retroarch-dl/RetroArch-win64-libs.zip 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 Makefile.win clean make -f Makefile.win -j4If you are experiencing a missing DLL error, you can fetch all MSYS2 installed DLLs by executing this line:
You should see a list of files being compiled, ending with "LD RetroArch. for i in $(seq 3); do for bin in $(ldd *exe". You can then copy the newly compiled retroarch.exe and \tools*dll | grep -i mingw | cut -d\retroarch -joyconfig.exe from libretrof 3); do cp -super\retroarch to wherever you keep your RetroArch installationvu "$bin" .; done; done
SoftFilters Video filters 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
After they build, you can copy the filters to your RetroArch installation.
==To build Building 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 libretro-build.sh 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 [http://pastebin.com/P2bNTcFT exports.sh] (check the link for a suggested script), then you can run it with ".":  . exports.sh You can put any exports you want or need in this script and they will be set. You can use <code>libretro-build.sh </code> to build all cores at once:
cd libretro-super
cd libretro-super
./libretro-build.sh build_libretro_bsnesmednafen_psx
The exact build_libretro calls names for fetching or building individual cores can be found in the [https://github.com/libretro/libretro-super/blob/master/libretrorules.d/core-buildrules.sh#L97 libretro/rules.d/core-buildrules.sh] script.
Cores that build successfully are put in <code>/dist/win </code> or <code>/dist/win_x64</code> in your libretro-super folder. Be sure to run <code>libretro-fetch.sh </code> 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 -j4
If there isn't a Makefile or Makefile.libretro in the top level, try to find a "libretro" folder within the repository and there should be a makefile Makefile in there. After the core is built, it will be in the same folder as the makefile Makefile used to compile it. The following need only <code>make</code>:* 4do-libretro* blastem-libretro* any 'beetle' source* cannonball* daphne* Dinothawr* FreeIntv* freej2me (inside <code>/src/libretro</code>)* Gearboy (inside <code>/platforms/ibretro</code>)* libretro-atari800* libretro-cap32* libretro-chailove* libretro-crocods* libretro-lutro* libretro-o2em* libretro-uae* melonDS* Mesen (inside <code>/Libretro</code>)* mrboom-libretro* mupen64plus-libretro* nestopia (inside <code>/libretro</code>)* nxengine-libretro* parallel-n64* ppsspp (inside <code>/libretro</code>)* prosystem-libretro* reicast-emulator* REminiscence* SameBoy (inside <code>/libretro</code>)* scummvm (inside <code>/backends/platform/libretro/build</code>)* snes9x (inside <code>/libretro</code>)* stella-libretro* tgbdual-libretro* theodore* virtualjaguar-libretro* yabause (inside <code>/libretro</code>) The following need <code>make -f Makefile.libretro</code>:* 81-liberetro* blueMSX-libretro* Craft* desmume (inside <code>/desmume</code>)* dosbox-libretro* easyrpg-libretro (inside <code>/builds/libretro</code>)* fbalpha (NOTE: makefile.libretro is **all-lowercase**.)* fuse-libretro* gambatte-libretro* Genesis-Plus-GX* gw-libretro* Hatari* libretro-JamVM* libretro-meowPC98 (inside <code>/libretro</code>)* libretro-vecx* mgba* NP2kai (inside <code>/sdl2</code>)* picodrive* px68k-libretro* PokeMini* snes9x-next* vba-next
Refer to The following cores also require the [https://github.com/libretro/libretrorunning of <code>git submodule update --super/blob/masterinit</code>: * dolphin* libretro-build-common.sh libretro-build-common.sh] for exact commands for each core.ppsspp* picodrive
Some cores need special commands for building:
===bSNES Performancebsnes===  make profile='%PROFILE%' clean make profile='%PROFILE%' -j4 Replace %PROFILE% with accuracy, balanced, or performance. ===Dolphin=== Dolphin requires Cmake now. Its information on the Libretro core is inside <code>/Source/Core/DolphinLibretro</code>. ===emux===  cd libretro make -f Makefile.%TARGET% MACHINE=%MACH% Replace %TARGET% with the device to which you plan on building the core (e.g. linux-portable_x86_64, mingw_x86...)Replace %MACH% with any one of the following devices: chip8, gc, nes, sms. ===MAME===If doing a 64-bit build.  cd libretro-mame make -f Makefile.libretro PTR64=1 clean make -f Makefile.libretro PTR64=1 -j4
cd libretro-bsnes/perf make ui='target-libretro' profileThis 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='performance' 1 when doing a clean make ui. You can specify a subtarget by adding e.g. <code>SUBTARGET='target-libretro' profilearcade</code> or <code>SUBTARGET='performance' -j4tiny</code> in the current version of MAME.
===bSNES BalancedRedream===Redream requires Cmake.
cd libretro-bsnes/balanced make ui='target==Rustation-libretro' profile='balanced' clean== Rustation is written in Rust, not C or C++; neither make ui='target-libretro' profile='balanced' -j4nor Cmake would work.
=Building on Linux==bSNES Accuracy===Building on Linux is similar to building on Windows.
cd libretro-bsnes make ui='target-libretro' profile='accuracy' clean make ui='target-libretro' profile='accuracy' -j4After entering the RetroArch folder, do:
===Mednafen=== ./configure
cd libretro-mednafen make core=[CORE] clean make core=[CORE] -j4...and install any necessary dependencies before running ./configure again. Then, do:
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. make
===Mupen64plus===
To make a build with NOTE: Compilation may fail if you do not have the dynarec availablefollowing installed:
cd libretro* g++* libgl1-mesa-dev* libsdl2-mupen64plusdev make WITH_DYNAREC=x86_64 clean* mesa-common-dev make WITH_DYNAREC=x86_64 * pkg-j4config
===MAME===Also, you may need one of the following if RetroArch is to run audio:
Download and install [http* alsa (libsdl2-dev)* libpulse (libpulse-dev)* lossaudo* lopenal (libopenal-dev)* jack* libroar (libroar-dev) WARNING://www.python.org/ftp/python/2.7.5/python-2.7.5.amd64.msi Python 2.7.5] to the default locationThis might break your compilation.* rsound
Then do:==Raspberry Pi==There is a tutorial on how to bypass X11 and use KMS, thus reducing overhead.
make -f Makefile.libretro TARGET=mame PTR64=1 PYTHON="Chttps:/Python27/pythonwwww.exe" clean make -f Makefileraspberrypi.libretro TARGET=mame PTR64=1 PYTHON="C:org/Python27forums/pythonwviewtopic.exe" -j4php?f=78&t=56070
This core will take a while to build, depending The above might work on how fast your CPU is, how many jobs you specifyregular desktop Linux, 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" respectivelytoo.
=LibretroEven so, if you plan on turning your Raspberry Pi into a "RetroArch machine", the easiest way is installing the [http://blog.petrockblock.com/retropie/retropie-super=downloads/ RetroPie image]. (You can also run [http://blog.petrockblock.com/2012/07/22/retropie-setup-an-initialization-script-for-retroarch-on-the-raspberry-pi/ its script].)
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 [https[Category://github.com/libretro/libretro-super/blob/master/libretro-build-common.sh build-common.shFAQs]] script for direction. git clone git[[Category://github.com/libretro/libretro-super.git cd libretro-super sh libretro-fetch.sh sh libretro-build.sh sh libretro-install.sh <path where you'd like RetroArch installed>]]

Navigation menu