joto / osmium

C++/Javascript framework for working with OSM files.
http://wiki.openstreetmap.org/wiki/Osmium
GNU General Public License v3.0
123 stars 31 forks source link

Fails to build with GCC 6: call overloaded is ambiguous #97

Closed sebastic closed 8 years ago

sebastic commented 8 years ago

As reported by Martin Michlmayr in Debian Bug #811999:

This package fails to build with GCC 6. GCC 6 has not been released yet, but it's expected that GCC 6 will become the default compiler for stretch.

Note that only the first error is reported; there might be more. You can find a snapshot of GCC 6 in experimental. To build with GCC 6, you can set CC=gcc-6 CXX=g++-6 explicitly.

You may be able to find out more about this issue at https://gcc.gnu.org/gcc-6/changes.html

sbuild (Debian sbuild) 0.67.0 (26 Dec 2015) on dl580gen9-02.hlinux
...
==========================
c++ -I../include -I. -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wall -Wextra -Wredundant-decls -Wdisabled-optimization -pedantic -Wctor-dtor-privacy -Wnon-virtual-dtor -Woverloaded-virtual -Wsign-promo -Wno-long-long -o tests test_main.o test_utils.o t/osmfile/test_read_and_write.cpp -I/usr/include -I/usr/include/gdal -L/usr/lib/x86_64-linux-gnu -lgeos-3.5.0 -L/usr/lib -lgdal -lboost_regex -lboost_iostreams -lboost_filesystem -lboost_system -DBOOST_TEST_DYN_LINK -Wl,-z,relro -lboost_unit_test_framework
--------------------------
t/osmfile/test_read_and_write.cpp: In member function 'void OSMFile_Output::write_to_xml_output_file::test_method()':
t/osmfile/test_read_and_write.cpp:65:48: error: call of overloaded 'basic_ifstream(TempFileFixture&, const openmode&)' is ambiguous
     std::ifstream in(test_osm, std::ios::binary);
                                                ^

In file included from t/osmfile/test_read_and_write.cpp:7:0:
/usr/include/c++/6/fstream:511:7: note: candidate: std::basic_ifstream<_CharT, _Traits>::basic_ifstream(const string&, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits<char>; std::__cxx11::string = std::__cxx11::basic_string<char>; std::ios_base::openmode = std::_Ios_Openmode]
       basic_ifstream(const std::string& __s,
       ^~~~~~~~~~~~~~

/usr/include/c++/6/fstream:495:7: note: candidate: std::basic_ifstream<_CharT, _Traits>::basic_ifstream(const char*, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits<char>; std::ios_base::openmode = std::_Ios_Openmode]
       basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in)
       ^~~~~~~~~~~~~~

t/osmfile/test_read_and_write.cpp: In member function 'void OSMFile_Output::write_to_xml_gz_output_file::test_method()':
t/osmfile/test_read_and_write.cpp:82:58: error: call of overloaded 'basic_ifstream(TempFileFixture&, const openmode&)' is ambiguous
     std::ifstream inputfile(test_osm_gz, std::ios::binary);
                                                          ^

In file included from t/osmfile/test_read_and_write.cpp:7:0:
/usr/include/c++/6/fstream:511:7: note: candidate: std::basic_ifstream<_CharT, _Traits>::basic_ifstream(const string&, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits<char>; std::__cxx11::string = std::__cxx11::basic_string<char>; std::ios_base::openmode = std::_Ios_Openmode]
       basic_ifstream(const std::string& __s,
       ^~~~~~~~~~~~~~

/usr/include/c++/6/fstream:495:7: note: candidate: std::basic_ifstream<_CharT, _Traits>::basic_ifstream(const char*, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits<char>; std::ios_base::openmode = std::_Ios_Openmode]
       basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in)
       ^~~~~~~~~~~~~~

t/osmfile/test_read_and_write.cpp: In member function 'void OSMFile_Output::write_to_xml_bz2_output_file::test_method()':
t/osmfile/test_read_and_write.cpp:102:59: error: call of overloaded 'basic_ifstream(TempFileFixture&, const openmode&)' is ambiguous
     std::ifstream inputfile(test_osm_bz2, std::ios::binary);
joto commented 8 years ago

The reason for the problem seems to be that GCC 6 compiles with --std=c++14 by default. I have fixed this now, but be aware that Osmium is not really supported any more. Everybody should switch to the new version libosmium.

sebastic commented 8 years ago

Thanks for the fix, I'll include the changes from b30afd3 in the Debian package.

I'd like to keep the old osmium package in Debian at least for the duration of the stretch stable release, to allow users to switch to libosmium (introduced in stretch) during that time. The early adopters can already use libosmium from jessie-backports.

I'll add a NEWS.Debian entry to document the deprecation in stretch and the suggested move to libosmium.