ubuntu gcc11 failed to compile libmediasoupclient

[ 84%] Building CXX object test/CMakeFiles/test_mediasoupclient.dir/src/tests.cpp.o
In file included from /usr/include/signal.h:328,
from /home/freeman/workspace/msv3/libmediasoupclient-3.3.0/deps/catch/single_include/catch2/catch.hpp:7955,
from /home/freeman/workspace/msv3/libmediasoupclient-3.3.0/test/src/tests.cpp:6:
/home/freeman/workspace/msv3/libmediasoupclient-3.3.0/deps/catch/single_include/catch2/catch.hpp:10735:58: error: call to non-‘constexpr’ function ‘long int sysconf(int)’
10735 | static constexpr std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ;
| ^~~~~~~~~~~
In file included from /home/freeman/workspace/msv3/webrtc_checkout/src/rtc_base/platform_thread_types.h:27,
from /home/freeman/workspace/msv3/webrtc_checkout/src/rtc_base/synchronization/sequence_checker_internal.h:17,
from /home/freeman/workspace/msv3/webrtc_checkout/src/api/sequence_checker.h:14,
from /home/freeman/workspace/msv3/webrtc_checkout/src/api/stats_types.h:24,
from /home/freeman/workspace/msv3/webrtc_checkout/src/api/peer_connection_interface.h:112,
from /home/freeman/workspace/msv3/libmediasoupclient-3.3.0/include/PeerConnection.hpp:5,
from /home/freeman/workspace/msv3/libmediasoupclient-3.3.0/test/src/tests.cpp:4:
/usr/include/unistd.h:640:17: note: ‘long int sysconf(int)’ declared here
640 | extern long int sysconf (int __name) __THROW;
| ^~~~~~~
In file included from /home/freeman/workspace/msv3/libmediasoupclient-3.3.0/test/src/tests.cpp:6:
/home/freeman/workspace/msv3/libmediasoupclient-3.3.0/deps/catch/single_include/catch2/catch.hpp:10794:45: error: size of array ‘altStackMem’ is not an integral constant-expression
10794 | char FatalConditionHandler::altStackMem[sigStackSize] = {};
| ^~~~~~~~~~~~
make[2]: *** [test/CMakeFiles/test_mediasoupclient.dir/build.make:216: test/CMakeFiles/test_mediasoupclient.dir/src/tests.cpp.o] Error 1
make[2]: Leaving directory ‘/home/freeman/workspace/msv3/libmediasoupclient-3.3.0/build’
make[1]: *** [CMakeFiles/Makefile2:198: test/CMakeFiles/test_mediasoupclient.dir/all] Error 2
make[1]: Leaving directory ‘/home/freeman/workspace/msv3/libmediasoupclient-3.3.0/build’
make: *** [Makefile:136: all] Error 2
make: Leaving directory ‘/home/freeman/workspace/msv3/libmediasoupclient-3.3.0/build’
freeman@freeman-virtual-machine:~/workspace/msv3/libmediasoupclient-3.3.0$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: …/src/configure -v --with-pkgversion=‘Ubuntu 11.2.0-19ubuntu1’ --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-gBFGDP/gcc-11-11.2.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-gBFGDP/gcc-11-11.2.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.2.0 (Ubuntu 11.2.0-19ubuntu1)
freeman@freeman-virtual-machine:~/workspace/msv3/libmediasoupclient-3.3.0$

old: // static constexpr std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ;
new: static int sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ;

old: //char FatalConditionHandler::altStackMem[sigStackSize ] = {};
new: char FatalConditionHandler::altStackMem[32768] = {};

1 Like