[OSM-dev] Osm2pgsql build system changes and testing

Greg Troxel gdt at ir.bbn.com
Thu Oct 22 00:04:40 UTC 2015


Paul Norman <penorman at mac.com> writes:

> We are planning to switch the osm2pgsql build system from autotools to
> cmake and could use help testing on different distributions, operating
> systems, and other less common configurations.
>
> More info is at https://github.com/openstreetmap/osm2pgsql/pull/460
> and you will need to use the cmake branch at
> https://github.com/alex85k/osm2pgsql.git. Build instructions are at
> https://github.com/alex85k/osm2pgsql/blob/cmake/README.md#building
>
> Before reporting problems, try running git clean -xfd to remove any
> traces of Autotools build files. If there are problems, please report
> them at https://github.com/openstreetmap/osm2pgsql/pull/460 including
> OS, distribution, CMake and make command line, and where any files not
> found are installed.

(I look after the postgis, geos and viking packages in pkgsrc.)

On a NetBSD 6 i386 system, I did a fresh clone.  Then I built osm2pgsql
0.88.1 from pkgsrc, so I'd have the dependencies (all --prefix=/usr/pkg).

The README.md says it uses autotools.  But after reading on, I found the
cmake instructions.

I then got a failure about -std=c++11 (system compiler 4.5, my fault for
not reading) and added /usr/pkg/gcc48/bin to my PATH, reran cmake, and
reran make.  That still failed, which seems like a bug, but not that
important to fix and arguably a bug in cmake not osm2pgsql.

I have gcc48 and gcc48-libs (has libstdc++) installed.  I would expect
gcc48 to steer programs to the 4.8 include files, but I put the
directory in -I anyway.

I iterated with nuking/restarting and ended up with a script:

  rm -rf CMakeCache.txt CMakeFiles Makefile cmake_install.cmake config.h

  export CPPFLAGS="-I/usr/pkg/gcc48/include -I/usr/pkg/include"
  export LDFLAGS="-L/usr/pkg/lib -R/usr/pkg/lib"

  cmake ..

  make

which resulted in a lot of warnings about printf specifiers and a
std::to_string error that I don't understand.

The instructions did not say how to use clang; I have

  clang version 3.6.2 (tags/RELEASE_362/final)
  Target: i386--netbsdelf
  Thread model: posix

installed, but I don't have a faux-gcc dir for it to stick in PATH.

----------------------------------------
-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/pkg/gcc48/bin/cc
-- Check for working C compiler: /usr/pkg/gcc48/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/pkg/gcc48/bin/c++
-- Check for working CXX compiler: /usr/pkg/gcc48/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building osm2pgsql 0.89.0-dev
-- Looking for include file termios.h
-- Looking for include file termios.h - found
-- Looking for include file libgen.h
-- Looking for include file libgen.h - found
-- Looking for include file unistd.h
-- Looking for include file unistd.h - found
-- Looking for include file sys/wait.h
-- Looking for include file sys/wait.h - found
-- Looking for include file sys/time.h
-- Looking for include file sys/time.h - found
-- Looking for include file sys/mman.h
-- Looking for include file sys/mman.h - found
-- Looking for lseek64
-- Looking for lseek64 - not found
-- Looking for posix_fallocate
-- Looking for posix_fallocate - not found
-- Looking for posix_fadvise
-- Looking for posix_fadvise - found
-- Looking for sync_file_range
-- Looking for sync_file_range - not found
-- Looking for fork
-- Looking for fork - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of off_t
-- Check size of off_t - done
-- Found ZLIB: /lib/libz.so (found version "1.2.3") 
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found EXPAT: /usr/lib/libexpat.so (found version "2.0.1") 
-- Found BZip2: /usr/lib/libbz2.so (found version "1.0.5") 
-- Looking for BZ2_bzCompressInit in /usr/lib/libbz2.so
-- Looking for BZ2_bzCompressInit in /usr/lib/libbz2.so - found
-- Found Osmium: /home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium  
-- Found Lua: /usr/pkg/lib/liblua5.2.so;/lib/libm.so (found version "5.2.4") 
-- Boost version: 1.59.0
-- Found the following Boost libraries:
--   system
--   filesystem
--   thread
-- Found PostgreSQL: /usr/pkg/lib/libpq.so (found version "9.3.9") 
Libraries used to build: /usr/pkg/lib/libboost_system.so/usr/pkg/lib/libboost_filesystem.so/usr/pkg/lib/libboost_thread.so/usr/pkg/lib/libpq.so/lib/libz.so-lpthread/usr/lib/libexpat.so/usr/lib/libbz2.so/usr/pkg/lib/libgeos.so/usr/pkg/lib/libproj.so/usr/pkg/lib/liblua5.2.so/lib/libm.so
Active compiler flags:
-- Configuring done
-- Generating done
-- Build files have been written to: /home/gdt/SOFTWARE/GEO/osm2pgsql/build
Scanning dependencies of target osm2pgsql_lib
[  2%] Building CXX object CMakeFiles/osm2pgsql_lib.dir/expire-tiles.cpp.o
[  5%] Building CXX object CMakeFiles/osm2pgsql_lib.dir/geometry-builder.cpp.o
[  8%] Building CXX object CMakeFiles/osm2pgsql_lib.dir/geometry-processor.cpp.o
[ 11%] Building CXX object CMakeFiles/osm2pgsql_lib.dir/id-tracker.cpp.o
[ 14%] Building CXX object CMakeFiles/osm2pgsql_lib.dir/middle-pgsql.cpp.o
[ 17%] Building CXX object CMakeFiles/osm2pgsql_lib.dir/middle-ram.cpp.o
[ 20%] Building CXX object CMakeFiles/osm2pgsql_lib.dir/middle.cpp.o
[ 22%] Building CXX object CMakeFiles/osm2pgsql_lib.dir/node-persistent-cache.cpp.o
/home/gdt/SOFTWARE/GEO/osm2pgsql/node-persistent-cache.cpp: In member function ‘void node_persistent_cache::nodes_prefetch_async(osmid_t)’:
/home/gdt/SOFTWARE/GEO/osm2pgsql/node-persistent-cache.cpp:196:55: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘osmid_t {aka long long int}’ [-Wformat=]
                     cacheHeader.max_initialised_id, id);
                                                       ^
