microsoft / microsoft/msix-packaging
[BUG] Build fails due to constexpr being used invalid
Open
Nobody has claimed this yet.
Area-MSIX SDK
Bug
- Dominant language
- C
- Stars
- 1.1k
- Forks
- 193
- Avg merge
- 2h 16m
- Merged PRs (30d)
- 2
Description
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
- Check out master branch
- Make a clean build
- Build fails around 97%
Expected behavior
Build succeeds.
Platform
Ubuntu 22.04
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the clean-build failure on Ubuntu 22.04 and inspect lib/catch2/catch.hpp around lines 8749 and 8808, where the reported constexpr and variable-length-array errors occur. Rebuild the msixtest target after the change; done means the clean build completes successfully past the failing test compilation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- build-system, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100