Compilation error #272

Closed
steinm opened this Issue May 23, 2012 · 14 comments

7 participants

@steinm

The latest code from git master doesn't compile on my Debian Sid.

If the information is to scarce, let me know. I'm not that familiar with boost.

Uwe

scons: Building targets ...
g++ -o Algorithms/CRC32.o -c -O3 -DNDEBUG -march=native -fopenmp -I/usr/include -I/usr/include/include -I/usr/include/libxml2 Algorithms/CRC32.cpp
g++ -o Contractor/EdgeBasedGraphFactory.o -c -O3 -DNDEBUG -march=native -fopenmp -I/usr/include -I/usr/include/include -I/usr/include/libxml2 Contractor/EdgeBasedGraphFactory.cpp
In file included from /usr/include/boost/functional/hash/hash.hpp:15:0,
from /usr/include/boost/functional/hash.hpp:6,
from /usr/include/boost/unordered/unordered_map.hpp:21,
from /usr/include/boost/unordered_map.hpp:16,
from Contractor/../DataStructures/ExtractorStructs.h:26,
from Contractor/EdgeBasedGraphFactory.h:38,
from Contractor/EdgeBasedGraphFactory.cpp:29:
/usr/include/boost/functional/hash/detail/hash_float.hpp: In instantiation of 'std::size_t boost::hash_detail::float_hash_value(T) [with T = float; std::size_t = long unsigned int]':
/usr/include/boost/functional/hash/hash.hpp:329:54: required from here
/usr/include/boost/functional/hash/detail/hash_float.hpp:65:13: error: call of overloaded 'fpclassify(float&)' is ambiguous
/usr/include/boost/functional/hash/detail/hash_float.hpp:65:13: note: candidates are:
In file included from /usr/include/boost/lexical_cast.hpp:58:0,
from Contractor/EdgeBasedGraphFactory.cpp:23:
/usr/include/c++/4.7/cmath:811:5: note: typename __gnu_cxx::__enable_ifstd::__is_arithmetic<_Tp::__value, int>::__type std::fpclassify(_Tp) [with _Tp = float; typename __gnu_cxx::__enable_ifstd::__is_arithmetic<_Tp::__value, int>::__type = int]
In file included from /usr/include/boost/lexical_cast.hpp:71:0,
from Contractor/EdgeBasedGraphFactory.cpp:23:
/usr/include/boost/math/special_functions/fpclassify.hpp:248:12: note: int boost::math::fpclassify(T) [with T = float]
In file included from /usr/include/boost/functional/hash/hash.hpp:15:0,
from /usr/include/boost/functional/hash.hpp:6,
from /usr/include/boost/unordered/unordered_map.hpp:21,
from /usr/include/boost/unordered_map.hpp:16,
from Contractor/../DataStructures/ExtractorStructs.h:26,
from Contractor/EdgeBasedGraphFactory.h:38,
from Contractor/EdgeBasedGraphFactory.cpp:29:
/usr/include/boost/functional/hash/detail/hash_float.hpp: In instantiation of 'std::size_t boost::hash_detail::float_hash_value(T) [with T = double; std::size_t = long unsigned int]':
/usr/include/boost/functional/hash/hash.hpp:334:54: required from here
/usr/include/boost/functional/hash/detail/hash_float.hpp:65:13: error: call of overloaded 'fpclassify(double&)' is ambiguous
/usr/include/boost/functional/hash/detail/hash_float.hpp:65:13: note: candidates are:
In file included from /usr/include/boost/lexical_cast.hpp:58:0,
from Contractor/EdgeBasedGraphFactory.cpp:23:
/usr/include/c++/4.7/cmath:811:5: note: typename __gnu_cxx::__enable_ifstd::__is_arithmetic<_Tp::__value, int>::__type std::fpclassify(_Tp) [with _Tp = double; typename __gnu_cxx::__enable_ifstd::__is_arithmetic<_Tp::__value, int>::__type = int]
In file included from /usr/include/boost/lexical_cast.hpp:71:0,
from Contractor/EdgeBasedGraphFactory.cpp:23:
/usr/include/boost/math/special_functions/fpclassify.hpp:248:12: note: int boost::math::fpclassify(T) [with T = double]
In file included from /usr/include/boost/functional/hash/hash.hpp:15:0,
from /usr/include/boost/functional/hash.hpp:6,
from /usr/include/boost/unordered/unordered_map.hpp:21,
from /usr/include/boost/unordered_map.hpp:16,
from Contractor/../DataStructures/ExtractorStructs.h:26,
from Contractor/EdgeBasedGraphFactory.h:38,
from Contractor/EdgeBasedGraphFactory.cpp:29:
/usr/include/boost/functional/hash/detail/hash_float.hpp: In instantiation of 'std::size_t boost::hash_detail::float_hash_value(T) [with T = long double; std::size_t = long unsigned int]':
/usr/include/boost/functional/hash/hash.hpp:339:54: required from here
/usr/include/boost/functional/hash/detail/hash_float.hpp:65:13: error: call of overloaded 'fpclassify(long double&)' is ambiguous
/usr/include/boost/functional/hash/detail/hash_float.hpp:65:13: note: candidates are:
In file included from /usr/include/boost/lexical_cast.hpp:58:0,
from Contractor/EdgeBasedGraphFactory.cpp:23:
/usr/include/c++/4.7/cmath:811:5: note: typename __gnu_cxx::__enable_ifstd::__is_arithmetic<_Tp::__value, int>::__type std::fpclassify(_Tp) [with _Tp = long double; typename __gnu_cxx::__enable_ifstd::__is_arithmetic<_Tp::__value, int>::__type = int]
In file included from /usr/include/boost/lexical_cast.hpp:71:0,
from Contractor/EdgeBasedGraphFactory.cpp:23:
/usr/include/boost/math/special_functions/fpclassify.hpp:248:12: note: int boost::math::fpclassify(T) [with T = long double]
scons: *** [Contractor/EdgeBasedGraphFactory.o] Error 1
scons: building terminated because of errors.

