Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch2 fails to compile on Fedora Rawhide #2178

Closed
lzaoral opened this issue Feb 17, 2021 · 6 comments · Fixed by NVIDIA/cuCollections#186
Closed

Catch2 fails to compile on Fedora Rawhide #2178

lzaoral opened this issue Feb 17, 2021 · 6 comments · Fixed by NVIDIA/cuCollections#186
Labels

Comments

@lzaoral
Copy link

lzaoral commented Feb 17, 2021

Describe the bug
Tests that use Catch2 fail to compile on Fedora Rawhide.

Expected behavior
Tests that use Catch2 compile and execute without any problems on Fedora Rawhide.

Reproduction steps
Try to compile the factorial example from the Catch2 tutorial:

$ c++ test.cpp
In file included from /usr/include/signal.h:315,
                 from catch.hpp:8034,
                 from test.cpp:2:
catch.hpp:10822:58: error: call to non-'constexpr' function 'long int sysconf(int)'
10822 |     static constexpr std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ;
      |                                                          ^~~~~~~~~~~
In file included from /usr/include/bits/sigstksz.h:24,
                 from /usr/include/signal.h:315,
                 from catch.hpp:8034,
                 from test.cpp:2:
/usr/include/unistd.h:630:17: note: 'long int sysconf(int)' declared here
  630 | extern long int sysconf (int __name) __THROW;
      |                 ^~~~~~~
In file included from test.cpp:2:
catch.hpp:10881:45: error: size of array 'altStackMem' is not an integral constant-expression
10881 |     char FatalConditionHandler::altStackMem[sigStackSize] = {};
      |                                             ^~~~~~~~~~~~

Platform information:

  • OS: latest Fedora Rawhide
  • Compiler+version: gcc (GCC) 11.0.0 20210210 (Red Hat 11.0.0-0)
  • Catch version: v2.13.4

Additional context
This behaviour seems to be related to this change in glibc: https://sourceware.org/git/?p=glibc.git;a=commit;h=6c57d320484988e87e446e2e60ce42816bf51d53

@horenmar
Copy link
Member

Humm, can't say I am happy that MINSIGSTKSZ became non-constant, but it should be easy enough to fix...

@tomhughes
Copy link
Contributor

It's also broken catch 1 which uses SIGSTKSZE which is also now non-constant.

@tomhughes
Copy link
Contributor

I've pushed new builds of catch1 and catch for Fedora Rawhide now which hardwire the stack size as 32Kb until we have a better fix.

woodard pushed a commit to woodard/libabigail that referenced this issue Feb 24, 2021
This patch is about fixing a compilation error that we are seeing on
Fedora Rawhide with glibc 2.33.9000, which makes MINSIGSTKSZ not be a
constant value anymore.  Thus, the sigStackSize variable that is
declared constexpr cannot use that MINSIGSTKSZ as initializer anymore.

So as suggested in the issue
catchorg/Catch2#2178 filed against
'catchorg' for this purpose, I am hardwiring the initialization value
of sigStackSize for now.

	* tests/lib/catch.hpp: Update to v2.13.4 and initialize
	sigStackSize to 32768 for now, as suggested by
	catchorg/Catch2#2178.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
sixg0000d added a commit to sixg0000d-copr/shadowsocksr-uvw that referenced this issue Mar 17, 2021
Skip tests to workaround a compilation error same as catchorg/Catch2#2178
horenmar added a commit that referenced this issue Apr 4, 2021
Because new glibc has changed `MINSIGSTKSZ` to be a syscall instead
of being constant, the signal posix handling needed changes, as it
used the value in constexpr context, for deciding size of an array.
It would be simple to fix it by having the handler determine the
signal handling stack size and allocate the memory every time the
handler is being installed, but that would add another allocation
and a syscall every time a test case is entered.

Instead, I split apart the idea of preparing fatal error handlers,
and engaging them, so that the memory can be allocated only once
and still be guarded by RAII.

Also turns out that Catch2's use of `MINSIGSTKSZ` was wrong, and
we should've been using `SIGSTKSZ` the whole time, which we use now.

