osrm-backend: OS X compile error: call to 'abs' is ambiguous
This is happening on Travis’s OS X machines. Full log is here. Details on XCode for this machine is here.
One odd thing is that c++11 should not be enabled and libc++ should not be being linked because -DOSXLIBSTD="libstdc++" is being passed to cmake, but the configure output says:
-- Activating -std=c++11 flag for >= OS X 10.9
-- linking against libc++
Error is:
[ 22%] Building CXX object CMakeFiles/OSRM.dir/Algorithms/DouglasPeucker.cpp.o
/Users/travis/build/DennisOSRM/node-osrm/Project-OSRM/Algorithms/DouglasPeucker.cpp:102:37: error:
call to 'abs' is ambiguous
const double distance = std::abs(temp_dist);
^~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/cmath:660:1: note:
candidate function
abs(float __x) _NOEXCEPT {return fabsf(__x);}
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/cmath:664:1: note:
candidate function
abs(double __x) _NOEXCEPT {return fabs(__x);}
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/cmath:668:1: note:
candidate function
abs(long double __x) _NOEXCEPT {return fabsl(__x);}
^
1 error generated.
make[2]: *** [CMakeFiles/OSRM.dir/Algorithms/DouglasPeucker.cpp.o] Error 1
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 15 (7 by maintainers)
Commits related to this issue
- workaround std::abs bug - refs DennisOSRM/Project-OSRM#1000 — committed to Project-OSRM/node-osrm by deleted user 10 years ago
- fix twisted conversion, fixes #1000 — committed to Project-OSRM/osrm-backend by DennisOSRM 10 years ago
- fix twisted conversion, fixes #1000 — committed to Project-OSRM/osrm-backend by DennisOSRM 10 years ago
- resolve ambiguities in referring to std::abs, in map_location.hpp Ancestral reported compilation errors with clang on OS X, basically similar to what is reported here: https://github.com/Project-OSR... — committed to wesnoth/wesnoth by cbeck88 10 years ago
I’ll summarize:
std::fabs