Status: An unexpected error occured in Gosmore: on YOURS installation

I try installed YOURS on my local computer.
I have followed instruction from

But when i access it via browser, i can’t found map on it ?

What’s wrong with my installation ?

What should i do to solve this issue ?


oh. actually i have wrong in source code.I should checkout from :slight_smile:

Ok, this is step by step which i did to install YOURS

  1. i following reference from and checkout from

  2. i checkout gosmore source from

  3. rebuild my file planet.osm.bz2 use gosmore with command : bzcat country.osm.bz2 | ./gosmore rebuild
    output is default.pak file

  4. i put YOURS/* to /var/www so i can acces it via browser with http://localhost
    now i can access map, but when i make a route from one location to another location and click find route, error message :Status: An unexpected error occured in Gosmore: appear

i check on /var/log/apache2/error.log and i get this error message :

[Thu Dec 22 13:18:01 2011] [error] [client] PHP Notice:  Undefined index: format in /home/maple/yours/api/1.0/gosmore.php on line 105, referer: http://localhost/

[Thu Dec 22 13:18:01 2011] [error] [client] PHP Warning:  fopen(/home/maple/yours/commands.log): failed to open stream: Permission denied in /home/maple/yours/api/1.0/gosmore.php on line 140, referer: http://localhost/

[Thu Dec 22 13:18:01 2011] [error] [client] PHP Warning:  chdir(): No such file or directory (errno 2) in /home/maple/yours/api/1.0/gosmore.php on line 146, referer: http://localhost/
nice: ./gosmore: No such file or directory

[Thu Dec 22 13:18:01 2011] [error] [client] PHP Warning:  fopen(/home/maple/yours/requests.csv): failed to open stream: Permission denied in /home/maple/yours/api/1.0/gosmore.php on line 235, referer: http://localhost/

[Thu Dec 22 13:18:01 2011] [error] [client] PHP Warning:  fopen(/home/maple/yours/requests.csv): failed to open stream: Permission denied in /home/maple/yours/api/1.0/gosmore.php on line 242, referer: http://localhost/

I have solve error about with created file and folder manually, but i still get error.Now error message like below

[Thu Dec 22 20:39:01 2011] [error] [client] PHP Notice:  Undefined index: format in /home/maple/yours/api/1.0/gosmore.php on line 105, referer: http://localhost/
nice: ./gosmore: No such file or directory

What should i do ?

Now i use German.pak which i downloaded from
Firstly when i try routing with accessing localhost on browser it doesn’t work, becuase of this code i think:

/*switch ($layer) { 
case 'cn': 
    $gosmore = '/normal'; 
    $style = 'cyclestyles.xml'; 
case 'test': 
    $gosmore = '/test'; 
    $style = 'elemstyles.xml'; 
    $gosmore = '/normal'; 
    $style = 'genericstyles.xml'; 
$dir = $yours_dir.$gosmore;

when i check on some folders, i can’t get some xml file include gosmore.i found elemstyles.xml only.
After i commented these line and change

$dir = $yours_dir.$gosmore; 


$dir = $yours_dir;

Now my routing works well.I can create route on Germany map. :slight_smile: .Its running on ubuntu 10.10

But now i try using it on Ubuntu 11.10 server.

After i checkout source then i got error when execute :

$ make
gcc -lm density.c -o density
/tmp/ccNQSatu.o: In function `main':
density.c:(.text+0x21f): undefined reference to `exp'
density.c:(.text+0x224): undefined reference to `atan'
density.c:(.text+0x2c3): undefined reference to `exp'
density.c:(.text+0x2c8): undefined reference to `atan'
density.c:(.text+0x5d3): undefined reference to `exp'
density.c:(.text+0x5d8): undefined reference to `atan'
density.c:(.text+0x67a): undefined reference to `exp'
density.c:(.text+0x67f): undefined reference to `atan'
density.c:(.text+0x723): undefined reference to `exp'
density.c:(.text+0x728): undefined reference to `atan'
density.c:(.text+0x793): undefined reference to `exp'
density.c:(.text+0x798): undefined reference to `atan'
collect2: ld returned 1 exit status
make: *** [jni/bboxes.c] Error 1

is it bug of gosmore on ubuntu 11.10 or what is this ?
How to solve this ?

The functions exp() and atan() (exponent and arctangens) are part of the standard math library.
The linker complains that it cannot find them.

There are several way to solve this problem. The quickest would be to use g++ instead of gcc:
g++ -lm density.c -o density

Please try this first.

How to get it ?

because it’s default execute

gcc -lm density.c -o density

when i use command :


I have try execute command below first:

g++ -lm density.c -o density 

but when i execute make, it still error

And … what did it?

if i execute command :


“Make” will execute “gcc -lm density.c -o density”.You give advice to me to use “g++ -lm density.c -o density” instead of “gcc -lm density.c -o density”

So i execute g++ -lm density.c -o density manually,

Or how should i do ?

Yes. That was what I asked you to do.

Please report what happened.

Nothing happen

after i execute that command and i exeucte “make”.Error still same

Do not execute make. Only do
g++ -lm density.c -o density

What do you see?

Ok… nothing happen. You don’t see anything. Ok.

If you execute make then the program make will look for a file makefile (under your hands) and execute the commands written in there. Please post the contents of makefile here.

Ok, this is content of MakeFile

# Written by Nic Roets with contributions by Petter Reinholdtsen
# Placed in the public domain

TODAY := `exec date +%Y%m%d`
VERSION = 0.0.0.$(TODAY)

prefix = /usr/local
bindir = $(prefix)/bin
datarootdir = $(prefix)/share

CFLAGS=-O2 -DRES_DIR=\"$(prefix)/share/gosmore/\"

#"------------------------ Compiling with cegcc : ---------------------------
# tar xzf -C / cygwin-cegcc-mingw32ce-0.51.0-1.tar.gz
# export PATH="$PATH":/opt/mingw32ce/bin/

WINDRES=    ${ARCH}windres

# enable this to test the experimental route support

# enable this to force gosmore into headless mode (gosmore will also
# be put in headless mode if gtk+-2.0 isn't available)

ifneq (${OS},Windows_NT)
EXTRA=`pkg-config --cflags --libs gtk+-2.0 || echo -D HEADLESS` \
  `pkg-config --libs libcurl` \
  `[ -e /usr/include/gps.h ] && echo -DUSE_GPSD -lgps `\
  `pkg-config --libs pkg-config --libs gthread-2.0`

# I found that it's more reliable and more portable to use aplay, but
# gnome sound can still be activated with this:
#  `pkg-config --cflags --libs libgnomeui-2.0 && echo -DUSE_GNOMESOUND`
XMLFLAGS=`pkg-config --cflags libxml-2.0 || echo -I /usr/include/libxml2` \
  `pkg-config --libs libxml-2.0 || echo -l xml2 -lm`

EXTRAC=-Ilibxml2-2.7.8/include \
  `pkg-config --cflags gtk+-2.0 || echo -D NOGTK`

EXTRAL=`pkg-config --libs gtk+-2.0` \

W32LIBS=-Llibxml2-2.7.8/.libs -lxml2 -lwsock32 -lwinmm  -lgdi32


all: gosmore$(EXE)

gosmore:    jni/gosmore.cpp jni/libgosm.cpp jni/libgosm.h jni/bboxes.c \
        jni/openglespolygon.h jni/openglespolygon.cpp
                  jni/gosmore.cpp jni/libgosm.cpp jni/openglespolygon.h \
                  jni/openglespolygon.cpp -o gosmore ${EXTRA}

gosmore16:    jni/gosmore.cpp jni/libgosm.cpp jni/libgosm.h
        g++ -DGOSMZ=16 ${CFLAGS} ${WARNFLAGS} ${XMLFLAGS} \
                  jni/gosmore.cpp jni/libgosm.cpp -o gosmore16 ${EXTRA}

$(ARCH)gosmore.exe:    jni/gosmore.cpp jni/libgosm.cpp gosmore.rsc resource.h \
                    jni/libgosm.h ceglue.h ceglue.c bboxes.c
        ${ARCH}g++ ${CFLAGS} ${EXTRAC} -c jni/gosmore.cpp
        ${ARCH}g++ ${CFLAGS} ${EXTRAC} -c jni/libgosm.cpp
        ${ARCH}gcc ${CFLAGS} ${EXTRAC} -c ConvertUTF.c
        ${ARCH}gcc ${CFLAGS} ${EXTRAC} -c ceglue.c
        ${ARCH}g++ -static ${EXTRAL} \
          gosmore.o libgosm.o ceglue.o ConvertUTF.o gosmore.rsc $(W32LIBS)  -o $@

tagcmp.o:    tagcmp.l

gosmore.rsc:    gosmore.rc icons.bmp icons-mask.bmp gosmore.ico
        $(WINDRES) $< $@

translations.c: extract
        wget -O - ${WIKIPAGE}/Translations |./extract >jni/translations.c

extract:    extract.c
        ${CC} ${CFLAGS} ${XMLFLAGS} extract.c -o extract

jni/bboxes.c:    density.c density.txt
        gcc -lm density.c -o density
        ./density <density.txt >
# wget -O \
#   countries.osm

osmunda:    osmunda.cpp jni/libgosm.cpp jni/libgosm.h
        g++ ${CFLAGS} ${WARNFLAGS} ${XMLFLAGS} \
          osmunda.cpp jni/libgosm.cpp -o osmunda
        echo '(voice_rab_diphone)' >/tmp/voice_rab_diphone
        echo 'At the junction, turn left.' | festival_client \
          --prolog /tmp/voice_rab_diphone --output turnleft.wav --ttw
        echo 'At the junction, turn right.' | festival_client \
          --prolog /tmp/voice_rab_diphone --output turnright.wav --ttw
        echo 'Keep left.' | festival_client \
          --prolog /tmp/voice_rab_diphone --output keepleft.wav --ttw
        echo 'Keep right.' | festival_client \
          --prolog /tmp/voice_rab_diphone --output keepright.wav --ttw
        echo 'If possible make a U turn.' | festival_client \
          --prolog /tmp/voice_rab_diphone --output uturn.wav --ttw
        echo 'You have reached your destination.' | festival_client \
          --prolog /tmp/voice_rab_diphone --output stop.wav --ttw
        echo 'At the roundabout take the first exit.' | \
  festival_client --prolog /tmp/voice_rab_diphone --output round1.wav --ttw
        echo 'At the roundabout take the second exit.' | \
  festival_client --prolog /tmp/voice_rab_diphone --output round2.wav --ttw
        echo 'At the roundabout take the third exit.' | \
  festival_client --prolog /tmp/voice_rab_diphone --output round3.wav --ttw
        echo 'At the roundabout take the fourth exit.' | \
  festival_client --prolog /tmp/voice_rab_diphone --output round4.wav --ttw
        echo 'At the roundabout take the fifth exit.' | \
  festival_client --prolog /tmp/voice_rab_diphone --output round5.wav --ttw
        echo 'At the roundabout take the sixth exit.' | \
  festival_client --prolog /tmp/voice_rab_diphone --output round6.wav --ttw
        echo 'At the roundabout take the seventh exit.' | \
  festival_client --prolog /tmp/voice_rab_diphone --output round7.wav --ttw
        echo 'At the roundabout take the eight exit.' | \
  festival_client --prolog /tmp/voice_rab_diphone --output round8.wav --ttw

#        wget

    (cd /msys; zip - etc/gtk-2.0/* lib/gtk-2.0/2.10.0/loaders/*) >
    zip -j gosmore.exe icons.xpm /msys/bin/libcairo-2.dll \
    /msys/bin/lib*.dll /msys/bin/intl*.dll /msys/bin/zlib*.dll
    zip -j ARMV4Rel/gosm_arm.exe *.wav
    # scp -P 100 \

install: gosmore default.pak
    mkdir -p $(DESTDIR)$(bindir)
    cp gosmore $(DESTDIR)$(bindir)/.
    mkdir -p $(DESTDIR)$(datarootdir)/gosmore
    cp -a *.wav default.pak elemstyles.xml icons.csv icons.xpm \
    mkdir -p $(DESTDIR)$(datarootdir)/man/man1
    gzip <gosmore.1 >$(DESTDIR)$(datarootdir)/man/man1/gosmore.1.gz
    mkdir -p $(DESTDIR)$(datarootdir)/pixmaps
    cp -a gosmore.xpm $(DESTDIR)$(datarootdir)/pixmaps
    mkdir -p $(DESTDIR)$(datarootdir)/applications
    cp -a gosmore.desktop $(DESTDIR)$(datarootdir)/applications

# The commands below will create a gpx file with a low res version of the national boundaries
# Then you must open tmp.gpx in JOSM and save it as bounds.osm. Then this makefile will
# use sed to reencode the ids to the 2 billion range and use grep to concatenate it with
# the geonames cities and the osm country names.
# sudo apt-get install libshp-dev
# wget
# gcc -lshp shp2text.c -o shp2text
# wget
# unzip
# ./shp2text --gpx 110m-admin-0-countries.shp 0 4 |
#   gpsbabel -r -i gpx -f - -x transform,trk=rte,del -o gpx -F tmp.gpx
default.pak: gosmore
    ! [ -e gosmore.pak ]
    (bzgrep -v '</osm>' bounds.osm.bz2 | sed -e 's/'\''-\([0-9]*'\''\)/'\''00000000\1/' |\
      sed -e 's/0*\([0-9]\{8\}'\''\)/21\1/'; \
     bzcat lowres.osm.bz2; \
     egrep -v '?xml|<osmCha' countries.osm | sed -e 's|/osmChange|/osm|') | \
         QUERY_STRING=suppressGTK ./gosmore rebuild
    mv gosmore.pak default.pak

routingTest: gosmore
    ! [ -e gosmore.pak ]
    sed -e 's/\(nd='\''\|ref='\''\|id='\''\)-\([0-9]*'\''\)/\121000\2/' routingTest.osm |\
      ./gosmore rebuild

    mkdir gosmore-$(VERSION)
    cp jni/gosmore.cpp Makefile elemstyles.xml icons.csv icons.xpm  README \
    tar zcf gosmore-$(VERSION).tar.gz gosmore-$(VERSION)
    rm -rf gosmore-$(VERSION)

    $(RM) gosmore *.tmp *~ $(ARCH)gosmore.exe gosmore.rsc \
      gosmore.aps gosmore.vcl gosmore.vcw extract *.o

You see that the line
gcc -lm density.c -o density
is in the makefile.

We know alreadyy that you see nothing if you execute on the commandline
g++ -lm density.c -o density

But what do you see if you execute
gcc -lm density.c -o density

Please report. Meanwile i will look at the makefile.

Thanks Greencaps,

A developer have fixed that issue yesterday.Actually, gosmore have bugs when running on ubuntu 11.10.But now it works well.
I have checkout new sources and gosmore and YOURS have run well. :slight_smile:

But namefinder on my routing is disable, how to enable it ?
When i enter location on both of “From” textboxt and “To” tetboxt there’is error message

“Status: Namefinder reports: This service is permanently disabled”

Please check it out on

Any advices?


Nice. Of course we are interested how he did that.

How about “Status: Namefinder reports: This service is permanently disabled” ??

I just answered your question on stackoverflow

HI there, the problem is the ordering of the arguments.
I am not happy with this makefile, here is a patch