Build instructions

Unknown W. Brackets edited this page Aug 4, 2016 · 72 revisions

Basic build instructions

(for more detailed instructions, see the development page)

First of all, after having checked out the source, don't forget to run:

git submodule update --init --recursive

in order to get the translations (lang) and ffmpeg libraries.

There used to be another submodule called "native" but it's been merged into ppsspp, and now resides in ext/.

Prerequisites

Platforms

  • Windows :: Microsoft Visual Studio 2015 Community Edition or higher.
  • Linux :: gcc/g++. Debian/Ubuntu uses the build-essential package. Fedora/RHEL uses the "Development Tools" package group.
  • Mac OS X :: Xcode Command Line Tools. You will also need Homebrew installed with the sdl and cmake packages (brew install sdl2 cmake).
  • Android :: You should have the latest SDK and NDK installed.
  • Blackberry :: You should have the latest Native SDK installed. Minimum version of 10.2.0 is required.
  • Symbian :: You need GCC 4.8.3 and the NDK from xsacha's github.
  • iOS :: OS X 10.10+ with Xcode 6+ installed. If compiling a fakesigned binary intended for jailbroken iOS, you also need iOSOpenDev installed with a patched iPhoneOS SDK (sudo iod-setup sdk)

Compilers

  • Clang :: Minimum version of 3.4 is required. Clang is preferred over GCC.
  • GCC :: Minimum version of 4.7.3 is required. Anything earlier will be unable to do c++11
  • MSVC :: Minimum version of MSVC 2012 is required. Anything earlier will be unable to do c++11

Build Systems or Frontends

  • CMake :: Minimum version of 2.8.8 is required.
  • Qt :: Minimum version of 4.7 is required. All versions of Qt5 are known to work. This can make use of SDL1.2 (below) to allow controllers and improve audio.
  • SDL :: To target the SDL frontend, install the libsdl1.2 development headers. This is called libsdl1.2-dev on Debian/Ubuntu, SDL-devel on Fedora/RHEL, sdl12 on BSD ports.

Now, the actual building:

Building for Windows

Open the solution and just build, it'll work. You may just need to set up a path or two to the Windows SDK (which includes the DX SDK) nowadays. A step-by-step compiling guide can be found here.

Building for Android

Install the Android SDK and NDK.

To build the native C/C++ part, from a shell or command prompt, run:

./ab.sh 

or, on Windows:

ab.cmd 

in android/. You may need to tweak the paths in the ab file.

Then just open the project in Eclipse and run on your device. Alternately, you may run android update project --path "ppsspp-dir/android/" and ant release to build without the need for Eclipse.

When you make changes to the native code, you may have to refresh or add a few spaces to PPSSPPActivity.java for Eclipse to rebuild the APK when you run it on your device the next time.

Building for Qt platforms (recommended)

The Qt frontend currently supports Windows, Linux, Mac OSX, iOS, Blackberry 10, Symbian, Meego, Maemo and any other platform that has Qt available.

A Qt-based frontend is available in the Qt/ dir. Open PPSSPPQt.pro with Qt Creator 2.6+.

