Wiki

Clone wiki

karhu / Dependencies

The Karhu library itself has relatively few dependencies, but the complete build system with support for building and running on many different targets has quite a lot.

Mac instructions will assume that Homebrew be installed. Linux instructions will be for Debian (Ubuntu) and use apt-get.

I will try and create installation scripts eventually to set most of this stuff up automatically. For now this serves as a reference.

Prerequisites

Karhu uses C++14, so you need a compiler that fully supports it. You're expected to use g++ on Linux and Apple's LLVM (clang) on Mac. To build for Windows on Linux, use a recent version of MinGW 64.

Mac

Homebrew

The instructions below assume that Homebrew be installed. If not, install it as such (but refrain from doing so if MacPorts is installed, as the two are known to clash; try and grab the libraries from there instead):

#!

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

This itself assumes Ruby to be present, but it should be already.

You'll also need cask to get all the stuff from Homebrew. Best update when you're done, too:

#!

brew install cask
brew update

Both Linux and Mac

git

Needed to download Karhu itself the correct way, and used by the tools. Sometimes already installed. If not:

Mac

#!
brew install git

Linux

#!
[sudo] apt-get install git

cURL

A few things require downloads be made this way. Is probably already installed, but if not it's easy to get:

Mac

#!

brew install curl

Linux

#!

[sudo] apt-get install curl

ImageMagick convert

Used by the build system to generate icons and splash screens for applications in all the necessary sizes based on a single set of images. May already be installed, but if not:

Mac

#!
brew install imagemagick

Linux

#!
[sudo] apt-get install imagemagick

Note that the name of the actual command needed is convert, so that's what you need to check for.


Karhu library

SDL 2

This is the main dependency. Karhu currently expects to find SDL 2 in default locations when installed through the package managers Homebrew and apt-get on Mac and Linux respectively, i.e. /usr/local/include/SDL2 and /usr/include/SDL2.

Mac

#!

brew install sdl2

Linux

#!

[sudo] apt-get install libsdl2-dev

OpenGL and GLEW

OpenGL is probably already installed on both UNIX systems. Karhu requires OpenGL 3.1+ support to run. GLEW is also necessary.

#!

brew install glew

Linux

#!

[sudo] apt-get install libglew-dev

Tools

To compile the tools you need a few additional dependencies.

Boost libraries

You'll have to download the latest archive with Boost and compile and install the 'system' and 'filesystem' subsystems yourself. These are used for advanced filesystem I/O and a prerequisite for the unofficial 'process' subsystem (packed with Karhu and compiled with the tools) used to interface with the various build commands.

Mac and Linux

The process is the same on both UNIX systems. Extracts the archive somewhere and cd into it from the command line. Then you need to do the following:

#!

sudo ./bootstrap.sh --with-libraries=program_options,filesystem,system --prefix=/usr/local/include
sudo ./b2 install

That should be it so long as all prerequisites are there.


Build support

Premake

Karhu uses Premake to build itself, its tools and games using Karhu (except for Android build support which uses CMake; see relevant section). Premake 5 is needed.

Mac

Just use Homebrew. At the time of writing you will have to supply the --devel option to make sure you're getting the right version:

#!

brew install premake --devel

Linux

Unless this has changed at the time of reading, the version from apt-get is too old. You could try and find a package for the latest version elsewhere, but the recommended method right now is to download the archived binary from the website and put it into /usr/local/bin (make sure it's in your $PATH).

CMake

Mac

Using Homebrew:

#!

brew install cmake

Linux

Using apt-get:

#!

[sudo] apt-get install cmake

macOS and iOS build support

Currently only supported from macOS.

Mac

Xcode and command-line tools

Install a recent version of Xcode and make sure the command line tools also get installed. You can run this to do so:

#!
xcode-select --install

If they're already installed, you'll be notified. If not, you'll have to go through a series of dialogues to complete the process.

Ruby, gem and libraries

You need Ruby and RVM to run and download xcodeproj for Karhu to manage Xcode projects. Install RVM like so:

#!

\curl -sSL https://get.rvm.io | bash -s stable

You may need to start a new terminal session for the effects to take place. You should now also have gem. Use it to install the library:

#!

gem install xcodeproj

Node.js and ios-deploy

Node.js is used to install a couple of utilities which are used to setup and install and run iOS apps on a device or a simulator. Using Homebrew:

#!

brew install node.js

You can then use its package manager to get the tools:

#!

npm install -g --unsafe-perm ios-deploy
npm install -g ios-sim
npm install -g ios-splash
npm install -g ios-icons

ideviceinstaller

You will need this to be able to find the connected iOS device. Using Homebrew:

#!

brew install ideviceinstaller

Linux build support

Currently only supported on Linux.

Linux

Install a recent version of GCC (g++) in order to support C++14:

#!

[sudo] apt-get install g++

Windows build support

Currently only supported on Linux.

Linux

Install a recent version of MinGW in order to support C++14. You'll have to use the mingw-w64 project and go here to grab and install version 5.0.2 (something like mingw-w64_5.0.2-2_all.deb) which is the version that was used to build the libraries (SDL and so on) packaged with Karhu. Make sure it ends up under /usr/i686-w64-mingw32/ and that the include/ and lib/ subdirectories are present. You then have to call [sudo] update-alternatives --config i686-w64-mingw32-g++ and make it so that it points at the POSIX version, i686-w64-mingw32-g++-posix, so that things such as std::mutex will work.

In addition there are some headers that won't be there by default. The main ones are the SDL2 headers. It is recommended you create a symlink in the MinGW include directory to whatever SDL2 installation you have elsewhere.

Then there are a couple of small headers that you might as well copy in there:

  • iconv.h
  • features.h
  • stdc-predef.h
  • endian.h
  • GL/glew.h

Additionally, symlink the following subfolders:

  • gnu/
  • bits/

If you're missing files such as gnu/stubs-32.h you will need to install libc6-dev-i386 on Ubuntu or a corresponding library on other distros (see here).

Additional tools

Icon utilities are needed to generate a program icon for Windows. If icotool isn't already installed, run:

[sudo] apt-get install icoutils

Finally, running requires Wine.

[sudo] apt-get install wine

Android build support

Currently only supported on Mac.

Mac

CMake

Instead of Premake, Android uses CMake which needs to be installed. Using Homebrew:

#!

brew install cmake

Android stuff

Most of it is in a subfolder of the Karhu SDK (not on the repository; too big), including CrystaX NDK (version 10.3.2 (64-bit) was used to build the libraries (SDL and so on) packaged with Karhu), but it may be necessary to install a few separate things:

#!

brew install ant maven gradle

Web build support

Currently only works on Mac and uses Emscripten (the setup might actually mostly work on Linux, however, if Emscripten is set up correctly), which has been packaged with Karhu and set up already (not on the repository; too big).

There should be an .emscripten file within this prepackaged directory and the global ~/.emscripten should not be used.

If you update the SDK within this directory, remember to add the --embedded flag when you run emsdk activate latest to make sure everything goes locally!

Emscripten works its black magic as usual and nothing else needs to be precompiled or downloaded. All it needs is access to the SDL2 include files which are the same as used for macOS, so just make sure the prerequisites are met to begin with.

Updated