[Trilinos-Users] Building Trilinos with gcc 5.1

Brian Granzow brian.granzow at gmail.com
Tue Jun 2 10:44:09 EDT 2015

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

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

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.


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


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

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

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/9521a3c1/attachment.html>

More information about the Trilinos-Users mailing list