Compiling: ARM

From ArcEmu-Wiki
Jump to: navigation, search

This is a quick notebook to place hints about compiling arcemu for/on arm processors.

The sourcecode needs patching to build for arm and there are likely to be a range of new bugs that weren't present on x86. I opened a pull request which has the forst of those changes here: https://github.com/arcemu/arcemu/pull/386

When building directly on the device, the default Linux instructions apply neatly.

The following section is about cross-compiling on a more powerful machine.

CMake does support cross compiling and relies on a few preset variables which can be set in a so-called toolchain file like this one:

# Toolchain file targeting debian wheezy armhf
# using CodeSourcery Toolchain
 
SET(CMAKE_SYSTEM_NAME "Linux")
SET(CMAKE_SYSTEM_VERSION "Wheezy")
# CMAKE_SYSTEM_PROCESSOR
SET(CMAKE_C_COMPILER "/opt/cross/bin/arm-none-linux-gnueabi-gcc")
SET(CMAKE_CXX_COMPILER "/opt/cross/bin/arm-none-linux-gnueabi-g++")
 
SET(CMAKE_FIND_ROOT_PATH "/home/Artox/Documents/WoW/wheezy-root")
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM "ONLY")
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY "ONLY")
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE "ONLY")
 
# weird debian way of placing libraries
SET(ZLIB_LIBRARY "/lib/arm-linux-gnueabihf")
SET(PCRE_LIBRARY "/lib/arm-linux-gnueabihf")
 
# openssl will not be found at all because the FindOpenSSL.cmake script is bad
# I had to create a symlink in /usr/lib for them
# The same applies to libmysqlclient

As can be seen, you need to specify the cross compiler to use, the system name, and the place of teh arm root filesystem where headers and libraries for the target platform can be found. The trouble with openssl and libmysqlclient may not happen on ubuntu/debian hosts, and also when not using debian or ubuntu on the target device. In this case, wheezy-root is just the sshfs mountpoint to my beaglebone which is on the same LAN.

The commandline to invoke cmake then looks like this:

cmake ../arcemu/cmake -DCMAKE_TOOLCHAIN_FILE=../arm-toolchain.cmake
Personal tools