Skip to content

Compilation failure: demux/adaptive/playlist/SegmentInformation.cpp:397:23: error: 'numeric_limits' is not a member of 'std'

System: Fedora Linux Rawhide on x86_64

gcc: 11.0.0

Build flags: -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection

demux/adaptive/playlist/SegmentInformation.cpp: In member function 'bool adaptive::playlist::SegmentInformation::getPlaybackTimeDurationBySegmentNumber(uint64_t, mtime_t*, mtime_t*) const':
demux/adaptive/playlist/SegmentInformation.cpp:397:23: error: 'numeric_limits' is not a member of 'std'
  397 |     if(number == std::numeric_limits<uint64_t>::max())
      |                       ^~~~~~~~~~~~~~
demux/adaptive/playlist/SegmentInformation.cpp:397:46: error: expected primary-expression before '>' token
  397 |     if(number == std::numeric_limits<uint64_t>::max())
      |                                              ^
demux/adaptive/playlist/SegmentInformation.cpp:397:49: error: '::max' has not been declared; did you mean 'std::max'?
  397 |     if(number == std::numeric_limits<uint64_t>::max())
      |                                                 ^~~
      |                                                 std::max
In file included from /usr/include/c++/11/algorithm:62,
                 from demux/adaptive/playlist/SegmentInformation.cpp:35:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note: 'std::max' declared here
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
make[4]: *** [Makefile:24383: demux/adaptive/playlist/libadaptive_plugin_la-SegmentInformation.lo] Error 1

I know this bug is triggered by one of the build flags we use on Fedora but I don't know which one.

The fix is fairly simple: add to modules/demux/adaptive/playlist/SegmentInformation.cpp

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information