Difference between revisions of "Linux development"

From Navit's Wiki
Jump to: navigation, search
 
(28 intermediate revisions by 12 users not shown)
Line 1: Line 1:
This is a small reference guide for compiling and running Navit on an Ubuntu Linux laptop. It is intended as a quick reference, and assumes that you are somewhat used to compiling software already. This guide also assumes that you want to run the bleeding-edge SVN (development) version. If you find any missing detail/step, feel free to add it to this page. --[[User:Kiddo|Kiddo]] 16:05, 7 November 2008 (CET)
 
 
 
= Taking care of dependencies =
 
= Taking care of dependencies =
See the [[Dependencies]] page for a list of software packages required to build Navit. If any are missing, please update those pages.
+
See the [[Dependencies]] page for a list of software packages required to build Navit. To build with [[#CMake|CMake]] you will need '''CMake 2.6''' or newer.
  
= Getting Navit from the Subversion (SVN) repository =
+
= Getting Navit from the GIT repository =
 
First, let's make sure we are in our home directory: this is only for the sake of making this tutorial simple to follow. You can save that directory anywhere you want, but you will have to adapt the rest of the instructions of this guide to your particular case.
 
First, let's make sure we are in our home directory: this is only for the sake of making this tutorial simple to follow. You can save that directory anywhere you want, but you will have to adapt the rest of the instructions of this guide to your particular case.
 
  cd ~  
 
  cd ~  
  
Now, let's grab the code from SVN. This assumes that you have subversion installed.
+
Now, let's grab the code from Git. This assumes that you have git binaries installed.
svn co https://navit.svn.sourceforge.net/svnroot/navit/trunk/navit/ '''navit'''
+
  git clone https://github.com/navit-gps/navit.git
  
 
= Compiling =
 
= Compiling =
Go to the directory where you checked out the svn repository:
+
GNU autotools was the old method but is removed in favour of CMake.
cd '''navit'''
 
  
Start the make dance:
+
==CMake==
  ./autogen.sh && ./configure && make
+
CMake builds Navit in a separate directory of your choice - this means that the directory in which the Git source was checked out remains untouched. See also [[CMake]].
 +
  mkdir navit-build
 +
cd navit-build
  
It is better to use autogen and configure before make, due to the heavy flux of changes in the svn version. Also, putting them all in one command ensures that they go through the next step only if the previous step succeeded. In the end, hopefully, you get a fully compiled navit binary in the navit/ subfolder (so basically, it looks like ~/'''navit'''/navit/navit. Yeah.)
+
Once inside the build directory just call the following commands:
 +
cmake ~/navit
 +
make
  
= Running the compiled binary =
+
'''Note:''' CMake will autodetect your system configuration on the first run, and cache this information. Therefore installing or removing libraries after the first CMake run may confuse it and cause weird compilation errors (though installing new libraries should be ok). If you install or remove libraries/packages and subsequently run into errors, do a clean CMake run:
Here, I am skipping the usual "make install" (in my case, "sudo checkinstall make install") step, because I don't care about installing navit systemwide. I run navit directly from its svn folder, and it makes things much simpler (and safer).
+
  rm -r ~/navit-build/*
 +
  cmake ~/navit
 +
 
 +
===Running the compiled binary===
 +
The binary is called '''navit''' and can be run without arguments:
 +
cd ~/navit-build/navit/
 +
./navit
 +
 
 +
It is advised to just run this binary locally at the moment (i.e. not to install system-wide).
 +
Note that for this to work, Navit must be run from the directory where it resides (that is, you must first change your working directory, as described above). If Navit is run from another directory, it will not find its plugins and image files, and will not start.
 +
 
 +
===Running the compiled binary===
 +
Here, I am skipping the usual "make install" because we don't need to install navit systemwide for this example.
  
 
To execute navit, you can simply click on the binary file (if you are sure it is compiled properly) and it should launch. If you prefer to launch it from a terminal, you need to go into the directory containing the binary, first, like so:
 
To execute navit, you can simply click on the binary file (if you are sure it is compiled properly) and it should launch. If you prefer to launch it from a terminal, you need to go into the directory containing the binary, first, like so:
Line 27: Line 40:
 
  ./navit
 
  ./navit
  
= Prebuild binairies =
+
= Updating the GIT code =
  
The following prebuild (svn version) rpm packages exist:
+
You don't need to recompile everything to update navit to the latest code; with 'git pull' only the edited files will be downloaded. Just go to the navit directory (e.g. /home/CHANGEME/navit) and run:
  
[http://software.opensuse.org/ymp/Application:Geo/openSUSE_10.3/navit.ymp 1-Click Install for openSUSE 10.3]
+
git pull
  
[http://software.opensuse.org/ymp/Application:Geo/openSUSE_11.0/navit.ymp 1-Click Install for openSUSE 11.0]
+
You then only need to run "make" again from your binary folder ( navit-build in the cmake example, or the current folder when using autotools).
  
[http://software.opensuse.org/ymp/Application:Geo/openSUSE_11.1/navit.ymp 1-Click Install for openSUSE 11.1]
+
= Prebuild binairies =
  
[http://software.opensuse.org/ymp/Application:Geo/openSUSE_Factory/navit.ymp 1-Click Install for openSUSE Factory]
+
[[Download Navit|Prebuilt binaries]] exist for many distributions.
  
[http://download.opensuse.org/repositories/Application:/Geo/Fedora_10 The rpm package for Fedora 10]
+
= Configuring the beast =
 +
This is [[Configuration]], young padawan. Good luck :)
  
 +
You can also check a [http://www.len.ro/2009/07/navit-gps-on-a-acer-aspire-one/ post describing a Navit configuration on Ubuntu Jaunty].
  
= Configuring the beast =
+
[[Category:Ports]]
This is [[Configuring Navit|an entirely different matter]], young padawan. Good luck :)
+
[[Category:Linux]]

Latest revision as of 06:27, 23 January 2017

Taking care of dependencies[edit]

See the Dependencies page for a list of software packages required to build Navit. To build with CMake you will need CMake 2.6 or newer.

Getting Navit from the GIT repository[edit]

First, let's make sure we are in our home directory: this is only for the sake of making this tutorial simple to follow. You can save that directory anywhere you want, but you will have to adapt the rest of the instructions of this guide to your particular case.

cd ~ 

Now, let's grab the code from Git. This assumes that you have git binaries installed.

 git clone https://github.com/navit-gps/navit.git

Compiling[edit]

GNU autotools was the old method but is removed in favour of CMake.

CMake[edit]

CMake builds Navit in a separate directory of your choice - this means that the directory in which the Git source was checked out remains untouched. See also CMake.

mkdir navit-build
cd navit-build

Once inside the build directory just call the following commands:

cmake ~/navit
make

Note: CMake will autodetect your system configuration on the first run, and cache this information. Therefore installing or removing libraries after the first CMake run may confuse it and cause weird compilation errors (though installing new libraries should be ok). If you install or remove libraries/packages and subsequently run into errors, do a clean CMake run:

 rm -r ~/navit-build/*
 cmake ~/navit

Running the compiled binary[edit]

The binary is called navit and can be run without arguments:

cd ~/navit-build/navit/
./navit

It is advised to just run this binary locally at the moment (i.e. not to install system-wide). Note that for this to work, Navit must be run from the directory where it resides (that is, you must first change your working directory, as described above). If Navit is run from another directory, it will not find its plugins and image files, and will not start.

Running the compiled binary[edit]

Here, I am skipping the usual "make install" because we don't need to install navit systemwide for this example.

To execute navit, you can simply click on the binary file (if you are sure it is compiled properly) and it should launch. If you prefer to launch it from a terminal, you need to go into the directory containing the binary, first, like so:

cd ~/navit/navit/
./navit

Updating the GIT code[edit]

You don't need to recompile everything to update navit to the latest code; with 'git pull' only the edited files will be downloaded. Just go to the navit directory (e.g. /home/CHANGEME/navit) and run:

git pull

You then only need to run "make" again from your binary folder ( navit-build in the cmake example, or the current folder when using autotools).

Prebuild binairies[edit]

Prebuilt binaries exist for many distributions.

Configuring the beast[edit]

This is Configuration, young padawan. Good luck :)

You can also check a post describing a Navit configuration on Ubuntu Jaunty.