Difference between revisions of "Compiling ScummVM/RPI"
Praetorian (talk | contribs) |
Praetorian (talk | contribs) |
||
Line 57: | Line 57: | ||
Now we configure scummvm buildsystem so it knows what backend we want and where is our raspberry pi local sysroot living, containing the Raspberry Pi headers and libs the cross-compiler and linker will need. In this example configuration, we disable additional libs, and debug symbols since it's intended for final users. | Now we configure scummvm buildsystem so it knows what backend we want and where is our raspberry pi local sysroot living, containing the Raspberry Pi headers and libs the cross-compiler and linker will need. In this example configuration, we disable additional libs, and debug symbols since it's intended for final users. | ||
./configure --host=raspberrypi --with-sdl-prefix=$RPI_ROOT/usr | <nowiki> | ||
PKG_CONFIG_SYSROOT_DIR=$RPI_ROOT PKG_CONFIG_LIBDIR=$RPI_ROOT/usr/lib/arm-linux-gnueabihf/pkgconfig ./configure --host=raspberrypi --with-sdl-prefix=$RPI_ROOT/usr --with-png-prefix=$RPI_ROOT/usr --disable-debug --enable-release</nowiki> | |||
Remember you should have exported the RPI_ROOT enviroment variable previously. | Remember you should have exported the RPI_ROOT enviroment variable previously. | ||
On the | On the Raspberry Pi, SDL2 will always be used since it provides graphics acceleration. | ||
''Note:'' If you are building ScummVM on your | '''Note:''' If you are building ScummVM directly on your Raspberry Pi itself, you might run out of memory during the final linking process of the build. If you use GNU ''ld'' for compiling, you could execute the following before running ''configure'': | ||
<nowiki>export LDFLAGS="-Wl,--no-keep-memory</nowiki> | |||
This tells GNU ''ld'' to optimize for memory usage. | |||
== Compiling ScummVM == | == Compiling ScummVM == |
Revision as of 21:35, 8 April 2020
Cross-compiling ScummVM on for Raspberry Pi
Installing the official Raspberry Pi cross-compiler on PC
We will clone the Raspberry Pi tools repository which includes the cross-compiler we need:
git clone https://github.com/raspberrypi/tools.git
It will get cloned to a directory called tools at your current location.
Add it to the PATH environment variable so that we have the cross-compiler binaries available from our scummvm building directory. For example, if my Raspberry Pi tools repository ended cloned in tools under my home directory, I would do:
export PATH=$PATH:$HOME/tools/arm-bcm2708/arm-linux-gnueabihf/bin
After adding the cross-compiler executables directory to PATH, we should be able to run arm-linux-gnueabihf-gcc, arm-linux-gnueabihf-g++, etc... just try. They should yield an error because you pass them no input files, but that's expected. It's just a test so we know we have the cross-compiler installed and accessible.
Installing the needed Raspberry Pi headers and libraries on PC
We need to copy over the /usr, /lib and /opt directories from your Raspbian SD Card to your host PC (the computer were you will do the cross-compilation) for the needed headers and libraries to be available.
Of course, first you'll have to install any additional libraries from Raspbian running on the Pi before expecting them to be available so, if you want compile ScummVM with FLAC support, you should have installed the libflac development libraries on the Pi beforehand.
As an example, on the Raspberry Pi running Raspbian (Buster) OS 3.2 (January 2020) we can execute the following to install third party libraries that ScummVM needs for its features and various game engines:
sudo apt-get update sudo apt-get upgrade sudo apt-get install -y --no-install-recommends \ libsdl2-dev \ liba52-0.7.4-dev \ libjpeg62-turbo-dev \ libmpeg2-4-dev \ libogg-dev \ libvorbis-dev \ libflac-dev \ libmad0-dev \ libpng-dev \ libtheora-dev \ libfaad-dev \ libfluidsynth-dev \ libfreetype6-dev \ libcurl4-openssl-dev \ libsdl2-net-dev \ libspeechd-dev \ zlib1g-dev
On the host PC we first export the path where we will copy these into, and then we manually copy them. I choose to copy the Raspberry Pi headers and libraries to /opt/rpi_root, but any other path with the right permissions for your user (within common sense) should be ok:
mkdir -p /opt/rpi_root export RPI_ROOT=/opt/rpi_root cd <Raspbian_SD_card_mountpoint_directory> cp -R usr lib opt $RPI_ROOT
Configuring ScummVM
Now we configure scummvm buildsystem so it knows what backend we want and where is our raspberry pi local sysroot living, containing the Raspberry Pi headers and libs the cross-compiler and linker will need. In this example configuration, we disable additional libs, and debug symbols since it's intended for final users.
PKG_CONFIG_SYSROOT_DIR=$RPI_ROOT PKG_CONFIG_LIBDIR=$RPI_ROOT/usr/lib/arm-linux-gnueabihf/pkgconfig ./configure --host=raspberrypi --with-sdl-prefix=$RPI_ROOT/usr --with-png-prefix=$RPI_ROOT/usr --disable-debug --enable-release
Remember you should have exported the RPI_ROOT enviroment variable previously. On the Raspberry Pi, SDL2 will always be used since it provides graphics acceleration.
Note: If you are building ScummVM directly on your Raspberry Pi itself, you might run out of memory during the final linking process of the build. If you use GNU ld for compiling, you could execute the following before running configure:
export LDFLAGS="-Wl,--no-keep-memory
This tells GNU ld to optimize for memory usage.
Compiling ScummVM
Run the following commands:
make clean make -j$(nproc)
Installing ScummVM on the Raspberry Pi
Simply copy over the resulting scummvm executable to your Raspberry Pi (Raspbian OS) SD Card. A good idea is to create a scummvm folder in your /home/pi directory on the Raspian OS SD Card, and put the executable there along with any games you want to use with it.
In order to have the text-to-speech feature available for ScummVM you should also install the speech-dispatcher package and a text-to-speech engine (as per the instructions in this pertinent Pull Request)
For example you'd need to execute the following on your Raspbian OS on the Pi in order to use the espeak-ng text-to-speech engine:
sudo apt-get install --no-install-recommends speech-dispatcher speech-dispatcher-espeak-ng