Merkaartor/Compiling
From OpenStreetMap Wiki
Contents |
Linux/Mac OS X quick start
For people who do not need the Yahoo! imagery feature, the following should be sufficient:
Make sure, the necessary software is installed:
# For Ubuntu based systems: sudo apt-get install subversion libqt4-dev qt4-dev-tools gcc g++
(For Ubuntu "Hardy heron" or earlier, see below under "Problems".)
Get the latest snapshot:
svn co http://svn.openstreetmap.org/applications/editors/merkaartor/
...or a branch:
svn co http://svn.openstreetmap.org/applications/editors/merkaartor-branches/merkaartor-0.14-fixes/
Change directory and compile:
cd merkaartor/ qmake Merkaartor.pro make
Compile on Mac OS X (you might need qmake for Mac OS X http://trolltech.com/downloads/opensource/appdev/mac-os-cpp):
cd merkaartor/ (make clean) qmake -spec macx-g++ Merkaartor.pro make
Add NOUSEWEBKIT=1 if you are using a version of Qt below 4.4.0 or do not have QWebkit compiled in.
Test the binary:
./binaries/bin/merkaartor
Further info
Some useful snips that could be implemented to this page (but I don't feel to do it right now --Guido)
From this post -- but be aware that post 0.12 Merkaartor *does* require Qt 4.4 now:
For Qt < 4.4, you have to compile the webkit coming along Merkaartor (in versions < 0.12) to have Yahoo! imagery. This is done by "qmake All.pro". Once webkit is compiled, you can just "qmake Merkaartor.pro" to only rebuild Merkaartor. If you don't need Yahoo! imagery, do not have Qt 4.4.x with QWebkit builtin or have a Qt < 4.4.0 and Merkaartor >= 0.12, you can "qmake Merkaartor.pro NOUSEWEBKIT=1" to disable webkit altogether.
qmake options
The following options are available in the .pro file of Merkaartor:
| NOUSEWEBKIT | disable use of WebKit, effectively disabling Yahoo! imagery |
| TRANSDIR_MERKAARTOR | translations directory for merkaartor. Beware: The translations "executables" (i.e. *.qm") must exist before running qmake for them to be picked up for installation in Unix. Run lrelease Merkaartor.profirst. |
| TRANSDIR_SYSTEM | translations directory for Qt itself |
| OUTPUT_DIR | base directory for local output files |
| PREFIX | base prefix for installation |
| NODEBUG | no debug target |
| MOBILE | makes Merkaartor usable on devices with limited screen estate (e.g. QVGA) |
| GEOIMAGE | enable geotagged images (needs exiv2) |
| GPSD | use gpsd as location provider |
To specify an option, indicate it on the qmake command line, e.g.:
qmake Merkaartor.pro NODEBUG=1
Problems running qmake
If you get some errors like "WARNING: Found potential symbol conflict of ..." when running qmake, your qmake is probably using qt3. Try to start qmake with qt4:
qmake-qt4 Merkaator.pro
Problems running make
A lot of build errors may be due to having Qt version < 4.4. Ubuntu hardy users can get it from backports: add
deb http://archive.ubuntu.com/ubuntu hardy-backports main universe multiverse restricted
to /etc/apt/sources.list, then run
apt-get update apt-get install qt4-designer qt4-dev-tools qt4-qtconfig libqt4-core libqt4-dev libqt4-gui
If you previously had qt3 dev tools installed, you may also need to run
update-alternatives --config qmake update-alternatives --config moc
(and possibly also for uic, assistant, lrelease and lupdate).
On Mac OS X
If your make ends with the following error in the Linking phase:
/usr/bin/ld: /Library/Frameworks/QtWebKit.framework/QtWebKit load command 4 unknown cmd field /usr/bin/ld: /Library/Frameworks/QtSvg.framework/QtSvg load command 4 unknown cmd field /usr/bin/ld: /Library/Frameworks/QtXml.framework/QtXml load command 4 unknown cmd field /usr/bin/ld: /Library/Frameworks/QtGui.framework/QtGui load command 5 unknown cmd field /usr/bin/ld: /Library/Frameworks/QtNetwork.framework/QtNetwork load command 4 unknown cmd field /usr/bin/ld: /Library/Frameworks/QtCore.framework/QtCore load command 4 unknown cmd field collect2: ld returned 1 exit status
Your Xtools are probably too old. For Tiger, try upgrading to Xcode 2.5; which can be found (for free) at the Apple Developer site.
How to build Merkaartor on Windows
This describes how to build Merkaartor from source, with Qt 4.5, MinGW and Windows. The entire procedure will take about half an hour to an hour, depending on your CPU speed, internet link and wizardry skills. You should probably not do this in VMware. It'll work, but oddly things take four times as long.
Note: There are several external dependencies to libraries that need to be built before Merkaartor can be built. This How To includes all dependencies. You can possibly take a shortcut on that using the prebuilt dependencies for MinGW.
Downloads
- Qt for Open Source C++ development on Windows - with the MinGW compiler included (installer)
- newest version: http://www.qtsoftware.com/downloads/windows-cpp
- version 4.5.1: http://get.qtsoftware.com/qt/source/qt-win-opensource-4.5.1-mingw.exe
- Tested with version 4.5.1
- MSYS Base System (installer)
- http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=24963
- Tested with version 1.0.10
- zlib (source)
- http://www.zlib.net/
- Tested with version 1.2.3
- libexpat (source)
- http://sourceforge.net/project/showfiles.php?group_id=10127&package_id=10780
- Tested with version 2.0.1
- exiv2 library (source)
- http://www.exiv2.org/download.html
- Tested with version 0.18.1
- Merkaartor (source)
- http://www.merkaartor.org/Download/
- Tested with version svn-20090607
- optionally: SVN command-line client (to download latest Merkaartor source)
- optionally: TortoiseSVN (to download latest Merkaartor source)
Install
- Qt
- Target directory for MinGW: C:\MinGW
- Be sure MinGW is installed before you proceed. Should Qt fail to install MinGW, you can get the Automated MinGW Installer at SourceForge. Select the following components to install:
- MinGW base tools
- g++ compiler
- MinGW Make
- All components are downloaded through the installer. If one fails to download, SourceForge has a bad mirror; just click on "Retry" until it works.
- MSYS
- Target directory: C:\MSYS (I suggest you leave out the version number)
- Post installation configuration:
- Do you wish to continue with the post install? [yn ] y
- Do you have MinGW installed? [yn ] y
- Where is your MinGW installation? c:/mingw
- optionally: TortoiseSVN (Windows restart required)
Unpack downloaded archives
In this how-to, the development root directory is Z:\dev. Its MSYS equivalent is /z/dev. Whereever you see them here, change them to your local paths.
- zlib -> z:\dev\zlib
- libexpat -> z:\dev\expat (strip top-level archive directory)
- exiv2 -> z:\dev\exiv2 (strip top-level archive directory)
- Merkaartor -> z:\dev\merkaartor
- optionally: SVN binaries -> z:\dev\svn (no subdirectory, put svn.exe right in here)
Build the libraries
All following lines in the box are meant to be typed into the MSYS shell (find it in your start menu).
Build zlib:
cd /z/dev
cd zlib
./configure
make
mkdir include lib
cp z{lib,conf}.h include
cp libz.a lib
cd ..
Build libexpat:
cd expat
./configure
make
mkdir include
cp lib/expat{,_external}.h include
cp .libs/libexpat.a lib/libexpat.a
cd ..
Build exiv2:
cd exiv2
mypath=`pwd`/..
./configure --with-zlib=$mypath/zlib --with-expat=$mypath/expat --disable-shared
make
mkdir include include/exiv2 lib
cp src/*.h{,pp} include/exiv2
cp src/.libs/libexiv2.a lib
cd ..
All following lines in the box are meant to be typed at the Qt command prompt (find it in your start menu).
Optionally download the latest SVN source of Merkaartor: (This will download all source files into the merkaartor subdirectory. You better rename it if you already have one.)
cd /d z:\dev svn\svn co http://svn.openstreetmap.org/applications/editors/merkaartor/
Build Merkaartor
Edit the file src\Custom.pri in Merkaartor's directory and add the following contents:
# This fixed a bug in earlier Qt (4.4.3) together with earlier MinGW's winbase.h. # It is not required anymore in current version. # DEFINES += __INTERLOCKED_DECLARED # Add more search paths for libraries and include files. LIBS += -L$$PWD/../../exiv2/lib -L$$PWD/../../expat/lib -lexiv2 -lexpat INCLUDEPATH += $$PWD/../../exiv2/include # The paths are specific to our build setup. # -lexpat was forgotten in Merkaartor's Makefile. # -lexiv2 must occur before -lexpat! Since the original Makefile doesn't do # that, we add it again in the required order. # Enable support for geo-tagged images, we meet all requirements. GEOIMAGE=1 # Add more qmake options here if you like. # See Config.pri or Merkaartor.pro for a reference.
Still in the Qt command prompt...
cd /d z:\dev cd merkaartor qmake -r NODEBUG=1 make
In case you need a debug build, leave away the parameter "NODEBUG=1".
Should the make command not be found, you can try mingw32-make instead.
Now build the translation files in a separate step:
cd translations make release cd ..
Copy dependency files
Now copy all Merkaartor and Qt translations, DLLs and the binary into a new directory:
mkdir output copy "binaries\win32-g++\bin\merkaartor.exe" output mkdir output\plugins xcopy /s "binaries\win32-g++\bin\plugins" output\plugins copy translations\*.qm output mkdir output\translations copy %QTDIR%\translations\qt_??.qm output\translations copy %QTDIR%\translations\qt_??_??.qm output\translations copy %QTDIR%\bin\mingwm10.dll output
(If the last file doesn't exist, go look for it where you have installed MinGW to, e.g. C:\MinGW\bin, and also copy it to the specified Qt\bin directory, since Qt tools will also need this DLL.)
mkdir output\imageformats copy %QTDIR%\plugins\imageformats\qico4.dll output\imageformats copy %QTDIR%\plugins\imageformats\qtiff4.dll output\imageformats\qtif4.dll copy %QTDIR%\plugins\imageformats\qsvg4.dll output\imageformats copy %QTDIR%\plugins\imageformats\qgif4.dll output\imageformats copy %QTDIR%\plugins\imageformats\qjpeg4.dll output\imageformats
If you've built a release executable, use these files:
copy %QTDIR%\bin\QtWebKit4.dll output copy %QTDIR%\bin\QtSvg4.dll output copy %QTDIR%\bin\QtGui4.dll output copy %QTDIR%\bin\QtNetwork4.dll output copy %QTDIR%\bin\QtXml4.dll output copy %QTDIR%\bin\QtCore4.dll output
If you've built a debug executable, use these files:
copy %QTDIR%\bin\QtWebKitd4.dll output copy %QTDIR%\bin\QtSvgd4.dll output copy %QTDIR%\bin\QtGuid4.dll output copy %QTDIR%\bin\QtNetworkd4.dll output copy %QTDIR%\bin\QtXmld4.dll output copy %QTDIR%\bin\QtCored4.dll output
You can now execute Merkaartor.exe in the directory output.

