osm icon indicating copy to clipboard operation
osm copied to clipboard

build fails on openSUSE Tumbleweed: error: ‘log10f’ is not a member of ‘std’; did you mean ‘log1pf’

Open nettings opened this issue 3 years ago • 3 comments

Pretty sure this is a distro issue rather than a bug in osm, but I'm reporting it anyways in case someone hits the same problem. It seems to be a common issue that some versions of the C++ std library are missing some often-used math functions, but I have been unable to find a quick fix. Any hints?

src/union.cpp:313:30: error: ‘log10f’ is not a member of ‘std’; did you mean ‘log1pf’?
  313 |         module = 20.f * std::log10f((primary)->module(i));
      |                              ^~~~~~
      |                              log1pf
src/union.cpp:324:43: error: ‘log10f’ is not a member of ‘std’; did you mean ‘log1pf’?
  324 |                     module += 20.f * std::log10f((*it)->module(i));
      |                                           ^~~~~~
      |                                           log1pf
src/union.cpp:329:43: error: ‘log10f’ is not a member of ‘std’; did you mean ‘log1pf’?
  329 |                     module -= 20.f * std::log10f((*it)->module(i));
      |                                           ^~~~~~
      |                                           log1pf

nettings avatar Dec 02 '21 23:12 nettings

Thank you! Recently, I reworked union and didn't yet check it for Linux. A quick fix should be to add: #include <cmath>; to the file union.cpp

psmokotnin avatar Dec 03 '21 15:12 psmokotnin

Tried that, and also tried replacing all other occurrences of "math.h" with , but no luck... That's why I guess it's maybe a distritbution thing... sometimes it happens that default includes in <...> are not found, and if I use the full path, it works. Dunno what's going on there... but then, C++ is really not my strong point.

nettings avatar Dec 03 '21 23:12 nettings

Replacing std::log10f with the generic std::log10 fixes it, and I now have it running. I don't know if that is a reasonable fix, but looking forward to playing with osm. :o)

nettings avatar Dec 03 '21 23:12 nettings

fixed

psmokotnin avatar Dec 19 '22 00:12 psmokotnin