GLIBCXX_3.4.21 not defined in file libstdc++.so.6 with link time reference

GCC 5.1 or 5.2 (can't remember now, google it) changed C++ ABI. Your standard ubuntu (including libstdc++) is compiled with old ABI.

Your gcc compiler tries to use new ABI. Sometimes it works, most of the time - no.

So, there are 3 ways to compile your code:

1) downgrade gcc

2) add -D_GLIBCXX_USE_CXX11_ABI=0 (cmake example) flag (if you go this way, you should add this flag to every makefile or project you build till you upgrade ubuntu or downgrade gcc)

3) upgrade Ubuntu (tested it, by the way 16.04 goes with new ABI and new gcc by default, I had to ack-grep and remove flag mentioned above from all my pet projects)

also: Understanding GCC 5's _GLIBCXX_USE_CXX11_ABI or the new ABI

P.S. funny thing, the answer is in the question: _ZNSt7__cxx11 : CXX11, though we don't really read error messages.


before_install:

This workaround is required to avoid libstdc++ errors while running "extended" hugo with SASS support.

  • wget -q -O libstdc++6 http://security.ubuntu.com/ubuntu/pool/main/g/gcc-5/libstdc++6_5.4.0-6ubuntu1~16.04.10_amd64.deb
  • sudo dpkg --force-all -i libstdc++6

    install:

  • wget -q -O hugo.deb https://github.com/gohugoio/hugo/releases/download/v0.46/hugo_extended_0.46_Linux_64bit.deb

  • sudo dpkg -i hugo.deb

I found this answer here, and it worked for me