thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James E. King, III (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (THRIFT-4163) The debian package / autoconf build environment is not setting NDEBUG on production builds, leaving assertions active
Date Mon, 03 Apr 2017 18:44:42 GMT

    [ https://issues.apache.org/jira/browse/THRIFT-4163?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15953982#comment-15953982
] 

James E. King, III commented on THRIFT-4163:
--------------------------------------------

To fix this I am pulling in an autoconf module to enable/disable debug and modified it a little.
https://www.gnu.org/software/autoconf-archive/ax_check_enable_debug.html

The syntax will be as follows:

||{{./configure --enable-debug=}}||Compiler Options Used||Default?||
|{{yes}}|{{-g -O0}}| |
|{{info}}|{{-g -O2}}|yes|
|{{profile}}|{{-g -O0 -pg}}| |
|{{no}}|{{-O2}}| |

{noformat}
$ ./configure | grep debugging
checking whether to enable debugging... no just optimize
$ ./configure --enable-debug=yes | grep debugging
checking whether to enable debugging... yes without any optimization
$ ./configure --enable-debug=no | grep debugging
checking whether to enable debugging... no just optimize
{noformat}



> The debian package / autoconf build environment is not setting NDEBUG on production builds,
leaving assertions active
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-4163
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4163
>             Project: Thrift
>          Issue Type: Bug
>          Components: Build Process
>    Affects Versions: 0.10.0
>            Reporter: James E. King, III
>            Assignee: James E. King, III
>            Priority: Critical
>
> In a project that uses thrift I was looking at a core and found an assertion inside thrift
triggered it.  This was rather strange being in a release build of thrift.
> To understand if assertions are active in release builds, I modified PlatformSocket.h
and added this close to the top:
> {noformat}
> #ifdef NDEBUG
> #error "NDEBUG IS SET: ASSERTIONS ARE IGNORED"
> #else
> #error "NDEBUG IS NOT SET: ASSERTIONS ARE ACTIVE"
> #endif
> {noformat}
> Then I built the ubuntu dockerfile and started a debian package distribution build:
> {noformat}
> # docker build -t thrift build/docker/ubuntu
> # docker run -v $(pwd):/thrift/src -it thrift /bin/bash
> # dpkg-buildpackage -d -tc 2>&1 | grep NDEBUG
> ./src/thrift/transport/PlatformSocket.h:25:2: error: #error "NDEBUG IS NOT SET: ASSERTIONS
ARE ACTIVE"
>  #error "NDEBUG IS NOT SET: ASSERTIONS ARE ACTIVE"
> {noformat}
> Assertions should not be active in release builds.
> Assertions really shouldn't be used; exceptions are much better for C++.  That's covered
in THRIFT-3978 however.  To fix this issue, the autoconf system needs to set NDEBUG for release
builds.
> I checked the cmake build environment and it does not suffer from this issue.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message