/home/gdt/SOFTWARE/GEO/osm2pgsql/node-persistent-cache.cpp:196:55: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘osmid_t {aka long long int}’ [-Wformat=]
/home/gdt/SOFTWARE/GEO/osm2pgsql/node-persistent-cache.cpp:196:55: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘osmid_t {aka long long int}’ [-Wformat=]
/home/gdt/SOFTWARE/GEO/osm2pgsql/node-persistent-cache.cpp:196:55: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘osmid_t {aka long long int}’ [-Wformat=]
[ 25%] Building CXX object CMakeFiles/osm2pgsql_lib.dir/node-ram-cache.cpp.o
/home/gdt/SOFTWARE/GEO/osm2pgsql/node-ram-cache.cpp: In constructor ‘node_ram_cache::node_ram_cache(int, int, int)’:
/home/gdt/SOFTWARE/GEO/osm2pgsql/node-ram-cache.cpp:370:162: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘__int64_t {aka long long int}’ [-Wformat=]
     fprintf( stderr, "Node-cache: cache=%ldMB, maxblocks=%d*%zd, allocation method=%i\n", (cacheSize >> 20), maxBlocks, PER_BLOCK*sizeof(ramNode), allocStrategy );
                                                                                                                                                                  ^
/home/gdt/SOFTWARE/GEO/osm2pgsql/node-ram-cache.cpp:370:162: warning: format ‘%zd’ expects argument of type ‘signed size_t’, but argument 5 has type ‘osmid_t {aka long long int}’ [-Wformat=]
/home/gdt/SOFTWARE/GEO/osm2pgsql/node-ram-cache.cpp:370:162: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘__int64_t {aka long long int}’ [-Wformat=]
/home/gdt/SOFTWARE/GEO/osm2pgsql/node-ram-cache.cpp:370:162: warning: format ‘%zd’ expects argument of type ‘signed size_t’, but argument 5 has type ‘osmid_t {aka long long int}’ [-Wformat=]
/home/gdt/SOFTWARE/GEO/osm2pgsql/node-ram-cache.cpp: In destructor ‘node_ram_cache::~node_ram_cache()’:
/home/gdt/SOFTWARE/GEO/osm2pgsql/node-ram-cache.cpp:378:52: warning: format ‘%li’ expects argument of type ‘long int’, but argument 7 has type ‘__int64_t {aka long long int}’ [-Wformat=]
            100.0f*nodesCacheHits/nodesCacheLookups );
                                                    ^
