Opened 11 years ago

Closed 10 years ago

#2576 closed defect (fixed)

fails to display OSM data

Reported by: landry@… Owned by: Chris Browet
Priority: major Milestone:
Component: merkaartor Version:
Keywords: Cc:


I've ported merkaartor to OpenBSD, it compiles fine with a bunch of patches (attached) to appease G++3, (i use NOUSEWEBKIT=1 as our Qt4.5.3 isn't compiled with Webkit), but it fails to display/render any OSM data. I can view gpx tracks, create roads/nodes, but when i download data from osm i only get a zero-feature layer. The data seems correctly downloaded, i get this on the output :

Downloader::go:  "/api/0.6/map?bbox=3.173418,45.710854,3.250837,45.741532" 
Downloader::on_responseHeaderReceived:  200 "OK"

then a short 'Parsing XML' window.. but then, the download layer is empty :

2009-12-24T18:13:20 download
Size: 0 features

How can i help debug that ? Building a DEBUG version, and ??

Attachments (1)

merkaator-all-patches.diff (4.6 KB) - added by landry@… 11 years ago.
patches to make merkaartor compile with g++3

Download all attachments as: .zip

Change History (6)

Changed 11 years ago by landry@…

Attachment: merkaator-all-patches.diff added

patches to make merkaartor compile with g++3

comment:1 Changed 11 years ago by Chris Browet

Owner: changed from cbro@… to Chris Browet
Status: newassigned

1) What version are you using: svn, 0.14 from tarball, or...

2) Attach the "/tmp/merkaartor.log" file (if using 0.14; if using svn, generate one using "merkaartor --log /tmp/merkaartor.log")

3) Try the following url in a browser to see if you succeed in downloading the data, network-wise: ",45.710854,3.250837,45.741532"

comment:2 Changed 11 years ago by landry@…

It's with 0.14 from tarball. output log :

****  "2009-12-24T21:42:01"  -- Starting  "Merkaartor 0.14" 
------- "using QT version 4.5.3 (built with 4.5.3)" 
------- on X11 
MerkaartorPreferences::fromOsmPref : "GET /api/0.6/user/preferences/" 
Downloader::go:  "/api/0.6/map?bbox=3.173418,45.710854,3.250837,45.741532" 
Downloader::on_responseHeaderReceived:  200 "OK" 
****  "2009-12-24T21:42:37"  -- Ending  "Merkaartor 0.14" 

of course, the url in a browser works and gets the XML, heck i'm using JOSM without problems since ages.. so far what i've tried :

  • uncomment the #define DEBUG_* at the beginning of src/Maps/DownloadOSM.cpp : this calls showDebug, but there is _no_ content to show. window is empty.
  • played with gdb, which is a pain when dealing with c++ : to my understanding, in Downloader::go() Content ends up being empty after theRequest.request() call.
(gdb) p Content
$5 = {static shared_null = {ref = {_q_value = 1225}, alloc = 0, size = 0, data = 0x3c15e3e8 "", array = ""}, static shared_empty = {
    ref = {_q_value = 4}, alloc = 0, size = 0, data = 0x283223ac "", array = ""}, d = 0x7c372000}

This doesn't make sense as the download window says that it correctly downloaded 177kb of data.

I'll try do add some debug printfs to see what happens..

comment:3 Changed 11 years ago by landry@…

Okay, think i narrowed it down to gzipDecode :

if i add

printf("gzipDecoding Content.size:%d, Content:'%s', Uncompressed.size:%d, Uncompressed:'%s'\n", Content.size(),, Uncompressed.size(),;

after QByteArray Uncompressed(gzipDecode(Content)); in Downloader::go(), here's what i get on the stdout :

gzipDecoding Content.size:116227, Content:'', Uncompressed.size:0, Uncompressed:''

Seeing that, can't qUncompress() be used here ?

If i trace gzipDecode, it fails at ret = inflateInit2(&strm,15+32); ret is -6, which corresponds to Z_VERSION_ERROR. zlib is 1.2.3 here. Can't do much more with that now....

comment:4 Changed 11 years ago by landry@…

Ok, good news, got it, and it was nasty : so Z_VERSION_ERROR is returned because in the call to inflateInit2, which is a macro expanded to

#define inflateInit2(strm, windowBits) \
        inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))

this check is done :

    if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
        stream_size != (int)(sizeof(z_stream)))
        return Z_VERSION_ERROR;

sizeofs differs... as merkaartor links with our libz, which has a different sizeof for the struct from the one DownloadOSM.cpp includes :

--- /usr/include/zlib.h	Thu Dec  3 09:15:48 2009
+++ src/zlib/zlib.h	Wed Apr 22 13:57:40 2009
@@ -1,4 +1,3 @@
-/*	$OpenBSD: zlib.h,v 1.9 2005/07/20 15:56:41 millert Exp $	*/
 /* zlib.h -- interface of the 'zlib' general purpose compression library
   version 1.2.3, July 18th, 2005
@@ -83,11 +82,11 @@
 typedef struct z_stream_s {
     Bytef    *next_in;  /* next input byte */
     uInt     avail_in;  /* number of bytes available at next_in */
-    z_off_t  total_in;  /* total nb of input bytes read so far */
+    uLong    total_in;  /* total nb of input bytes read so far */
     Bytef    *next_out; /* next output byte should be put there */
     uInt     avail_out; /* remaining free space at next_out */
-    z_off_t  total_out; /* total nb of bytes output so far */
+    uLong    total_out; /* total nb of bytes output so far */

Easy fix :

--- src/Maps/DownloadOSM.cpp.orig	Mon Jul 20 13:12:39 2009
+++ src/Maps/DownloadOSM.cpp	Thu Dec 24 22:38:20 2009
@@ -28,11 +28,11 @@
 #include <QStatusBar>
 #include <QInputDialog>
-#include "zlib/zlib.h"
+#include <zlib.h>

With that, merkaartor succesfully displays OSM data.

comment:5 Changed 10 years ago by Chris Browet

Resolution: fixed
Status: assignedclosed

Applied to SVN and removed embedded zlib

Note: See TracTickets for help on using tickets.