For building the package via command-line, you will need to ensure Qt4 or Qt5 is installed for your target platform (on Linux: Development libraries are qt4-qmake, libqt4-opengl-dev and libqt4-dev for Qt4 and qt5-qmake and qtsystems5-dev and qttools5-dev-tools for Qt5. Install SDL 1.2 if you want to use USB Gamepad or improve Linux audio. For Qt's built-in audio, use qtmultimedia5-dev on Qt5.). After installing these package components, simply open up the terminal and:

./b.sh --qt

Alternatively, you can use qmake PPSSPPQt.pro && make.

For all platforms, the application is automatically packaged in to an installable file (.app for iOS and Mac OSX, .bar for Blackberry, .sis for Symbian, .deb for Maemo/Meego, .exe for Windows and a standalone binary on Linux).

If upon the command you get qmake: could not find a Qt installation of '', you can install qt5-default package to make it work.

Building for Symbian (Qt)

To build for Symbian, you need to first download the SDK and GCC 4.8.3 provided on xsacha's github.

Please note: I have only compiled GCC 4.8.3 for 64-bit Linux. If you require a different host, please build from source I provided with build script included.

Put the GCC 4.8.3 inside the tools/gcce4/bin/ folder of the SDK. You can then run setenv.bat or setenv.sh to set the environmental variables required.

Then compile and package with:

./b.sh

CMake (Other platforms)

PPSSPP currently uses CMake on platforms that do not have Qt installed and wish to target SDL or native (iOS/Android/Blackberry) frontends. In order to build for most systems, create a build directory and run:

cmake path/to/ppsspp
make

or:

./b.sh

You can specify the -G parameter to cmake to choose a generator. The NMake Makefiles, Visual Studio 11 (projects + sln), GNU Makefiles and Unix Makefiles generators have been tested.

Alternatively, run b.sh, on Linux, which will create the directory for you. If you are on Windows, you will need GNU and CMake to run the bash scripts.

Building for Android (CMake)

This is not recommended and may not be maintained. Please use the method mentioned earlier.

To build for Android using CMake, first you must set the ANDROID_NDK environment variable to point to the path of your NDK install. This is done on windows cmd with set ANDROID_NDK=X:\..., on bourne shells with export ANDROID_NDK=/path/to/ndk, and on C shells with setenv ANDROID_NDK /path/to/ndk.

Then run the script:

./b.sh --android

After this completes successfully, it will have created the needed .so files in path/to/ppsspp/android/libs/armeabi-v7a. You can now use the build.xml in the android/ dir to build the final executable, or import the android/ folder as an existing project in Eclipse.

Note that Eclipse won't notice if you have made changes to the C++ code. Introduce a meaningless change to a random .java file such as a whitespace to get Eclipse to rebuild the project.

Also note that the Visual Studio generators aren't compatible with compilers other than Microsoft's, but NMake Makefiles works fine.

Building for iOS (CMake)

Run the script:

./b.sh --ios

Then open the generated project in Xcode using: open *.xcodeproj Or use the command line: xcodebuild -configuration Release

The PPSSPP.app bundle will be in /path/to/ppsspp/build-ios/Release-iphoneos/PPSSPP.app. You may then scp or afc it to /Applications/ and launch PPSSPP.

If this is your first time installing PPSSPP to your iOS device, you may need to run uicache as mobile in a terminal session to rebuild the SpringBoard UICache, or simply reboot.

See https://github.com/hrydgard/ppsspp/issues/5441 and https://github.com/hrydgard/ppsspp/issues/7880 for some troubleshooting information.

Building for Blackberry (CMake)

To set up your environment for cross-compiling you must use:

source ~/bbndk/bbndk-env.sh

Finally, you are ready to compile. Run the script:

./b.sh

Note: It is recommended to use the QNX GCC compiler instead of the Blackberry 10 version. To do so, grab GCC 4.8.3 from http://community.qnx.com/sf/frs/do/downloadFile/projects.toolchain/frs.gcc.gcc_4_8/frs59763?dl=1&logged=1 (requires an account). Extract the target and host folder to your current target and host folder. Then, ensure the as and ld variants exist by using a symlink:

ln -s ntoarmv7-as arm-unknown-nto-qnx6.6.0eabi-as
ln -s ntoarmv7-ld arm-unknown-nto-qnx6.6.0eabi-ld

Then compile as normal.

Building For Linux (Clang 3.4)

In order to build it under Clang environment, you will need clang-3.4 packages from the repository and install it. Then, you will need to run the command to locate where is bits/c++config.h:

locate bits/c++config.h

Usually, the c++config.h located at /usr/include/<arch>/c++/<version>/bits depending kinds of machine and installation. After located the c++config.h and other header file components, simply copy the c++config.h and other header files to /usr/include/c++/<version>/bits and placed it into the location in order to make Clang building the project without problems.

Clang works perfectly with Cmake build method, so you might need to do something before building it is run the command to set the Clang as the working compiler before building it via Cmake method:

export CC=clang
export CXX=clang++

You can also put these command into .bashrc file to make it as a default compiler.