Skip to content
Rolf Eike Beer edited this page Feb 13, 2020 · 8 revisions

Setup for local development

Dependencies on Fedora

sudo yum install goocanvas-devel libgnome-devel libsoup-devel libsoup24-devel libcurl-devel cmake git

Dependencies on openSUSE

sudo zypper install libsoup-devel libgoocanvas3-devel gpsd-devel libcurl-devel libgnome-devel cmake git

Setup for N900 development

You first need to install Scratchbox with the N900 toolchain and things. Make sure that you have the liblocation software, which is hard to find these days as it is Nokia propietary and not on the original website anymore. OSM2go also needs a more recent curl and OpenSSL than the default N900 environment provides.

OpenSSL

OpenSSL can be coinstalled and is provided as a package. If it collides with the original openssl-dev packages just uninstall those, but not the openssl-lib packages.

curl

Curl is built as a static library, as a shared library would have the same name as the system curl. Since curl should be linked against the new OpenSSL that would break older applications.

There are 2 ways of doing this: the easy way is to download a curl source tarball, unpack it and move it to the OSM2go source directory. Rename the folder to just curl there. Then it will be automatically be built as a static library and used to create the binaries.

One can also do a manual configuration, which should work like this:

cd curl-7.65.1
LDFLAGS=-L/opt/openssl-1.0.2s/lib ./configure --disable-shared --disable-ftp --disable-ldap --disable-ldaps --disable-rtsp --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-manual --disable-sspi --with-ssl=/opt/openssl-1.0.2s --without-libssh2 --prefix=/opt/curl-7.65.1 --with-ca-path=/etc/certs/common-ca/
make -j 10
make install
ln -s curl-7.65.1 /opt/curl

CMake

Then you will need CMake. Until CMake 3.8 it was possible to build CMake with the Scratchbox compiler (a gcc 4.2.1), even as a binary that would run on N900 itself! For newer versions this does not work anymore (the bundled libuv needs some atomic instructions, later versions require C++11). But one can use a host CMake even inside the Scratchbox environment. The setup is like this:

SBOXDIR=/home/scratchbox/users/$(whoami)/targets/FREMANTLE_ARMEL
CMAKE_VERSION=cmake-3.13.0-Linux-x86_64

# download and install CMake
mkdir -p ${SBOXDIR}/opt
cd ${SBOXDIR}/opt
wget -q -O - https://cmake.org/files/$(echo v${CMAKE_VERSION#cmake-}| sed -r 's/\.[0-9]+-.*//')/${CMAKE_VERSION}.tar.gz | tar xz
rm -f cmake
ln -s ${CMAKE_VERSION} cmake

# now find out which additional libraries are needed from the host system
mkdir ${SBOXDIR}/../../lib64
cp $(ldd cmake/bin/cmake | sed -nr '/\/lib/s#.*[[:space:]]([^ ]*/lib[^ ]+).*#\1#p') ${SBOXDIR}/../../lib64

This picks the prebuilt CMake binary from the website, which has the advantage that it is built against a static libstdc++, removing one possible dependency. The other libraries are copied from the host system to /lib64 inside the Scratchbox environment, which is not otherwise used because all contained binaries are 32 bit.

Now you are cross-compiling, i.e. the host CMake binary and the target results have different CPU architecture. To make that work you need a CMake toolchain file. Luckily this one can be rather simple for Scratchbox environments:

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)

# specify the cross compiler
set(CMAKE_C_COMPILER /usr/bin/gcc)
set(CMAKE_CXX_COMPILER /usr/bin/g++)

In case you want it to find a manually build curl automatically you cound append the following lines

# automatically find the new curl
list(APPEND CMAKE_PREFIX_PATH "/opt/curl")

Save that at some handy place, e.g. /opt/scratchbox.cmake.

Building OSM2go

Configuring OSM2go needs to be done only once:

mkdir build
cd build
/opt/cmake/bin/cmake -D CMAKE_TOOLCHAIN_FILE=/opt/scratchbox.cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo ~/osm2go/

Building is slightly complicated, as the ImageMagick in Scratchbox is a bit broken and crashes when trying to convert the images. Just build only the code:

make -j 10 osm2go_lib osm2go/fast