Closes #2178
horenmar added a commit that referenced this issue Apr 4, 2021
Because new glibc has changed `MINSIGSTKSZ` to be a syscall instead
of being constant, the signal posix handling needed changes, as it
used the value in constexpr context, for deciding size of an array.
It would be simple to fix it by having the handler determine the
signal handling stack size and allocate the memory every time the
handler is being installed, but that would add another allocation
and a syscall every time a test case is entered.

Instead, I split apart the idea of preparing fatal error handlers,
and engaging them, so that the memory can be allocated only once
and still be guarded by RAII.

Also turns out that Catch2's use of `MINSIGSTKSZ` was wrong, and
we should've been using `SIGSTKSZ` the whole time, which we use now.

Closes #2178
horenmar added a commit that referenced this issue Apr 4, 2021
Because new glibc has changed `MINSIGSTKSZ` to be a syscall instead
of being constant, the signal posix handling needed changes, as it
used the value in constexpr context, for deciding size of an array.
It would be simple to fix it by having the handler determine the
signal handling stack size and allocate the memory every time the
handler is being installed, but that would add another allocation
and a syscall every time a test case is entered.

Instead, I split apart the idea of preparing fatal error handlers,
and engaging them, so that the memory can be allocated only once
and still be guarded by RAII.

Also turns out that Catch2's use of `MINSIGSTKSZ` was wrong, and
we should've been using `SIGSTKSZ` the whole time, which we use now.

Closes #2178
@horenmar
Copy link
Member

horenmar commented Apr 4, 2021

Should be resolved in current commit on the v2.x branch. You will need to regenerate the single header to test it (use scripts/generateSingleHeader.py)

@horenmar horenmar added the Resolved - pending review Issue waiting for feedback from the original author label Apr 4, 2021
@lzaoral
Copy link
Author

lzaoral commented Apr 6, 2021

The fix works for me as well. Thanks!

@horenmar
Copy link
Member

Closing as the fixed version has been released, and this won't autoclose since v2 is no longer main branch.

@horenmar horenmar removed the Resolved - pending review Issue waiting for feedback from the original author label Apr 11, 2021
lzaoral added a commit to lzaoral/dg that referenced this issue Apr 12, 2021
Fixes compilation with new glibc on Fedora Rawhide.
See: catchorg/Catch2#2178
mchalupa pushed a commit to mchalupa/dg that referenced this issue Apr 13, 2021
Fixes compilation with new glibc on Fedora Rawhide.
See: catchorg/Catch2#2178
horenmar added a commit that referenced this issue May 9, 2021
Because new glibc has changed `MINSIGSTKSZ` to be a syscall instead
of being constant, the signal posix handling needed changes, as it
used the value in constexpr context, for deciding size of an array.
It would be simple to fix it by having the handler determine the
signal handling stack size and allocate the memory every time the
handler is being installed, but that would add another allocation
and a syscall every time a test case is entered.

Instead, I split apart the idea of preparing fatal error handlers,
and engaging them, so that the memory can be allocated only once
and still be guarded by RAII.

Also turns out that Catch2's use of `MINSIGSTKSZ` was wrong, and
we should've been using `SIGSTKSZ` the whole time, which we use now.

Closes #2178
horenmar added a commit that referenced this issue May 9, 2021
Because new glibc has changed `MINSIGSTKSZ` to be a syscall instead
of being constant, the signal posix handling needed changes, as it
used the value in constexpr context, for deciding size of an array.
It would be simple to fix it by having the handler determine the
signal handling stack size and allocate the memory every time the
handler is being installed, but that would add another allocation
and a syscall every time a test case is entered.

Instead, I split apart the idea of preparing fatal error handlers,
and engaging them, so that the memory can be allocated only once
and still be guarded by RAII.

Also turns out that Catch2's use of `MINSIGSTKSZ` was wrong, and
we should've been using `SIGSTKSZ` the whole time, which we use now.

Closes #2178
ausil added a commit to ausil/PrusaSlicer that referenced this issue May 16, 2021
see catchorg/Catch2#2178

Signed-off-by: Dennis Gilmore <dennis@ausil.us>
graugans pushed a commit to graugans/lan743x-config that referenced this issue Oct 21, 2022
Based on this patch:
woodard/libabigail@8ae8dcb

