Skip to content

Many roottest tests fail if you build ROOT with -DNDEBUG in CXXFLAGS #16981

@amadio

Description

@amadio

Check duplicate issues.

  • Checked for duplicates

Description

Example test failure output from roottest:

-- BEGIN OUTDIFF OUTPUT --
--- /srv/root/src/roottest/root/aclic/load/execautoload.ref	Tue Mar 17 09:11:36 2020
+++ /srv/root/roottest_build/root/aclic/load/autoload.log	Tue Nov 19 16:37:44 2024
@@ -1 +1,7 @@
 
+ROOT_cli_0:1:9: warning: 'NDEBUG' macro redefined [-Wmacro-redefined]
+#define NDEBUG
+        ^
+<command line>:5:9: note: previous definition is here
+#define NDEBUG 1
+        ^

-- END OUTDIFF OUTPUT --
CMake Error at /usr/lib64/cmake/ROOT/RootTestDriver.cmake:259 (message):
  compare 'stdout' error: 1

Reproducer

Build ROOT with -DNDEBUG added to CXXFLAGS, build roottest against it and run the tests.

ROOT version

   ------------------------------------------------------------------
  | Welcome to ROOT 6.32.08                        https://root.cern |
  | (c) 1995-2024, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for linuxx8664gcc on Nov 19 2024, 13:10:09                 |
  | From tags/6-32-08@6-32-08                                        |
  | With                                                             |
  | Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q'  |
   ------------------------------------------------------------------

Installation method

emerge

Operating system

Gentoo Linux

Additional context

I installed ROOT in the system, built with CXXFLAGS=-O2 -g -DNDEBUG -fno-omit-frame-pointer -pipe, then built and ran roottest tests against it, result is:

51% tests passed, 547 tests failed out of 1117

Almost all of them due to the macro redefinition.

Maybe replacing #define NDEBUG with

#ifndef NDEBUG
#define NDEBUG
#endif

everywhere might fix it. However, LLVM does add -UNDEBUG in their compilation, so it might not be so simple.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions