Dear Debian mentors,
I write this message as the maintainer of the Debian packages of the
Orthanc project [1].
The Debian packages for Orthanc and its associated plugins pay attention
to the fact of *not* setting "-DCMAKE_BUILD_TYPE=Release", as requested
by the Debian policy [2].
However, the source code of the upstream Orthanc project makes many
calls to the "assert()" function of the standard library [3], in order
to help with the early tracking of bugs. Because those assertions are
extremely time-consuming, they should only be enabled in debug builds.
The assertions can be disabled by defining the macro "NDEBUG" while
compiling the software. Invoking CMake with "-DCMAKE_BUILD_TYPE=Release"
would make "NDEBUG" defined, at least for gcc and clang [4]. However,
because packages of the Orthanc family are built using
"-DCMAKE_BUILD_TYPE=None", "NDEBUG" is left undefined, and the Orthanc
log warns about bad performance:
$ sudo apt-get install orthanc
$ head /var/log/orthanc/Orthanc.log
W0424 13:01:40.158634 main.cpp:1298] Orthanc version: 1.3.2
W0424 13:01:40.158696 main.cpp:1146] Performance warning: Non-release
build, runtime debug assertions are turned on
I have not been able to find a definite answer about how "NDEBUG" should
be properly handled. I am considering to add the following arguments
wile invoking CMake in debian/rules in order to have "NDEBUG" manually
defined:
cmake -DCMAKE_C_FLAGS=-DNDEBUG -DCMAKE_CXX_FLAGS=-DNDEBUG [...]
Please someone could validate this approach wrt. Debian policy? TIA!
Regards,
Sébastien-
PS: For sake of completeness, this question was first asked on the
Debian Med mailing list, and Andreas Tille recommended me to forward it
to the Debian mentors [5].
[1] https://tracker.debian.org/pkg/orthanc
[2] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=711515#51
[3] http://www.cplusplus.com/reference/cassert/assert/
[4] https://stackoverflow.com/a/34314956/881731
[5] https://lists.debian.org/debian-med/2018/04/msg00125.html