Please refer to the catch issue #2178 for details
catchorg/Catch2#2178

This might not work on all platforms

Signed-off-by: Christian Ege <christian.ege@ifm.com>
mmore500 added a commit to devosoft/Empirical that referenced this issue Nov 21, 2022
Fixes catchorg/Catch2#2178 on Ubunto 22.04
choll added a commit to choll/xtr that referenced this issue Dec 10, 2022
choll added a commit to choll/xtr that referenced this issue Dec 10, 2022
Krzmbrzl added a commit to Krzmbrzl/standardese that referenced this issue Mar 27, 2023
The currently used version still suffers from the issue that apparently
MINSIGSTKSZ is no longer a constant expression in newer glibc versions.

Upstream bug report: catchorg/Catch2#2178
dimitry-unified-streaming added a commit to unifiedstreaming/event-message-track that referenced this issue Jan 10, 2024
catch.hpp:10822:58: error: call to non-'constexpr' function 'long int sysconf(int)'

followed by:

catch.hpp:10881:45: error: size of array 'altStackMem' is not an integral constant-expression
dimitry-unified-streaming added a commit to unifiedstreaming/fmp4-ingest that referenced this issue Jan 10, 2024
catch.hpp:10822:58: error: call to non-'constexpr' function 'long int sysconf(int)'

followed by:

catch.hpp:10881:45: error: size of array 'altStackMem' is not an integral constant-expression
lorenzo-gomez-windhover added a commit to WindhoverLabs/juicer that referenced this issue Sep 17, 2024
-TODO:Move dwarf versions testing to os-level/Dockerfile. This avoids having to rely on expiremental features of DWARF support for some gcc versions/DWARF version combinations.
-Update Catch2 for Ubuntu22. catchorg/Catch2#2178
mbenson1 added a commit to WindhoverLabs/juicer that referenced this issue Sep 19, 2024
* -Write macro records correctly. Fixes #7

* -Cleanup

* -Update unit testing for draco patterns. WIP.

* -Update eclipse project

* -Minimally functional target_symbol

* -Do not store row id for symbol target updates

* -Update github CI

* -Docker config for CI

* -Point submodules to github

* -Cleanup

* -Add symbols and encoding mappings. WIP.

* -Add symbols and encoding mappings. WIP.

* Writer DWARF5 ecodings to encodings table

* -Add minimally functional encodings implementation.
-TODO:Cleanup.

* -Update Makefile

* -Update gitignore

* -Cleanup

* -Remove Ubuntu18 from github actions since it is not available anymore.
-https://github.blog/changelog/2022-08-09-github-actions-the-ubuntu-18-04-actions-runner-image-is-being-deprecated-and-will-be-removed-by-12-1-22/

* -Remove dead code

* -Cleanup

* -Cleanup

* -Cleanup

* -Include unit test code in format checks.
-Format unit test code.

* -Update unit tests

* -Configure coveralls.io for CI

* -Configure coveralls.io for CI

* -Configure coveralls.io for CI

* -Configure coveralls.io for CI

* -Configure coveralls.io for CI

* -Configure coveralls.io for CI

* -Configure coveralls.io for CI

* -Configure coveralls.io for CI

* -Update docs

* -Update unit tests for new schema. WIP.
-TODO:Add function to follow target symbols to test typdef'd types.
-TODO:Add unit tests for new macro and elf image features.

* -Add followTargetSymbol. Useful for testing typedef'd types.
-Update unit tests.

* -Use CFE_ES_HousekeepingTlm_Payload for unit testing.

* -Update docs

* -Update docs

* -Extract ELF image data from 64-bit targets properly.
-Add ElfClass to ElfFile

* -Update docs

* -Update unit-test test files

* -Remove libdwarf from unit test code test file

* -Remove dead code

* -Remove dead code

* -Add 32-bit make recipes.
-Add 32-bit unit tests.

* -Update 32-bit unit testing.

* -Update docs

* -Remove dead code

* -Update Logger unit tests
-Remove dead code

* -Update unit tests

* -Update docs

