#44 Latest code fails to build with gcc-4.7

Rick R.

I'm getting a build error when trying to build the latest code base on Linux with gcc-4.7. The error occurs during 'make check-testsuite'. Here's the tail end of the make output:

g++ -DHAVE_CONFIG_H -I. -I.. -I.. -g -DBZ_DEBUG -DBZ_DEBUG -O3 -funroll-loops -fstrict-aliasing -fomit-frame-pointer -ffast-math -MT transpose.o -MD -MP -MF .deps/transpose.Tpo -c -o transpose.o transpose.cpp
In file included from transpose.cpp:3:0:
../random/discrete-uniform.h: In instantiation of ‘ranlib::DiscreteUniform<T, IRNG, stateTag>::DiscreteUniform(T) [with T = int; IRNG = ranlib::MersenneTwister; stateTag = ranlib::sharedState]’:
transpose.cpp:12:49: required from here
../random/discrete-uniform.h:48:9: error: ‘checkAssert’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
In file included from ../blitz/blitz.h:196:0,
from testsuite.h:10,
from transpose.cpp:1:
../blitz/bzdebug.h:80:15: note: ‘void blitz::checkAssert(bool, const char*, int)’ declared here, later in the translation unit

Has anyone else tried to compile with gcc-4.7?


  • Rick R.

    Rick R. - 2012-06-27

    If anybody's interested, the following patch fixes the compilation issue under gcc-4.7

    diff -r 927504bb5536 blitz/bzdebug.h
    --- a/blitz/bzdebug.h Tue Jun 26 17:33:54 2012 -0700
    +++ b/blitz/bzdebug.h Wed Jun 27 15:07:53 2012 -0700
    @@ -117,15 +117,15 @@ BZ_NAMESPACE(blitz)

    - #define BZASSERT(X) checkAssert(X, __FILE__, __LINE__)
    - #define BZPRECONDITION(X) checkAssert(X, __FILE__, __LINE__)
    - #define BZPOSTCONDITION(X) checkAssert(X, __FILE__, __LINE__)
    - #define BZSTATECHECK(X,Y) checkAssert(X == Y, __FILE__, __LINE__)
    + #define BZASSERT(X) blitz::checkAssert(X, __FILE__, __LINE__)
    + #define BZPRECONDITION(X) blitz::checkAssert(X, __FILE__, __LINE__)
    + #define BZPOSTCONDITION(X) blitz::checkAssert(X, __FILE__, __LINE__)
    + #define BZSTATECHECK(X,Y) blitz::checkAssert(X == Y, __FILE__, __LINE__)
    #define BZPRECHECK(X,Y) \ { \ if ((assertFailMode == false) && (!(X))) \ BZ_STD_SCOPE(cerr) << Y << BZ_STD_SCOPE(endl); \ - checkAssert(X, __FILE__, __LINE__); \ + blitz::checkAssert(X, __FILE__, __LINE__); \ }

    #define BZ_DEBUG_MESSAGE(X) \ @@ -138,7 +138,7 @@ BZ_NAMESPACE(blitz)

    #define BZ_DEBUG_PARAM(X) X
    - #define BZ_PRE_FAIL checkAssert(0)
    + #define BZ_PRE_FAIL blitz::checkAssert(0)

    #elif defined(BZ_DEBUG)

  • Sergio Pascual

    Sergio Pascual - 2012-06-28

    I've been hit by this also. Patch works AFAICS

  • walterjunjun

    walterjunjun - 2012-07-14

    Hi when I use fedora 17(with gcc-4-7) to run "make check-testsuite", I encounter the same error. Rick seems give codes on debug-mode of blitz++, while for my project, I need to use both debug and optimized verison of blitz++, can anyone give guideline on writting some patch files for the two versions.


  • Rick R.

    Rick R. - 2012-07-14

    I build both debug and release (optimized) versions on Fedora 17 with my patch and both work fine. Can you post the error message you're getting?


Log in to post a comment.