PCSX2 Documentation/Compiling on Linux: Difference between revisions

From PCSX2 Wiki
Jump to navigation Jump to search
(Created page with "NOTE: Only 32-bit architectures are supported, or distributions that allow the installation of 32-bit packages under a 64-bit architecture. ## Index 1. [Introduction](#introd...")
 
No edit summary
Line 1: Line 1:
NOTE: Only 32-bit architectures are supported, or distributions that allow the installation of 32-bit packages under a 64-bit architecture.
NOTE: Only 32-bit architectures are supported, or distributions that allow the installation of 32-bit packages under a 64-bit architecture.


## Index
==Index==
1. [Introduction](#introduction)
1. [Introduction](#introduction)
2. [CMake Build System](#cmake-build-system)
2. [CMake Build System](#cmake-build-system)
Line 7: Line 7:
5. [Arch Linux](#arch-linux)
5. [Arch Linux](#arch-linux)


## Introduction
==Introduction==


This is intended to give you an idea of how to compile PCSX2 from git in Linux. Some of the steps may be different on some versions of Linux, and this is not generally supported by the PCSX2 team. If you have issues following this guide, I'd recommend going through this thread for help: http://forums.pcsx2.net/Thread-Linux-Compile-Guide-and-Support
This is intended to give you an idea of how to compile PCSX2 from git in Linux. Some of the steps may be different on some versions of Linux, and this is not generally supported by the PCSX2 team. If you have issues following this guide, I'd recommend going through this thread for help: http://forums.pcsx2.net/Thread-Linux-Compile-Guide-and-Support


## CMake Build System
==CMake Build System==


### Debian/Ubuntu build dependencies
===Debian/Ubuntu build dependencies===


#### Build system
====Build system====
`gcc`, `gcc-multilib`, `g++`, `g++-multilib`, `cmake`
`gcc`, `gcc-multilib`, `g++`, `g++-multilib`, `cmake`
 
#### 32-bit libraries on x86_64
====32-bit libraries on x86_64====
`libaio-dev:i386`, `libbz2-dev:i386`, `libcggl:i386`, `libegl1-mesa-dev:i386`, `libglew-dev:i386`, `libgles2-mesa-dev`, `libgtk2.0-dev:i386`, `libjpeg-dev:i386`, `libsdl1.2-dev:i386`, `libsoundtouch-dev:i386`, `libsparsehash-dev`, `libwxgtk2.8-dev:i386`, `nvidia-cg-toolkit`, `portaudio19-dev:i386`, `zlib1g-dev:i386`
`libaio-dev:i386`, `libbz2-dev:i386`, `libcggl:i386`, `libegl1-mesa-dev:i386`, `libglew-dev:i386`, `libgles2-mesa-dev`, `libgtk2.0-dev:i386`, `libjpeg-dev:i386`, `libsdl1.2-dev:i386`, `libsoundtouch-dev:i386`, `libsparsehash-dev`, `libwxgtk2.8-dev:i386`, `nvidia-cg-toolkit`, `portaudio19-dev:i386`, `zlib1g-dev:i386`


### Arch Linux build dependencies
===Arch Linux build dependencies===


Some of the required packages to build PCSX2 are available only in the [AUR](https://aur.archlinux.org), so the use of an [AUR helper](https://wiki.archlinux.org/index.php/AUR_Helpers) (ex: yaourt) is highly advised!
Some of the required packages to build PCSX2 are available only in the [AUR](https://aur.archlinux.org), so the use of an [AUR helper](https://wiki.archlinux.org/index.php/AUR_Helpers) (ex: yaourt) is highly advised!


#### Build system
====Build system====
`gcc`, `gcc-multilib`, `cmake`  
`gcc`, `gcc-multilib`, `cmake`  


#### 32-bit libraries
====32-bit libraries====
Add or uncomment the following lines in `/etc/pacman.conf`:
Add or uncomment the following lines in `/etc/pacman.conf`:
```
```
Line 41: Line 41:
`lib32-libaio`, `lib32-libcanberra`, `lib32-libjpeg-turbo`, `lib32-glew`, `lib32-nvidia-cg-toolkit`, `lib32-portaudio`, `lib32-soundtouch`, `lib32-wxgtk2.8`
`lib32-libaio`, `lib32-libcanberra`, `lib32-libjpeg-turbo`, `lib32-glew`, `lib32-nvidia-cg-toolkit`, `lib32-portaudio`, `lib32-soundtouch`, `lib32-wxgtk2.8`


### Using CMake
===Using CMake===


#### Basic mode: straightforward compilation
====Basic mode: straightforward compilation====
Run the `build.sh` script.
Run the `build.sh` script.
You can view the available options with `build.sh -help`
You can view the available options with `build.sh -help`


#### Expert mode: CMake build parameters
====Expert mode: CMake build parameters====
Basic parameters:
Basic parameters:
- Use Release/Devel/Debug : `-DCMAKE_BUILD_TYPE=Release|Devel|Debug`
- Use Release/Devel/Debug : `-DCMAKE_BUILD_TYPE=Release|Devel|Debug`
Line 87: Line 87:
   - `FALSE`: Keep symbols. Better for debug. (recommended since it should not have any impact on speed)  
   - `FALSE`: Keep symbols. Better for debug. (recommended since it should not have any impact on speed)  


### Running CMake to generate the makefile:
===Running CMake to generate the makefile:===


It is advised to use a build method that places build files outside the PCSX2 sources directory, as it makes it easier to delete all CMake build files:
It is advised to use a build method that places build files outside the PCSX2 sources directory, as it makes it easier to delete all CMake build files:
Line 95: Line 95:
```
```


#### Do the compilation:
====Do the compilation:====
```
```
make  
make  
```
```


#### Install files:
====Install files:====
```
```
make install  
make install  
```
```


### Reporting Cmake bugs
===Reporting Cmake bugs===


Not all distributions and configurations were tested. In case you encounter a CMake bug that is really a CMake issue, you can report it. Please provide the following information:
Not all distributions and configurations were tested. In case you encounter a CMake bug that is really a CMake issue, you can report it. Please provide the following information:
Line 159: Line 159:
```
```


## Ubuntu PPA
==Ubuntu PPA==


With multiarch functionality, you can install a 32-bit PPA on a 64-bit Ubuntu. You need at least Ubuntu 12.04 (Precise) to do this.
With multiarch functionality, you can install a 32-bit PPA on a 64-bit Ubuntu. You need at least Ubuntu 12.04 (Precise) to do this.


#### Add the x86 architecture to your package manager (x64 installs of 12.04 or newer only)
====Add the x86 architecture to your package manager (x64 installs of 12.04 or newer only)====
In a terminal, type:
In a terminal, type:
````
````
Line 169: Line 169:
````
````


#### Add the multiverse package repository
====Add the multiverse package repository====
Uncomment lines looking like this, where trusty is replaced by your Ubuntu version
Uncomment lines looking like this, where trusty is replaced by your Ubuntu version
````
````
Line 178: Line 178:
````
````


#### Add the PCSX2 PPA to your software sources
====Add the PCSX2 PPA to your software sources====


In a terminal, type:   
In a terminal, type:   
Line 186: Line 186:
```
```


#### Install the package on your system
====Install the package on your system====
   
   
```
```
Line 192: Line 192:
```
```


## Arch Linux
==Arch Linux==
NOTE: for 64-bit architectures, multilib must be enabled in order to install PCSX2.  
NOTE: for 64-bit architectures, multilib must be enabled in order to install PCSX2.  


### PCSX2 Stable
===PCSX2 Stable===


Open a terminal, and type:  
Open a terminal, and type:  
Line 202: Line 202:
```
```


### PCSX2 Unstable
===PCSX2 Unstable===
Add or uncomment the following lines in `/etc/pacman.conf`:
Add or uncomment the following lines in `/etc/pacman.conf`:
```
```

Revision as of 02:46, 9 January 2015

NOTE: Only 32-bit architectures are supported, or distributions that allow the installation of 32-bit packages under a 64-bit architecture.

Index

1. [Introduction](#introduction) 2. [CMake Build System](#cmake-build-system) 4. [Ubuntu PPA](#ubuntu-ppa) 5. [Arch Linux](#arch-linux)

Introduction

This is intended to give you an idea of how to compile PCSX2 from git in Linux. Some of the steps may be different on some versions of Linux, and this is not generally supported by the PCSX2 team. If you have issues following this guide, I'd recommend going through this thread for help: http://forums.pcsx2.net/Thread-Linux-Compile-Guide-and-Support

CMake Build System

Debian/Ubuntu build dependencies

Build system

`gcc`, `gcc-multilib`, `g++`, `g++-multilib`, `cmake`

32-bit libraries on x86_64

`libaio-dev:i386`, `libbz2-dev:i386`, `libcggl:i386`, `libegl1-mesa-dev:i386`, `libglew-dev:i386`, `libgles2-mesa-dev`, `libgtk2.0-dev:i386`, `libjpeg-dev:i386`, `libsdl1.2-dev:i386`, `libsoundtouch-dev:i386`, `libsparsehash-dev`, `libwxgtk2.8-dev:i386`, `nvidia-cg-toolkit`, `portaudio19-dev:i386`, `zlib1g-dev:i386`

Arch Linux build dependencies

Some of the required packages to build PCSX2 are available only in the [AUR](https://aur.archlinux.org), so the use of an [AUR helper](https://wiki.archlinux.org/index.php/AUR_Helpers) (ex: yaourt) is highly advised!

Build system

`gcc`, `gcc-multilib`, `cmake`

32-bit libraries

Add or uncomment the following lines in `/etc/pacman.conf`: ``` [Multilib] Include = /etc/pacman.d/mirrorlist ``` Refresh package list: ``` pacman -Sy ```

`lib32-libaio`, `lib32-libcanberra`, `lib32-libjpeg-turbo`, `lib32-glew`, `lib32-nvidia-cg-toolkit`, `lib32-portaudio`, `lib32-soundtouch`, `lib32-wxgtk2.8`

Using CMake

Basic mode: straightforward compilation

Run the `build.sh` script. You can view the available options with `build.sh -help`

Expert mode: CMake build parameters

Basic parameters: - Use Release/Devel/Debug : `-DCMAKE_BUILD_TYPE=Release|Devel|Debug`

 - `Release`: Best in speed, but provides little or no debug/crash info.
 - `Devel`: Adds detailed trace logging abilities, but still lacks debug/crash info.
 - `Debug`: No compiler optimizations. Very good for debug/crash info but also very slooowww. 

- Follow XDG standard : `-DXDG_STD=TRUE` - Build all plugins: `-DEXTRA_PLUGINS=TRUE`

Expert parameters (not supported, the best is to use the default options): - Tune C flags : `-DUSER_CMAKE_C_FLAGS:STRING="cflags"` - Tune C++ flags : `-DUSER_CMAKE_CXX_FLAGS:STRING="cxxflags"` - Tune linker flags : `-DUSER_CMAKE_LD_FLAGS:STRING="ldflags"`

Expert debugging parameters (typical developper only option): - Build GS replayer: `-DBUILD_REPLAY_LOADERS=TRUE` - Use Address Sanitizer: `-DUSE_ASAN=TRUE` - Force wxWidget 2.8 (to spot a regression) : `-DWX28_API=TRUE`

Experimental parameters (not supported, the best is to use the default options): - zzogl: Use GLSL for shading instead of nvidia cg : `-DGLSL_API=TRUE` - zzogl: Use EGL instead of GLX : `-DEGL_API=TRUE` - GSdx: Use openGL ES3.1 instead of pure openGL : `-DGLES_API=TRUE` - Use SDL2 (wxWidget must be linked with SDL1) : `-DSL2_API=TRUE` - Use GTK3 (wxWidget must be built with GTK3 support) : `-DGTK3_API=TRUE` - Use clang (nothing work) : `-DUSE_CLANG=TRUE` - 64 bits support (nothing work): `-D64BIT_BUILD_DONT_WORK=TRUE`

Expert options for package creation - Enable package mode : follow the FHS for distribution `-DPACKAGE_MODE=TRUE` - Plugin install path in package mode : `-DPLUGIN_DIR="/usr/lib/pcsx2"` - GameDB install path in package mode : `-DGAMEINDEX_DIR="/usr/share/games/pcsx2"` - GLSL shader install directory : `-DGLSL_SHADER_DIR="/usr/share/games/pcsx2"` - Update po (translation file) : `-DCMAKE_BUILD_PO=TRUE` - Rebuild shader : `-DREBUILD_SHADER=TRUE` - Disable AVX: `-DDISABLE_ADVANCE_SIMD=TRUE` - Enable/disable the stipping : `-DCMAKE_BUILD_STRIP=TRUE|FALSE`

 - `TRUE`: Remove debugging information.
 - `FALSE`: Keep symbols. Better for debug. (recommended since it should not have any impact on speed) 

Running CMake to generate the makefile:

It is advised to use a build method that places build files outside the PCSX2 sources directory, as it makes it easier to delete all CMake build files: ``` mkdir build && cd build cmake .. <other options> ```

Do the compilation:

``` make ```

Install files:

``` make install ```

Reporting Cmake bugs

Not all distributions and configurations were tested. In case you encounter a CMake bug that is really a CMake issue, you can report it. Please provide the following information:

1. Linux distribution, the current kernel version, and architecture (32-bit or 64-bit) 2. The CMake commands. For example: `cmake CMakeLists.txt` 3. **All** of CMake's output. Something like this is good:

``` -- The C compiler identification is GNU -- The CXX compiler identification is GNU -- Check for working C compiler: /usr/bin/gcc -- Check for working C compiler: /usr/bin/gcc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Found GTK2_GTK: /usr/lib/libgtk-x11-2.0.so -- Looking for XOpenDisplay in /usr/lib/libX11.so;/usr/lib/libXext.so -- Looking for XOpenDisplay in /usr/lib/libX11.so;/usr/lib/libXext.so - found -- Looking for gethostbyname -- Looking for gethostbyname - found -- Looking for connect -- Looking for connect - found -- Looking for remove -- Looking for remove - found -- Looking for shmat -- Looking for shmat - found -- Looking for IceConnectionNumber in ICE -- Looking for IceConnectionNumber in ICE - found -- Found X11: /usr/lib/libX11.so -- Found ALSA: /usr/lib/libasound.so -- Found BZip2: /usr/lib/libbz2.so -- Looking for BZ2_bzCompressInit in /usr/lib/libbz2.so -- Looking for BZ2_bzCompressInit in /usr/lib/libbz2.so - found -- Looking for include files CMAKE_HAVE_PTHREAD_H -- Looking for include files CMAKE_HAVE_PTHREAD_H - found -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Found Threads: TRUE -- Found wxWidgets: TRUE -- Found ZLIB: /usr/lib/libz.so -- Found Cg: /usr/lib/libCg.so;/usr/lib/libCgGL.so -- Found PortAudio: /usr/lib/libportaudio.so -- Found SoundTouch: /usr/lib/libSoundTouch.so -- Configuring done -- Generating done -- Build files have been written to: /mnt/playstation/emulateur/package/pcsx2.snapshot-4810 ```

Ubuntu PPA

With multiarch functionality, you can install a 32-bit PPA on a 64-bit Ubuntu. You need at least Ubuntu 12.04 (Precise) to do this.

Add the x86 architecture to your package manager (x64 installs of 12.04 or newer only)

In a terminal, type: ```` sudo dpkg --add-architecture i386 ````

Add the multiverse package repository

Uncomment lines looking like this, where trusty is replaced by your Ubuntu version ```` deb http://us.archive.ubuntu.com/ubuntu/ trusty multiverse deb-src http://us.archive.ubuntu.com/ubuntu/ trusty multiverse deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates multiverse deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-updates multiverse ````

Add the PCSX2 PPA to your software sources

In a terminal, type: ``` sudo add-apt-repository ppa:gregory-hainaut/pcsx2.official.ppa sudo apt-get update ```

Install the package on your system

``` sudo apt-get install pcsx2 ```

Arch Linux

NOTE: for 64-bit architectures, multilib must be enabled in order to install PCSX2.

PCSX2 Stable

Open a terminal, and type: ``` sudo pacman -S pcsx2 ```

PCSX2 Unstable

Add or uncomment the following lines in `/etc/pacman.conf`: ``` [Multilib] Include = /etc/pacman.d/mirrorlist ``` Refresh package list: ``` pacman -Sy ```

Download the tarball from the [AUR package page](https://aur.archlinux.org/packages/pcsx2-git), and unpack it. Open the folder that you just unpacked in a terminal, and type: ``` makepkg -csi ``` This will build the package, automatically installing all dependencies. It will then prompt for your password to install the package with pacman.