* -Cleanup

* -Cleanup

* -Cleanup

* -Add macro unit test.
-Update Dockerfile

* -Create test files that comply with DWARF4 and DWARF5. Allows us to verify support of DWARF4 as more features are added in the future.

* -Unit test DWARF4 and DWARF5. WIP.

* -Add DWARF4 testing to Dockerfile

* -Cleanup

* -Update docs

* -Update docs

* -Update Catch 2 due to issue on Ubuntu22:catchorg/Catch2#2178

* -pathIndex handling for DWARF5. TODO:This changes for DWARF4, so add alternative for DWARF4.
-Remove DisplayDie function for now as it blows up the stack with big c++ names inside DWARF.
-TODO:Rewrite DisplayDie function
-Add include to src/Artifact.h, needed for Ubuntu22.

* -Handle DWARF dbg source files for DWARF4 and 5.
-TODO:Figure out what to do about Ubuntu 20/22 behavior producing different DWARF src file line number info for the same DWARF version.

* -Add group number as CLI argument. WIP.
-Issues of interest:#36, #35

* -Group number argument. Useful for getting DWARF data from multiple COMBAT sections, like macros inside of unlinked ELF files.

* -Add unit tests for macros across multiple COMDAT groups.

* -Cleanup

* -Update docs

* -Update unit tests.

* -Update Dockerfile for Ubuntu22

* -Update CI

* -Update Dockerfiles for Ubuntu20 and Ubuntu22

* -Update Makefile

* -Update CI

* -Update CI

* -Test DWARF version in unit tests

* -Update docs

* -Update docs

* -Update docs

* -Update docs. WIP.

* -Update docs

* -Cleanup

* -Cleanup

* -Update docs.
-Remove DECL code from pointer types. Pointer types do not have DECL coords.

* -Add unit tests for artifacts

* -Cleanup

* -Update test_file1

* -Remove dead code

* -Update tests in Docker files

* -Update docs

* -Update docs

* -Update docs

* -Update unit tests

* -Fix Field constructors

* -Minimal testing for bitfields. WIP.

* -Update Docker files
-Update Makefile

* -Add Ubuntu18 to CI.
-Update docs

* -Update docs

* -Update docs

* -Update docs

* -Update docs

* -Update clang_format_all

* -Add format checks to Dockerfile.ubuntu20

* -Update clang_format_all

* -Format code

* -Cleanup

* -Add error-checking for groupNumber

* -Push coveralls report

* -Update docs

* -Update CI

---------

Co-authored-by: Mathew Benson <mbenson@windhoverlabs.com>
mbenson1 added a commit to WindhoverLabs/juicer that referenced this issue Nov 4, 2024
* -Write macro records correctly. Fixes #7

* -Cleanup

* -Update unit testing for draco patterns. WIP.

* -Update eclipse project

* -Minimally functional target_symbol

* -Do not store row id for symbol target updates

* -Update github CI

* -Docker config for CI

* -Point submodules to github

* -Cleanup

* -Add symbols and encoding mappings. WIP.

* -Add symbols and encoding mappings. WIP.

* Writer DWARF5 ecodings to encodings table

* -Add minimally functional encodings implementation.
-TODO:Cleanup.

* -Update Makefile

* -Update gitignore

* -Cleanup

* -Remove Ubuntu18 from github actions since it is not available anymore.
-https://github.blog/changelog/2022-08-09-github-actions-the-ubuntu-18-04-actions-runner-image-is-being-deprecated-and-will-be-removed-by-12-1-22/

* -Remove dead code

* -Cleanup

* -Cleanup

* -Cleanup

* -Include unit test code in format checks.
-Format unit test code.

* -Update unit tests

* -Configure coveralls.io for CI

* -Configure coveralls.io for CI

* -Configure coveralls.io for CI

* -Configure coveralls.io for CI

* -Configure coveralls.io for CI

* -Configure coveralls.io for CI

* -Configure coveralls.io for CI

* -Configure coveralls.io for CI

* -Update docs

* -Update unit tests for new schema. WIP.
-TODO:Add function to follow target symbols to test typdef'd types.
-TODO:Add unit tests for new macro and elf image features.

