[Trilinos-Users] [EXTERNAL] Building Trilinos with gcc 5.1

Bradley, Andrew Michael ambradl at sandia.gov
Tue Jun 2 12:11:28 EDT 2015


Hi Brian,


Thanks for that detailed report. I verified the bug and the fix. I'm going to enter this information in Trilinos's bugzilla database.


Cheers,

Andrew


________________________________
From: Trilinos-Users <trilinos-users-bounces at trilinos.org> on behalf of Brian Granzow <brian.granzow at gmail.com>
Sent: Tuesday, June 2, 2015 8:44 AM
To: trilinos-users at trilinos.org
Subject: [EXTERNAL] [Trilinos-Users] Building Trilinos with gcc 5.1

I received the following error at link time while trying to build Albany using a shared library version of publicTrilinos that was built with gcc 5.1 compilers (publicTrilinos git hash 5d63251dd75776deb571d995114b89fb8094230f):

[100%] Built target LCM
Linking CXX executable AlbanyT
libstk_util_diag.so.12.1: undefined reference to `_ZN6sierra8demangleB5cxx11EPKc'

Running the command

nm -gC libstk_util_diag.so.12.1

on the library yielded the following relevant output

                  U _ZN6sierra8demangleB5cxx11EPKc

GCC uses a predefined preprocessor macro (see below) that defines __GNUC__ == 5.

https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html#Common-Predefined-Macros

This results in no symbol definition for the method 'demangle' in the file

publicTrilinos/src/packages/stk/stk_util/stk_util/diag/StringUtil.cpp

The reason is the following: on line 300 of StringUtil.cpp begins a block of code in which 'demangle' is defined. It is structured:

#ifdef SIERRA_USE_PLATFORM_DEMANGLER
#if defined(__GNUC__)
#if (__GNUC__ == 3)
#elif(__GNUC__ == 4)
#endif  // ends __GNUC__ == 3
#else // begins ifndef __GNUC__
#endif
#else // begins ifndef SIERRA_USE_PLATFORM_DEMANGLER
#endif

If __GNUC__ is defined, then only two options are present: __GNUC__ == 3 or __GNUC__ == 4. Thus with gcc 5.1 compilers, when __GNUC__ == 5, 'demangle' is never defined.

As a quick fix, I changed the following two lines of StringUtil.cpp

line 43:

#if __GNUC__ == 3 || __GNUC__ == 4 || __GNUC__ === 5

line 328:

#elif (__GNUC__ == 4 || __GNUC__ == 5)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://trilinos.org/pipermail/trilinos-users/attachments/20150602/f48a6fdb/attachment.html>


More information about the Trilinos-Users mailing list