ltog / osmi-addresses

Calculates the Address view of the OSM Inspector
Boost Software License 1.0
11 stars 4 forks source link

using google::protobuf::ShutdownProtobufLibrary() without including Stub #105

Closed flohoff closed 8 years ago

flohoff commented 8 years ago

Hi, in main.cpp you use some google::protobuf methods without including stubs. Compile fails for me on Jessie with current osmi + libosmium:

g++ -I../../libosmium/include/ -O3 -std=c++11 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DOSMIUM_WITH_SPARSEHASH=1 -Wall -Wextra -pedantic -Wredundant-decls -Wdisabled-optimization -Wctor-dtor-privacy -Wnon-virtual-dtor -Woverloaded-virtual -Wsign-promo -Wold-style-cast -I/usr/include/gdal -o osmi main.cpp -lexpat -pthread -lz -lprotobuf-lite -losmpbf -lz -lbz2 -L/usr/lib -lgeos-3.4.2 -L/usr/lib -lgdal -lboost_program_options -lboost_filesystem -lboost_system ; touch last_use_of_gcc.tmp main.cpp: In function ‘int main(int, char**)’: main.cpp:91:10: error: ‘google::protobuf’ has not been declared google::protobuf::ShutdownProtobufLibrary();

I added

diff --git a/osmi/main.cpp b/osmi/main.cpp index 8a1eef4..0fa4a35 100644 --- a/osmi/main.cpp +++ b/osmi/main.cpp @@ -1,6 +1,8 @@

include

include

+#include <google/protobuf/stubs/common.h> +

pragma GCC diagnostic push

pragma GCC diagnostic ignored "-Wold-style-cast"

pragma GCC diagnostic ignored "-Wredundant-decls"

which worked for me ...

Flo

ltog commented 8 years ago

@flohoff : The diff you pasted looks crippled: There is no further text after #include... You might want to surround such text/code using tripple backticks as described in https://help.github.com/articles/basic-writing-and-formatting-syntax/#quoting-code .

Are you sure you are using the latest version of osmi-addresses and libosmium? You will find the latest version osmi-addresses in branch master. As far as I understand the error message it refers to the line google::protobuf::ShutdownProtobufLibrary(); that I removed about half a year ago in https://github.com/ltog/osmi-addresses/commit/2bd4fe248ad2b17967a4892e9385f6d7cd2b5158 .

Note that Google Protobuf and OSMPBF aren't dependencies of libosmium anymore: https://github.com/osmcode/libosmium/wiki/Libosmium-dependencies#google-protocol-buffers-until-version-22

flohoff commented 8 years ago

I am completely puzzled. Ahhhh - investigating a bit deeper showed i tried a different checkout as the current state wont build for other reasons. Working on scratch machines without reproducible setup turns out to be a real pain ... Sorry for the noise ...

Thats the build error which caused me to go back to a different commitid:

CXXFLAGS=-I../../libosmium/include/ make g++ -I../../libosmium/include/ -O3 -std=c++11 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DOSMIUM_WITH_SPARSEHASH=1 -Wall -Wextra -pedantic -Wredundant-decls -Wdisabled-optimization -Wctor-dtor-privacy -Wnon-virtual-dtor -Woverloaded-virtual -Wsign-promo -Wold-style-cast -Wuninitialized -Wcast-align -Wcast-qual -Wformat=2 -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wnoexcept -Wshadow -Wsign-conversion -Wstrict-null-sentinel -Wstrict-overflow=5 -Wswitch-default -Wundef -Wabi -Wconversion -Winline -Winvalid-pch -Wmissing-format-attribute -Wpadded -Wstack-protector -Wswitch-enum -Wunsafe-loop-optimizations -Wzero-as-null-pointer-constant -Wuseless-cast -Wno-long-long -Wno-inline -Wno-padded -Wno-conversion -Wno-shadow -Wno-sign-conversion -Wno-strict-overflow -isystem/usr/include/gdal -o osmi-addresses main.cpp -lexpat -pthread -lz -lprotobuf-lite -losmpbf -lz -lbz2 -L/usr/lib -lgeos-3.4.2 -L/usr/lib -lgdal -lboost_program_options -lboost_filesystem -lboost_system && touch last_use_of_gcc.tmp In file included from ../../libosmium/include/osmium/osm/node.hpp:37:0, from ../../libosmium/include/osmium/handler/node_locations_for_ways.hpp:42, from main.cpp:19: ../../libosmium/include/osmium/osm/item_type.hpp: In function ‘char osmium::item_type_to_char(osmium::item_type)’: ../../libosmium/include/osmium/osm/item_type.hpp:125:16: warning: switch missing default case [-Wswitch-default] switch (type) { ^ ../../libosmium/include/osmium/osm/item_type.hpp: In function ‘const char* osmium::item_type_to_name(osmium::item_type)’: ../../libosmium/include/osmium/osm/item_type.hpp:156:16: warning: switch missing default case [-Wswitch-default]

flohoff commented 8 years ago

And while investigating even further these are only warning - One simply needs to ignore the 35 Pages of warnings - an osmi executable will be generated.

ltog commented 8 years ago

@flohoff : Having a lot of error messages may be a remnant of https://github.com/ltog/osmi-addresses/issues/62 where I intentionally activated lots of warnings in order to clean up the code. That issue was however quickly followed by https://github.com/ltog/osmi-addresses/issues/63 where I half-heartedly deactivated warnings again. I should fix this...

As a workaround you can use clang++ which should produce less warnings at the code's current state.

Sorry for the noise ...

Never mind!