* -Add followTargetSymbol. Useful for testing typedef'd types.
-Update unit tests.

* -Use CFE_ES_HousekeepingTlm_Payload for unit testing.

* -Update docs

* -Update docs

* -Extract ELF image data from 64-bit targets properly.
-Add ElfClass to ElfFile

* -Update docs

* -Update unit-test test files

* -Remove libdwarf from unit test code test file

* -Remove dead code

* -Remove dead code

* -Add 32-bit make recipes.
-Add 32-bit unit tests.

* -Update 32-bit unit testing.

* -Update docs

* -Remove dead code

* -Update Logger unit tests
-Remove dead code

* -Update unit tests

* -Update docs

* -Cleanup

* -Cleanup

* -Cleanup

* -Add macro unit test.
-Update Dockerfile

* -Create test files that comply with DWARF4 and DWARF5. Allows us to verify support of DWARF4 as more features are added in the future.

* -Unit test DWARF4 and DWARF5. WIP.

* -Add DWARF4 testing to Dockerfile

* -Cleanup

* -Update docs

* -Update docs

* -Update Catch 2 due to issue on Ubuntu22:catchorg/Catch2#2178

* -pathIndex handling for DWARF5. TODO:This changes for DWARF4, so add alternative for DWARF4.
-Remove DisplayDie function for now as it blows up the stack with big c++ names inside DWARF.
-TODO:Rewrite DisplayDie function
-Add include to src/Artifact.h, needed for Ubuntu22.

* -Handle DWARF dbg source files for DWARF4 and 5.
-TODO:Figure out what to do about Ubuntu 20/22 behavior producing different DWARF src file line number info for the same DWARF version.

* -Add group number as CLI argument. WIP.
-Issues of interest:#36, #35

* -Group number argument. Useful for getting DWARF data from multiple COMBAT sections, like macros inside of unlinked ELF files.

* -Add unit tests for macros across multiple COMDAT groups.

* -Cleanup

* -Update docs

* -Update unit tests.

* -Update Dockerfile for Ubuntu22

* -Update CI

* -Update Dockerfiles for Ubuntu20 and Ubuntu22

* -Update Makefile

* -Update CI

* -Update CI

* -Test DWARF version in unit tests

* -Update docs

* -Update docs

* -Update docs

* -Update docs. WIP.

* -Update docs

* -Cleanup

* -Cleanup

* -Update docs.
-Remove DECL code from pointer types. Pointer types do not have DECL coords.

* -Add unit tests for artifacts

* -Cleanup

* -Update test_file1

* -Remove dead code

* -Update tests in Docker files

* -Update docs

* -Update docs

* -Update docs

* -Update unit tests

* -Add support for unions. WIP.

* -Add support for unions. WIP.

* -Update CI to build Ubuntu20 first.

* -Update CI to build Ubuntu20 first.

* -Format files

* -Update union object used for unit tests

* -Add user to docker dev configs

* -Add support for unions. WIP.
-Update unit tests for unions. WIP.

* -Minimally functional union support.
-TODO:Upgrade to C++17 and std::optional for union fields, which will be NULL (or empty).

* -Remove dead code

* -Upgrade to C++17.
-Use optional for byte offset of fields.
-When  byte offset value is empty, write NULL to db. This allows to make a distinction between unions and structs.
-TODO:Finish union unit testing.
-TODO:Add union support documentation.

* -Update docs

* -Remove duplicate recipes from Makefile

* -Handle default case in getdbgSourceFile

* -Update unit testing for union support

* -Update unit testing for union support

* -Update docs

* -Update docs

* -Use std::optional for symbol encoding

* -Add vscode config

* -Add tests for padding. Fixes #21

* -Give root access to dev docker user

* -Use std::optional for getdbgSourceFile

* -Do not attempt to add padding for unions.
-Add checks to padding function.

* -Add warning message when field byte offsets do not exist

* -Add warning message when field byte offsets do not exist

* -Use git tag and latest commit as version value

* -Log warning when there is no DW_AT_name attribute

---------

Co-authored-by: Mathew Benson <mbenson@windhoverlabs.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants