Difference between revisions of "MacOS development"

From Navit's Wiki
Jump to: navigation, search
m (Removed deprecated 0.0.1 tips)
m (Installation instruction)
Line 33: Line 33:
  
 
Download navit or checkout it from CVS
 
Download navit or checkout it from CVS
 +
  cvs -d:pserver:anonymous@navit.cvs.sourceforge.net:/cvsroot/navit login
 +
At the password prompt, just press enter. Then
 +
  cvs -z3 -d:pserver:anonymous@navit.cvs.sourceforge.net:/cvsroot/navit co -P navit
  
 
Edit configure.in and add
 
Edit configure.in and add
 
   -l/opt/local/include
 
   -l/opt/local/include
to the CFLAGS variable (note that the variables occurs 2 times in the file)
+
to the CFLAGS variable (note that the variables occurs 2 times in the file) and change
 +
  LIBS="$LIBS -lm -rdynamic"
 +
by
 +
  LIBS="$LIBS -lm"
 +
(on some systems, the "-rdynamic" option ensures that the executable has it's global symbols put into the symbol table. This is already the default
 +
behavior on darwin.)
  
 
If you want to install navit along the MacPorts packages, you need to use the /opt/local directory as prefix:
 
If you want to install navit along the MacPorts packages, you need to use the /opt/local directory as prefix:
 
   ./autogen.sh && ./configure --prefix=/opt/local
 
   ./autogen.sh && ./configure --prefix=/opt/local
  
change
+
You may replace the <plugins> section of your navit.xml file by
   $NAVIT_LIBDIR...
+
   <plugins>
path in navit.xml with
+
  <plugin path="/opt/local/lib/navit/gui/libgui_gtk.dylib" />
  /opt/local/lib/navit/gui/libgui_gtk.dylib
+
  <plugin path="/opt/local/lib/navit/graphics/libgraphics_gtk_drawing_area.dylib" />
 +
  <plugin path="/opt/local/lib/navit/graphics/libgraphics_null.dylib" active="no"/>
 +
  </plugins>
  
Create the pidof program:
+
type
   nano pidof
+
  make
type this script:
+
to build NavIt, and
  #!/bin/sh
+
   sudo make install
  ps axc|awk "{if (\$5==\"$1\") print \$1}";
+
to install it.
save and exit
+
 
  chmod 755 pidof
+
=Something went wrong?=
   sudo mv pidof /bin
+
==Libtool error :==
 +
If you try to compile navit-0.0.1, you might get the following bug (which is fixed in cvs).
 +
 
 +
/usr/bin/libtool: internal link edit command failed
 +
make[4]: *** [libdata_mg.la] Error 1
 +
make[3]: *** [all-recursive] Error 1
 +
make[2]: *** [all-recursive] Error 1
 +
make[1]: *** [all-recursive] Error 1
 +
 
 +
The fix is in debug.h to replace
 +
 
 +
int debug_level;
 +
 
 +
with
 +
 
 +
extern int debug_level;
 +
 
 +
This should be fixed now in CVS.
 +
 
 +
 
 +
==Malloc error :==
 +
 
 +
param.c:3:20: error: malloc.h: No such file or directory
 +
param.c: In function 'param_add_string':
 +
param.c:10: warning: implicit declaration of function 'malloc'
 +
param.c:10: warning: incompatible implicit declaration of built-in function 'malloc'
 +
 
 +
There is no malloc.h in OS X. All the defs are in stdlib.h. If you want
 +
you could make a softlink /opt/local/inlcude/malloc.h to
 +
/usr/include/stdlib.h, or just comment the relevants include <malloc.h>
 +
 
 +
Both will work. The symlink is maybe easier for now.
 +
 
 +
   ln -s /usr/include/stdlib.h /opt/local/include/malloc.h
 +
 
 +
 
 +
We'll add a platform-test soon to fix it.

Revision as of 09:01, 16 January 2008

Here are some notes about running navit under MacOS. This is a draft, feel free to improve it.


What you will need

You need Xcode Tools and MacPorts in order to install navit.

MacPorts developers suggest to install Xcode Tools from http://developer.apple.com/tools/xcode/ and not from the Mac OSX install disk.

Make sure you don't have fink installed on your system, it can confuse MacPorts package building and installation.

GTK Gui

You should only need gtk2 and glib2 via macPorts

SDL Gui

Untested yet.

Installation instruction

Download Xcode Tools from http://developer.apple.com/tools/xcode/ and install it with X11 SDK

Download and Install MacPorts from http://www.macports.org/, or update your version

 sudo port -d selfupdate

Open up a terminal

make sure your PATH variables has /opt/local/bin and /opt/local/sbin in it:

 echo $PATH 


Install automake, wget, gpsd (if you want gps support), gtk2 and glib2 (for gkt GUI) with

 sudo port install automake wget gpsd gtk2 glib2

Download navit or checkout it from CVS

 cvs -d:pserver:anonymous@navit.cvs.sourceforge.net:/cvsroot/navit login

At the password prompt, just press enter. Then

 cvs -z3 -d:pserver:anonymous@navit.cvs.sourceforge.net:/cvsroot/navit co -P navit

Edit configure.in and add

 -l/opt/local/include

to the CFLAGS variable (note that the variables occurs 2 times in the file) and change

 LIBS="$LIBS -lm -rdynamic"

by

 LIBS="$LIBS -lm"

(on some systems, the "-rdynamic" option ensures that the executable has it's global symbols put into the symbol table. This is already the default behavior on darwin.)

If you want to install navit along the MacPorts packages, you need to use the /opt/local directory as prefix:

 ./autogen.sh && ./configure --prefix=/opt/local

You may replace the <plugins> section of your navit.xml file by

 <plugins>
 	<plugin path="/opt/local/lib/navit/gui/libgui_gtk.dylib" />
 	<plugin path="/opt/local/lib/navit/graphics/libgraphics_gtk_drawing_area.dylib" />	
 	<plugin path="/opt/local/lib/navit/graphics/libgraphics_null.dylib" active="no"/>
 </plugins>

type

 make

to build NavIt, and

 sudo make install

to install it.

Something went wrong?

Libtool error :

If you try to compile navit-0.0.1, you might get the following bug (which is fixed in cvs).

/usr/bin/libtool: internal link edit command failed
make[4]: *** [libdata_mg.la] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1

The fix is in debug.h to replace

int debug_level;

with

extern int debug_level;

This should be fixed now in CVS.


Malloc error :

param.c:3:20: error: malloc.h: No such file or directory
param.c: In function 'param_add_string':
param.c:10: warning: implicit declaration of function 'malloc'
param.c:10: warning: incompatible implicit declaration of built-in function 'malloc'

There is no malloc.h in OS X. All the defs are in stdlib.h. If you want you could make a softlink /opt/local/inlcude/malloc.h to /usr/include/stdlib.h, or just comment the relevants include <malloc.h>

Both will work. The symlink is maybe easier for now.

 ln -s /usr/include/stdlib.h /opt/local/include/malloc.h


We'll add a platform-test soon to fix it.