[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: NDEBUG and CMake



Hi Sébastien,

On Wed, Apr 25, 2018 at 12:32:28PM +0200, Sébastien Jodogne wrote:
> Dear all,
> 
> 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 [1].
> 
> However, the source code of the upstream Orthanc project makes many calls to
> the "assert()" function of the standard library [2], in order to help with
> the early tracking of bugs. All those assertions are extremely
> time-consuming, and 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 [3]. However,
> because packages of the Orthanc family are built using
> "-DCMAKE_BUILD_TYPE=None", 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? TIA!
> 
> Regards,
> Sébastien-
> 
> PS: I mistakenly sent this message yesterday to
> "debian-devel-announce@lists.debian.org". Please excuse my error.

:-)
You are lucky - this list takes only signed mails from DDs. :-)

However, the best idea is to send this mail rather to
debian-mentors@lists.debian.org (feel free to CC here) since your
chances to find some cmake experts are higher there (despite also
here are some lurking.

Sorry for not beeing more helpful myself

       Andreas.
 
 
> [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=711515#51
> [2] http://www.cplusplus.com/reference/cassert/assert/
> [3] https://stackoverflow.com/a/34314956/881731

-- 
http://fam-tille.de


Reply to: