GLIBCXX_3.4.21 is not defined in the libstdc ++ file. So.6 with link time reference

Sorry, I understand that questions very similar to this have been asked relatively frequently, although none of the solutions seem to work for me. When I try to run any C ++ code with reasonable complexity, I get the above error. Full error message:

/main: relocation error: ./main: symbol _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1Ev, version GLIBCXX_3.4.21 not defined in file libstdc++.so.6 with link time reference 

starting another project, I get a very similar error:

 ./main: relocation error: ./main: symbol _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1Ev, version GLIBCXX_3.4.21 not defined in file libstdc++.so.6 with link time reference 

I actually have no problems with compilation, as these projects compile fine. This happens when I try to run an executable. I thought this was a mistake with my gcc installation, so today I reinstalled it, although that didn't help at all. I really don't know what to do to fix this, can anyone offer help?

This is the Makefile that I use to compile one of the projects, I feel it might be a bug:

 CC= g++ CFLAGS= -Wall -g -std=c++11 -lX11 -lpthread OBJS = main.o Board_Tile.o Sliding_Solver.o main: $(OBJS) $(CC) -o $@ $(OBJS) %.o : %.cc $(CC) $(CFLAGS) -c $^ 

My version of gcc is 5.3.0, I am running Ubuntu 14.0.4.

+7
source share
2 answers

GCC 5.1 or 5.2 (now I donโ€™t remember google it) changed C ++ ABI. Your standard ubuntu (including libstdc ++) compiled with the old ABI.

Your gcc compiler is trying to use the new ABI. Sometimes it works, most of the time it doesnโ€™t.

So, there are 3 ways to compile your code:

1) downgrade gcc

2) add -D_GLIBCXX_USE_CXX11_ABI = 0 (cmake example) (if you go this way, you must add this flag to every make file or project that you create before you upgrade ubuntu or lower the gcc level)

3) update Ubuntu (tested it, by the way, 04.16 comes with a new ABI and a new gcc by default, I had to use the ack-grep flag and remove the flag mentioned above from all my pet projects)

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

PS is funny, the answer to the question is: _ZNSt7__cxx11 : CXX11 , although we really do not read error messages.

+16
source

before_install:

This workaround is necessary to avoid libstdc ++ errors when running the "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

0
source

Source: https://habr.com/ru/post/1247788/


All Articles