Difference between revisions of "Compiling ScummVM/GCC"

From ScummVM :: Wiki
Jump to navigation Jump to search
(Removed →‎Further reading: The information it linked to in the readme isn't there.)
 
(21 intermediate revisions by 6 users not shown)
Line 1: Line 1:
== Compiling ScummVM with GCC under Linux ==
== Compiling ScummVM with GCC on Unix-based systems ==


==Installing the needed libraries via a package manager==
==Installing the needed libraries via a package manager==
===Debian-based distributions===
===Ubuntu 16.04 or later===
The following should install all the needed libraries:
The following should install all the needed libraries:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
apt-get install g++ make libsdl2-dev liba52-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 zlib1g-dev libfribidi-dev
apt install g++ make git nasm libsdl2-dev libsdl2-net-dev liba52-dev libjpeg-turbo8-dev libmpeg2-4-dev libogg-dev libvorbis-dev libflac-dev libmad0-dev libpng-dev libtheora-dev libfaad-dev libfluidsynth-dev libfreetype6-dev zlib1g-dev libfribidi-dev libgif-dev libcurl4-openssl-dev libgtk-3-dev libspeechd-dev libsndio-dev libunity-dev libvpx-dev libmikmod-dev
</syntaxhighlight>
</syntaxhighlight>


For Ubuntu, you can also obtain libunity:
===Other Debian-based distributions===
<syntaxhighlight lang="bash">
The following should install all the needed libraries:
apt-get install libunity-dev
</syntaxhighlight>
 
===Ubuntu 18.04 to 20.04===
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
apt install g++ make libsdl2-dev liba52-dev libjpeg-turbo8-dev libmpeg2-4-dev libogg-dev libvorbis-dev libflac-dev libmad0-dev libpng-dev libtheora-dev libfaad-dev libfluidsynth-dev libfreetype6-dev zlib1g-dev libfribidi-dev
apt-get install g++ make git nasm libsdl2-dev libsdl2-net-dev liba52-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 zlib1g-dev libfribidi-dev libgif-dev libcurl4-openssl-dev libgtk-3-dev libspeechd-dev libsndio-dev libvpx-dev libmikmod-dev
</syntaxhighlight>
</syntaxhighlight>


Line 21: Line 17:
The following should install all the needed libraries (apart from fluidsynth):
The following should install all the needed libraries (apart from fluidsynth):
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
yum install gcc-c++ make SDL-devel libjpeg-turbo-devel libmpeg2-devel libogg-devel libvorbis-devel flac-devel libmad-devel libpng-devel libtheora-devel faad2-devel freetype-devel zlib-devel fribidi-devel
yum install gcc-c++ make SDL-devel libjpeg-turbo-devel libmpeg2-devel libogg-devel libvorbis-devel flac-devel libmad-devel libpng-devel libtheora-devel faad2-devel freetype-devel zlib-devel fribidi-devel libvpx-dev libmikmod-dev
</syntaxhighlight>
</syntaxhighlight>


Line 27: Line 23:
The following command installs the compiler toolchain and all the needed libraries:
The following command installs the compiler toolchain and all the needed libraries:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
pacman -S --needed base-devel git curl faad2 freetype2 flac fluidsynth libjpeg-turbo libogg libvorbis libmad libmpeg2 libtheora libpng nasm readline sdl2 sdl2_net zlib fribidi
pacman -S --needed base-devel git curl faad2 freetype2 flac fluidsynth libjpeg-turbo libogg libvorbis libmad libmpeg2 libtheora libpng nasm readline sdl2 sdl2_net zlib fribidi libspeechd libvpx libmikmod
</syntaxhighlight>
</syntaxhighlight>


Per default, some Arch based distributions like Manjaro and Antergos require the usage of "sudo" to gain root access.
Per default, some Arch based distributions like Manjaro and Antergos require the usage of "sudo" to gain root access.
===FreeBSD-based distributions===
The following should install all the needed libraries:
<syntaxhighlight lang="bash">
pkg install git gmake pkgconf sdl2 faad2 freetype2 libogg libvorbis libiconv libmpeg2 libtheora libmad png flac fluidsynth sndio liba52 fribidi jpeg-turbo sdl2_net curl gtk3 speech-dispatcher libvpx libmikmod
</syntaxhighlight>
===OpenBSD-based distributions===
The following should install all the needed libraries:
<syntaxhighlight lang="bash">
pkg_add git gmake sdl2 faad libogg libvorbis libiconv libmpeg2 libtheora libmad png flac fluidsynth liba52 fribidi jpeg sdl2-net curl gtk+3 speech-dispatcher libvpx libmikmod
</syntaxhighlight>


== Configuring ScummVM ==
== Configuring ScummVM ==
Run the configure script - type "./configure" in the directory with the ScummVM source files. If no errors come up, you should be ready to compile ScummvM. Run "./configure --help" for a list of optional features (eg additional, not yet enabled engines).
Run the configure script in the directory with the ScummVM source files:
<syntaxhighlight lang="bash">
./configure
</syntaxhighlight >
 
If no errors come up, you should be ready to compile ScummvM.
 
It's possible to build ScummVM with Clang instead of GCC using the following command:
<syntaxhighlight lang="bash">
CXX=clang++ ./configure
</syntaxhighlight >
This is necessary in order to build ScummVM on OpenBSD.
 
For a list of optional features (e.g. additional, not yet enabled engines) run:
<syntaxhighlight lang="bash">
./configure --help
</syntaxhighlight >


''Note:'' If you are building ScummVM on a system with low main memory (for example, lower than 256MB), you might run out of memory during linking. If you use GNU ld for compiling you can try exporting LDFLAGS="-Wl,--no-keep-memory" before running configure. This tells GNU ld to optimize for memory usage.
''Note:'' If you are building ScummVM on a system with low main memory (for example, lower than 256MB), you might run out of memory during linking. If you use GNU ld for compiling you can try exporting LDFLAGS="-Wl,--no-keep-memory" before running configure. This tells GNU ld to optimize for memory usage.


== Compiling ScummVM ==
== Compiling ScummVM ==
run "make clean" and then "make"
Run:
<syntaxhighlight lang="bash">
make clean
make
</syntaxhighlight >


It is recommended to run parallel make. Run it with command "make -j10" where "10" is the number of your CPUs, including virtual ones +2. Typical Intel Core i7 has 8 CPUs.
It is recommended to run parallel make. For example to run with 8 CPU cores use:
<syntaxhighlight lang="bash">
make -j10
</syntaxhighlight >
A good number is to use the number of your CPU cores, including virtual ones, +2. Typical Intel Core i7 has 8 CPU cores.
 
On BSD systems, it is necessary to use GNU make, since BSD make will not work with ScummVM. Instead, run:
<syntaxhighlight lang="bash">
gmake clean
gmake
</syntaxhighlight >


== Installing ScummVM ==
== Installing ScummVM ==
either run ./scummvm from the current directory or run make install to install ScummVM (you can then run it using "scummvm" from any directory)
either run ./scummvm from the current directory or run make install to install ScummVM (you can then run it using "scummvm" from any directory)
== Further reading ==
* [https://github.com/scummvm/scummvm/blob/master/README.md#100-compiling ScummVM README, Section 10.0]

Latest revision as of 15:05, 5 October 2023

Compiling ScummVM with GCC on Unix-based systems

Installing the needed libraries via a package manager

Ubuntu 16.04 or later

The following should install all the needed libraries:

apt install g++ make git nasm libsdl2-dev libsdl2-net-dev liba52-dev libjpeg-turbo8-dev libmpeg2-4-dev libogg-dev libvorbis-dev libflac-dev libmad0-dev libpng-dev libtheora-dev libfaad-dev libfluidsynth-dev libfreetype6-dev zlib1g-dev libfribidi-dev libgif-dev libcurl4-openssl-dev libgtk-3-dev libspeechd-dev libsndio-dev libunity-dev libvpx-dev libmikmod-dev

Other Debian-based distributions

The following should install all the needed libraries:

apt-get install g++ make git nasm libsdl2-dev libsdl2-net-dev liba52-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 zlib1g-dev libfribidi-dev libgif-dev libcurl4-openssl-dev libgtk-3-dev libspeechd-dev libsndio-dev libvpx-dev libmikmod-dev

RPM-based distributions

The following should install all the needed libraries (apart from fluidsynth):

yum install gcc-c++ make SDL-devel libjpeg-turbo-devel libmpeg2-devel libogg-devel libvorbis-devel flac-devel libmad-devel libpng-devel libtheora-devel faad2-devel freetype-devel zlib-devel fribidi-devel libvpx-dev libmikmod-dev

Arch Linux-based distributions

The following command installs the compiler toolchain and all the needed libraries:

pacman -S --needed base-devel git curl faad2 freetype2 flac fluidsynth libjpeg-turbo libogg libvorbis libmad libmpeg2 libtheora libpng nasm readline sdl2 sdl2_net zlib fribidi libspeechd libvpx libmikmod

Per default, some Arch based distributions like Manjaro and Antergos require the usage of "sudo" to gain root access.

FreeBSD-based distributions

The following should install all the needed libraries:

pkg install git gmake pkgconf sdl2 faad2 freetype2 libogg libvorbis libiconv libmpeg2 libtheora libmad png flac fluidsynth sndio liba52 fribidi jpeg-turbo sdl2_net curl gtk3 speech-dispatcher libvpx libmikmod

OpenBSD-based distributions

The following should install all the needed libraries:

pkg_add git gmake sdl2 faad libogg libvorbis libiconv libmpeg2 libtheora libmad png flac fluidsynth liba52 fribidi jpeg sdl2-net curl gtk+3 speech-dispatcher libvpx libmikmod

Configuring ScummVM

Run the configure script in the directory with the ScummVM source files:

./configure

If no errors come up, you should be ready to compile ScummvM.

It's possible to build ScummVM with Clang instead of GCC using the following command:

CXX=clang++ ./configure

This is necessary in order to build ScummVM on OpenBSD.

For a list of optional features (e.g. additional, not yet enabled engines) run:

./configure --help

Note: If you are building ScummVM on a system with low main memory (for example, lower than 256MB), you might run out of memory during linking. If you use GNU ld for compiling you can try exporting LDFLAGS="-Wl,--no-keep-memory" before running configure. This tells GNU ld to optimize for memory usage.

Compiling ScummVM

Run:

make clean
make

It is recommended to run parallel make. For example to run with 8 CPU cores use:

make -j10

A good number is to use the number of your CPU cores, including virtual ones, +2. Typical Intel Core i7 has 8 CPU cores.

On BSD systems, it is necessary to use GNU make, since BSD make will not work with ScummVM. Instead, run:

gmake clean
gmake

Installing ScummVM

either run ./scummvm from the current directory or run make install to install ScummVM (you can then run it using "scummvm" from any directory)