Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Shane_S_1
Beginner
187 Views

Compiling NCBI BLAST 2.7.1 -- error #3377: constexpr function return is non-constant

Jump to solution

Hi,

I've been trying to compile the NCBI BLAST toolkit 2.7.1 release in CentOS 7.5 using the 2017 (17.0.2 20170213) version of the Parallel Studio. I keep getting the following error when compiling:

ncbi-blast-2.7.1+-src/c++/include/corelib/ncbifloat.h(78): error #3377: constexpr function return is non-constant
      inline ISNAN_CONSTEXPR bool bool_isnan(double x)      { return isnan(x); }
                                                                     ^

I haven't seen this problem compiling an older version of BLAST (2.2.31). I can compile the toolkit with GCC 6.3.0.

I put the code of the offending header file below.

Has anyone seen a similar problem, or know what I can do to fix the compilation?

Thank you!

#ifndef CORELIB___NCBIFLOAT__H
#define CORELIB___NCBIFLOAT__H

/*  $Id: ncbifloat.h 453541 2014-12-04 14:58:29Z ucko $
 * ===========================================================================
 *
 *                            PUBLIC DOMAIN NOTICE
 *               National Center for Biotechnology Information
 *
 *  This software/database is a "United States Government Work" under the
 *  terms of the United States Copyright Act.  It was written as part of
 *  the author's official duties as a United States Government employee and
 *  thus cannot be copyrighted.  This software/database is freely available
 *  to the public for use. The National Library of Medicine and the U.S.
 *  Government have not placed any restriction on its use or reproduction.
 *
 *  Although all reasonable efforts have been taken to ensure the accuracy
 *  and reliability of the software and data, the NLM and the U.S.
 *  Government do not and cannot warrant the performance or results that
 *  may be obtained by using this software or data. The NLM and the U.S.
 *  Government disclaim all warranties, express or implied, including
 *  warranties of performance, merchantability or fitness for any particular
 *  purpose.
 *
 *  Please cite the author in any work or product based on this material.
 *
 * ===========================================================================
 *
 * Author:  Andrei Gourianov
 *
 *
 */

/**
 * @file ncbifloat.h
*
 * Floating-point support routines.
 *
 */

/** @addtogroup Exception
 *
 * @{
 */


#include <ncbiconf.h>

#if defined(NCBI_OS_MSWIN)
#   include <float.h>
#elif defined(HAVE_IEEEFP_H)
#   if defined(NCBI_OS_CYGWIN) && defined(__cplusplus)
/* At least some versions of Cygwin's ieeefp.h fail to use extern "C",
 * requiring us to. :-/ */
extern "C" {
#      include <ieeefp.h>
}
#   else
#      include <ieeefp.h>
#   endif
#endif

#if defined(NCBI_HAVE_CXX11)  && \
    (!defined(__GLIBCXX__)  ||  defined(_GLIBCXX_USE_C99_MATH))
// Kludge to avoid formal ambiguity in C++ '11 between ::isnan, which
// returns int, and std::isnan, which returns bool.
#  include <cmath>
#  ifdef isnan
#    undef isnan
#  endif
#  if __cplusplus >= 201103L  &&  defined(_GLIBCXX_CONSTEXPR)  \
    &&  !defined(__MIC__)
#    define ISNAN_CONSTEXPR _GLIBCXX_CONSTEXPR
#  else
#    define ISNAN_CONSTEXPR
#  endif
namespace std {
    inline ISNAN_CONSTEXPR bool bool_isnan(float x)       { return isnan(x); }
    inline ISNAN_CONSTEXPR bool bool_isnan(double x)      { return isnan(x); }
    inline ISNAN_CONSTEXPR bool bool_isnan(long double x) { return isnan(x); }
}
// Unbreak <boost/math/special_functions/fpclassify.hpp>.
namespace boost {
    namespace math_detail {
        using std::bool_isnan;
    }
}
#  define isnan bool_isnan
#elif defined(NCBI_OS_DARWIN)
  include <cmath>
#endif

#if defined(NCBI_OS_MSWIN)  &&  !defined(isnan)
/**
 * Define value of isnan (Is Not A Number).
 *
 * Checks double-precision value for not a number (NaN).
 */
#   define isnan _isnan
#endif

#if defined(NCBI_OS_MSWIN)
/**
 * Define value of finite (Is Finite).
 *
 * Checks whether given double-precision floating point value is finite
 */
   define finite _finite
#elif defined(NCBI_OS_DARWIN)
/**
 * Define value of finite (Is Finite).
 *
 * Checks whether given double-precision floating point value is finite
 */
#   ifdef finite
#     undef finite
#   endif
#   define finite isfinite
#endif


#endif  /* CORELIB___NCBIFLOAT__H */


/* @} */

 

0 Kudos
1 Solution
Viet_H_Intel
Moderator
187 Views

You can disable the error by adding -ww3377 to your command line options.

View solution in original post

2 Replies
Viet_H_Intel
Moderator
188 Views

You can disable the error by adding -ww3377 to your command line options.

View solution in original post

Shane_S_1
Beginner
187 Views

Thank you, Viet. That fixed the problem!

Reply