gosmore rebuild segmentation fault

Rebuilding without bounding box works well, but after that when I’m trying to create a smaller .pak file by specifying a cropping bounding box :
mv gosmore.pak master.pak
bzcat …osm.bz2 | ./gosmore rebuild l1 l2 l3 l4
it gives “Segmentation fault (core dumped)”.

I have enough virtual memory and cannot figure out what’s wrong…

Anyone knows how to solve this?

Maybe some hints can be found on http://help.openstreetmap.org when you do a search there for “gosmore” … there are already some topics about rebuilding.

Or any hints at the OSM wiki about gosmore.

This was caused by a bug in gosmore code. After successfully doing rebuild, the program falls through to presenting the Gui.
It was then it crashed to an error in the code.
I was only noting this as I hit the same snag recently and it irked me.

#ifdef USE_GPSD
gps_data_t *gpsData;
gps_open (“127.0.0.1”, “2947”, gpsData);
if (gpsData) {

Compile warning

jni/gosmore.cpp: In function ‘int UserInterface(int, char**, const char*, const char*)’:
jni/gosmore.cpp:3488:12: warning: ‘gpsData’ may be used uninitialized in this function [-Wmaybe-uninitialized]
gps_open (“127.0.0.1”, “2947”, gpsData);

(e.g. should be gps_data_t *gpsData = NULL;)

Segmentation fault 
Program received signal SIGSEGV, Segmentation fault.
0x0000155553df3a2e in gps_sock_open () from /usr/lib/x86_64-linux-gnu/libgps.so.23
(gdb) where
#0  0x0000155553df3a2e in gps_sock_open () at /usr/lib/x86_64-linux-gnu/libgps.so.23
#1  0x0000155553df0afe in gps_open () at /usr/lib/x86_64-linux-gnu/libgps.so.23
#2  0x00005555555751e4 in UserInterface(int, char**, char const*, char const*) (argc=3, argv=0x7fffffffe958, pakfile=0x7fffffffec1c "../../map.osm", stylefile=0x55555596eb20 "elemstyles.xml")
 at jni/gosmore.cpp:3488
#3  0x00005555555757f8 in main(int, char**) (argc=3, argv=0x7fffffffe958) at jni/gosmore.cpp:3643
up
up
p gpsData
$4 = (gps_data_t *) 0x3062670000706d74

---
If you use the repository 
[https://svn.openstreetmap.org/applications/rendering/gosmore/jni/](https://svn.openstreetmap.org/applications/rendering/gosmore/jni/) it tells you to use [https://github.com/OpenStreetMap/](https://github.com/OpenStreetMap/)

The git repository has a code error in jni/gosmore.cpp where the gps_open signature may not match the one defined in gps.h.
/usr/include/gps.h
...
* 6.1 - Add navdata_t for more (nmea2000) info.
*/
...
extern int gps_open(const char *, const char *,
 	      struct gps_data_t *);

-----------------------
git repository jnl/gosmore.cpp

#ifdef USE_GPSD
gps_data_t *gpsData = gps_open ("127.0.0.1", "2947");
if (gpsData) {
 gps_set_raw_hook (gpsData, GpsMove);
 #if GPSD_API_MAJOR_VERSION <= 3