Why does linking with pthread cause a segmentation fault?

前端 未结 4 626
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-14 01:15

I have a stripped down simple program with a static variable (\'abc.cpp\'):

#include 

int main(int, char**)
{
  static const std::string a(\         


        
4条回答
  •  难免孤独
    2021-01-14 01:21

    The libstdc++6 package you have installed is not even in Ubuntu!

    ii  libstdc++6:amd64  5-20150329-1ubuntu11 amd64    GNU Standard C++ Library v3
    

    From packages.ubuntu.com:

    trusty (14.04LTS) (libs): GNU Standard C++ Library v3
        4.8.2-19ubuntu1: amd64 i386
    utopic (libs): GNU Standard C++ Library v3
        4.9.1-16ubuntu6: amd64 i386
    vivid (libs): GNU Standard C++ Library v3
        4.9.2-10ubuntu13: amd64 i386 
    

    I would recommend checking your /etc/apt/sources.list and removing the line that caused installation of the package. I think it may be ppa:ubuntu-toolchain-r/test, a PPA for "Toolchain test builds"...

    Then you can try to downgrade your libstdc++6 package to get back to a sane version (appropriate for the Ubuntu version you have installed). While you are at it, you should carefully check if other packages are affected as well. You don't want to run your system on test-builds of your core libraries.

    By the way, that also explains why gdb did not find the debug symbols, they were for another version of the library.

提交回复
热议问题