/home/gdt/SOFTWARE/GEO/osm2pgsql/node-ram-cache.cpp:378:52: warning: format ‘%li’ expects argument of type ‘long int’, but argument 7 has type ‘__int64_t {aka long long int}’ [-Wformat=]
[ 28%] Building CXX object CMakeFiles/osm2pgsql_lib.dir/options.cpp.o
[ 31%] Building CXX object CMakeFiles/osm2pgsql_lib.dir/osmdata.cpp.o
[ 34%] Building CXX object CMakeFiles/osm2pgsql_lib.dir/output-gazetteer.cpp.o
[ 37%] Building CXX object CMakeFiles/osm2pgsql_lib.dir/output-multi.cpp.o
[ 40%] Building CXX object CMakeFiles/osm2pgsql_lib.dir/output-null.cpp.o
[ 42%] Building CXX object CMakeFiles/osm2pgsql_lib.dir/output-pgsql.cpp.o
[ 45%] Building CXX object CMakeFiles/osm2pgsql_lib.dir/output.cpp.o
[ 48%] Building CXX object CMakeFiles/osm2pgsql_lib.dir/parse-o5m.cpp.o
[ 51%] Building CXX object CMakeFiles/osm2pgsql_lib.dir/parse-osmium.cpp.o
In file included from /home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/io/any_compression.hpp:45:0,
                 from /home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/io/any_input.hpp:46,
                 from /home/gdt/SOFTWARE/GEO/osm2pgsql/parse-osmium.cpp:29:
/home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/io/bzip2_compression.hpp: In function ‘void osmium::io::detail::throw_bzip2_error(BZFILE*, const char*, int)’:
/home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/io/bzip2_compression.hpp:91:30: error: ‘to_string’ is not a member of ‘std’
                     error += std::to_string(bzlib_error);
                              ^
In file included from /home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/io/any_compression.hpp:46:0,
                 from /home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/io/any_input.hpp:46,
                 from /home/gdt/SOFTWARE/GEO/osm2pgsql/parse-osmium.cpp:29:
/home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/io/gzip_compression.hpp: In function ‘void osmium::io::detail::throw_gzip_error(gzFile, const char*, int)’:
/home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/io/gzip_compression.hpp:85:30: error: ‘to_string’ is not a member of ‘std’
                     error += std::to_string(zlib_error);
                              ^
In file included from /home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/osm/box.hpp:40:0,
                 from /home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/io/header.hpp:39,
                 from /home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/io/detail/input_format.hpp:45,
                 from /home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/io/reader.hpp:55,
                 from /home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/io/pbf_input.hpp:45,
                 from /home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/io/any_input.hpp:48,
                 from /home/gdt/SOFTWARE/GEO/osm2pgsql/parse-osmium.cpp:29:
/home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/osm/location.hpp: In static member function ‘static __int32_t osmium::Location::double_to_fix(double)’:
/home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/osm/location.hpp:95:41: error: ‘round’ is not a member of ‘std’
             return static_cast<int32_t>(std::round(c * coordinate_precision));
                                         ^
/home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/osm/location.hpp:95:41: note: suggested alternative:
In file included from /usr/pkg/gcc48/include/c++/cmath:44:0,
                 from /usr/pkg/gcc48/include/c++/random:38,
                 from /usr/pkg/gcc48/include/c++/bits/stl_algo.h:65,
                 from /usr/pkg/gcc48/include/c++/algorithm:62,
                 from /usr/pkg/include/boost/core/swap.hpp:25,
                 from /usr/pkg/include/boost/optional/optional.hpp:28,
                 from /usr/pkg/include/boost/optional.hpp:15,
                 from /usr/pkg/include/boost/format/internals.hpp:20,
                 from /usr/pkg/include/boost/format.hpp:38,
                 from /home/gdt/SOFTWARE/GEO/osm2pgsql/parse-osmium.cpp:23:
/usr/pkg/gcc48/lib/gcc/i486--netbsdelf/4.8.4/include-fixed/math.h:347:8: note:   ‘round’
 double round(double);
        ^
In file included from /home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/osm/object.hpp:51:0,
                 from /home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/osm/node.hpp:39,
                 from /home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/osm.hpp:36,
                 from /home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/builder/osm_object_builder.hpp:43,
                 from /home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/io/detail/pbf_decoder.hpp:45,
                 from /home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/io/detail/pbf_input_format.hpp:56,
                 from /home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/io/pbf_input.hpp:46,
                 from /home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/io/any_input.hpp:48,
                 from /home/gdt/SOFTWARE/GEO/osm2pgsql/parse-osmium.cpp:29:
/home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/osm/types_from_string.hpp: In function ‘osmium::object_id_type osmium::string_to_object_id(const char*)’:
/home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/osm/types_from_string.hpp:53:23: error: ‘strtoll’ is not a member of ‘std’
             auto id = std::strtoll(input, &end, 10);
                       ^
