mapbox / mapnik-vector-tile

Mapnik implemention of Mapbox Vector Tile specification
BSD 3-Clause "New" or "Revised" License
553 stars 117 forks source link

Tests fail to build #58

Closed tomhughes closed 10 years ago

tomhughes commented 10 years ago

The tests are failing to build in the 0.5.5 code:

In file included from ./src/vector_tile.pb.h:25:0,
                 from ./src/vector_tile_backend_pbf.hpp:12,
                 from test/vector_tile.cpp:21:
/usr/include/google/protobuf/extension_set.h:183:21: error: reference to 'vector' is ambiguous
                     vector<const FieldDescriptor*>* output) const;
                     ^
In file included from /usr/include/c++/4.8.3/vector:64:0,
                 from test/catch.hpp:355,
                 from test/vector_tile.cpp:3:
/usr/include/c++/4.8.3/bits/stl_vector.h:210:11: note: candidates are: template<class _Tp, class _Alloc> class std::vector
     class vector : protected _Vector_base<_Tp, _Alloc>
           ^
In file included from test/vector_tile.cpp:13:0:
./src/vector_tile_projection.hpp:12:37: note:                 namespace mapnik::vector { }
 namespace mapnik { namespace vector {
                                     ^
In file included from ./src/vector_tile.pb.h:25:0,
                 from ./src/vector_tile_backend_pbf.hpp:12,
                 from test/vector_tile.cpp:21:
/usr/include/google/protobuf/extension_set.h:183:21: error: 'vector' has not been declared
                     vector<const FieldDescriptor*>* output) const;
                     ^
/usr/include/google/protobuf/extension_set.h:183:27: error: expected ',' or '...' before '<' token
                     vector<const FieldDescriptor*>* output) const;
                           ^
In file included from ./src/vector_tile.pb.h:25:0,
                 from ./src/vector_tile_backend_pbf.hpp:12,
                 from test/raster_tile.cpp:12:
/usr/include/google/protobuf/extension_set.h:183:21: error: reference to 'vector' is ambiguous
                     vector<const FieldDescriptor*>* output) const;
                     ^
In file included from /usr/include/c++/4.8.3/vector:64:0,
                 from test/catch.hpp:355,
                 from test/raster_tile.cpp:3:
/usr/include/c++/4.8.3/bits/stl_vector.h:210:11: note: candidates are: template<class _Tp, class _Alloc> class std::vector
     class vector : protected _Vector_base<_Tp, _Alloc>
           ^
In file included from test/raster_tile.cpp:8:0:
./src/vector_tile_projection.hpp:12:37: note:                 namespace mapnik::vector { }
 namespace mapnik { namespace vector {
                                     ^
In file included from ./src/vector_tile.pb.h:25:0,
                 from ./src/vector_tile_backend_pbf.hpp:12,
                 from test/raster_tile.cpp:12:
/usr/include/google/protobuf/extension_set.h:183:21: error: 'vector' has not been declared
                     vector<const FieldDescriptor*>* output) const;
                     ^
/usr/include/google/protobuf/extension_set.h:183:27: error: expected ',' or '...' before '<' token
                     vector<const FieldDescriptor*>* output) const;
                           ^

Compiler is gcc 4.8.3 and mapnik is 2.2.

StevenLooman commented 10 years ago

From #63, try using clang++. On Ubuntu you can install clang by running:

sudo apt-get install clang

Then run:

make clean
CXX=clang++ make test

Works for me, using de1d54230233ae332f2dee0fe3aa5958abfadf5f, running Ubuntu 14.04.

Another fix might (untested!) be editing file /usr/include/google/protobuf/extension_set.h. At line 183, change this:

  void AppendToList(const Descriptor* containing_type,
                    const DescriptorPool* pool,
                    vector<const FieldDescriptor*>* output) const;

to this:

  void AppendToList(const Descriptor* containing_type,
                    const DescriptorPool* pool,
                    std::vector<const FieldDescriptor*>* output) const;

(note the std:: before vector)

Then run the tests as you normally would:

make test
springmeyer commented 10 years ago

planning on working around this by updating to the latest vector tile spec protobuf which includes

Started here: https://github.com/mapbox/mapnik-vector-tile/commit/1532ccce20df6b8ec031873ea59b6bd364689818

springmeyer commented 10 years ago

fixed by #66

tomhughes commented 10 years ago

I can confirm that the 0.6.0 release appears to fix this.

springmeyer commented 10 years ago

noting that the cause of the clashing vector namespace may eventually get fixed upstream: https://github.com/google/protobuf/pull/72