@DennisOSRM
Project OSRM member

What's the version of Boost that is installed?

@steinm
@DennisOSRM
Project OSRM member

Looks like a boost problem to me. Some internal function call seems to be ambigous.

@allox

i've had many problems installing on Debian Sid and libboost, and gave up due to these dependency problems.
Easiest install is on Ubuntu 12.04, which works almost right away.

@pranavk

ya, same problem with me,
is it that so latest boost versions are not compatible, do we need to downgrade our boost versions ?

@DennisOSRM
Project OSRM member

config.log should give insights on why dependecies fail

@keesklopt

I had similar problems on mint, with boost1.48
Downgrading to 1.46 solved all problems,

@andrewharvey

I don't know about steinm, but for me to get scons to pass when using either boost 1.49 or boost 1.50 in debian unstable I needed to add this,

if not conf.CheckLibWithHeader('boost_system', 'boost/system/config.hpp', 'CXX'):
    print "boost system library not found. Exiting"
    Exit(-1);

above

if not conf.CheckLibWithHeader('boost_thread', 'boost/thread.hpp', 'CXX'):

in the SConstruct file as the check for boost_thread needs -lboost_system as discussed in this boost dev thread http://lists.boost.org/Archives/boost/2012/01/189698.php

I still get the same error as steinm with boost 1.50 though...

@steinm
@andrewharvey

Yeh, as DennisOSRM said, the problem seems within Boost where at /usr/include/boost/functional/hash/detail/hash_float.hpp:65 it calls the fpclassify function, but it is ambiguous whether that should be the fpclassify defined in the cmath library or the one defined in boost::math. Seems like a Boost bug, https://svn.boost.org/trac/boost/ticket/6649 (I think that is the same issue).

@karme

I think it is a bad idea to pull in namespace boost:math in typedefs.h

@karme

to compile on debian/testing=wheezy i use the following patch:

$ git diff
diff --git a/typedefs.h b/typedefs.h
index 4bf34cc..30d9385 100644
--- a/typedefs.h
+++ b/typedefs.h
@@ -27,6 +27,7 @@ or see http://www.gnu.org/licenses/agpl.txt.

#include
#include
+#include // for exit

using namespace std;

@@ -51,10 +52,19 @@ using namespace std;
#define M_PI 3.14159265358979323846
#endif

+/*

  • on debian/testing=wheezy this causes the build to fail and it looks
  • like a bad idea to import a complete namespace in a header included
  • first by other headers +
  • I simply comment this out for now / this likely will break other
  • setups
  • #ifndef HAVE_ROUNDF
    #include
    using namespace boost::math;
    #endif
    +*/

    typedef unsigned int NodeID;
    typedef unsigned int EdgeID;

@karme

Sorry for the corrupted diff - see also: commit dfab5ed614a4a76d79434ba14f78b4ffe2a606d7

@DennisOSRM
Project OSRM member

I commented on the commit, but will do it here as well:

This crappy #ifndef-#include-using combo was a workaround for VS compiler for Windows. Visual Studio does not implement C99 and has no round function. I will commit and push a workaround soon that should fix this issue by a Windows specific define.

If there are any issues, please let me know.

@DennisOSRM DennisOSRM pushed a commit that referenced this issue Aug 13, 2012
DennisOSRM Implementing issue #272 4f2e9e8
@DennisOSRM DennisOSRM closed this Aug 15, 2012
@Zhdanovich Zhdanovich pushed a commit to Zhdanovich/Project-OSRM that referenced this issue Jul 20, 2014
DennisOSRM Implementing issue #272 32479c0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment