microsoft / msix-packaging

MSIX SDK
MIT License
978 stars 165 forks source link

[BUG] Build fails due to constexpr being used invalid #553

Open LordOfDragons opened 1 year ago

LordOfDragons commented 1 year ago

Project MSIX SDK

Describe the bug Clean build fails with error:

In file included from /opt/msix-packaging-master/src/test/msixtest/msixtest.cpp:6:
/opt/msix-packaging-master/lib/catch2/catch.hpp:8749:34: error: constexpr variable 'sigStackSize' must be initialized by a constant expression
    constexpr static std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ;
                                 ^              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/msix-packaging-master/lib/catch2/catch.hpp:8749:58: note: non-constexpr function 'sysconf' cannot be used in a constant expression
    constexpr static std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ;
                                                         ^
/usr/include/x86_64-linux-gnu/bits/sigstksz.h:32:22: note: expanded from macro 'MINSIGSTKSZ'
# define MINSIGSTKSZ SIGSTKSZ
                     ^
/usr/include/x86_64-linux-gnu/bits/sigstksz.h:28:19: note: expanded from macro 'SIGSTKSZ'
# define SIGSTKSZ sysconf (_SC_SIGSTKSZ)
                  ^
/usr/include/unistd.h:640:17: note: declared here
extern long int sysconf (int __name) __THROW;
                ^
In file included from /opt/msix-packaging-master/src/test/msixtest/msixtest.cpp:6:
/opt/msix-packaging-master/lib/catch2/catch.hpp:8808:33: error: variable length array declaration not allowed at file scope
    char FatalConditionHandler::altStackMem[sigStackSize] = {};
                                ^           ~~~~~~~~~~~~
2 errors generated.
make[2]: *** [src/test/msixtest/CMakeFiles/msixtest.dir/build.make:90: src/test/msixtest/CMakeFiles/msixtest.dir/msixtest.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:637: src/test/msixtest/CMakeFiles/msixtest.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

To Reproduce

Expected behavior Build succeeds.

Platform Ubuntu 22.04

msftrubengu commented 1 year ago

This is a dupe of #514