/home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/osm/types_from_string.hpp:53:23: note: suggested alternative:
In file included from /usr/pkg/gcc48/include/c++/cstdlib:72:0,
                 from /usr/pkg/gcc48/include/c++/bits/stl_algo.h:59,
                 from /usr/pkg/gcc48/include/c++/algorithm:62,
                 from /usr/pkg/include/boost/core/swap.hpp:25,
                 from /usr/pkg/include/boost/optional/optional.hpp:28,
                 from /usr/pkg/include/boost/optional.hpp:15,
                 from /usr/pkg/include/boost/format/internals.hpp:20,
                 from /usr/pkg/include/boost/format.hpp:38,
                 from /home/gdt/SOFTWARE/GEO/osm2pgsql/parse-osmium.cpp:23:
/usr/pkg/gcc48/lib/gcc/i486--netbsdelf/4.8.4/include-fixed/stdlib.h:235:15: note:   ‘strtoll’
 long long int strtoll(const char * __restrict, char ** __restrict, int);
               ^
In file included from /home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/io/detail/pbf_input_format.hpp:56:0,
                 from /home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/io/pbf_input.hpp:46,
                 from /home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/io/any_input.hpp:48,
                 from /home/gdt/SOFTWARE/GEO/osm2pgsql/parse-osmium.cpp:29:
/home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/io/detail/pbf_decoder.hpp: In function ‘osmium::io::Header osmium::io::detail::decode_header_block(const ptr_len_type&)’:
/home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/io/detail/pbf_decoder.hpp:691:66: error: ‘to_string’ is not a member of ‘std’
                             header.set("pbf_optional_feature_" + std::to_string(i++), pbf_header_block.get_string());
                                                                  ^
/home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/io/detail/pbf_decoder.hpp:700:79: error: ‘to_string’ is not a member of ‘std’
                             header.set("osmosis_replication_sequence_number", std::to_string(pbf_header_block.get_int64()));
                                                                               ^
In file included from /home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/io/pbf_input.hpp:46:0,
                 from /home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/io/any_input.hpp:48,
                 from /home/gdt/SOFTWARE/GEO/osm2pgsql/parse-osmium.cpp:29:
/home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/io/detail/pbf_input_format.hpp: In member function ‘void osmium::io::detail::PBFInputFormat::parse_osm_data(osmium::osm_entity_bits::type)’:
/home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/io/detail/pbf_input_format.hpp:193:89: error: ‘to_string’ is not a member of ‘std’
                             throw osmium::pbf_error(std::string("invalid blob size: " + std::to_string(input_buffer.size())));
                                                                                         ^
In file included from /home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/io/xml_input.hpp:46:0,
                 from /home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/io/any_input.hpp:49,
                 from /home/gdt/SOFTWARE/GEO/osm2pgsql/parse-osmium.cpp:29:
/home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/io/detail/xml_input_format.hpp: In constructor ‘osmium::xml_error::xml_error(XML_Parser)’:
/home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/io/detail/xml_input_format.hpp:90:23: error: ‘to_string’ is not a member of ‘std’
                     + std::to_string(XML_GetCurrentLineNumber(parser))
                       ^
/home/gdt/SOFTWARE/GEO/osm2pgsql/contrib/libosmium/osmium/io/detail/xml_input_format.hpp:92:23: error: ‘to_string’ is not a member of ‘std’
                     + std::to_string(XML_GetCurrentColumnNumber(parser))
                       ^
/home/gdt/SOFTWARE/GEO/osm2pgsql/parse-osmium.cpp: In member function ‘void parse_osmium_t::convert_tags(const osmium::OSMObject&)’:
/home/gdt/SOFTWARE/GEO/osm2pgsql/parse-osmium.cpp:136:38: error: ‘to_string’ is not a member of ‘std’
         tags.emplace_back("osm_uid", std::to_string(obj.uid()));
                                      ^
/home/gdt/SOFTWARE/GEO/osm2pgsql/parse-osmium.cpp:137:42: error: ‘to_string’ is not a member of ‘std’
         tags.emplace_back("osm_version", std::to_string(obj.version()));
                                          ^
/home/gdt/SOFTWARE/GEO/osm2pgsql/parse-osmium.cpp:139:44: error: ‘to_string’ is not a member of ‘std’
         tags.emplace_back("osm_changeset", std::to_string(obj.changeset()));
                                            ^
*** Error code 1

Stop.
make: stopped in /home/gdt/SOFTWARE/GEO/osm2pgsql/build
*** Error code 1

Stop.
make: stopped in /home/gdt/SOFTWARE/GEO/osm2pgsql/build
*** Error code 1

Stop.
make: stopped in /home/gdt/SOFTWARE/GEO/osm2pgsql/build
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 180 bytes
Desc: not available
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20151021/0e7c3ba4/attachment-0001.sig>


More information about the dev mailing list