GDB kind of doesn't work on macOS Sierra

前端 未结 8 771
梦毁少年i
梦毁少年i 2020-12-02 07:55

It is a problem that appeared when I first updated to macOS Sierra yesterday.

GDB itself is running OK. However, somehow, it cannot run my program. When I type \'run

8条回答
  •  醉酒成梦
    2020-12-02 08:16

    I've been having multiple issues with Sierra.

    For starters my code that had worked on previous OSX versions has stopped working on this version. Nor would it compile.In addition GDB from brew is a complete mess. To add on that other 3rd party libraries got broken (e.g. libevent).

    ("Good job" Apple).

    After "upgrading" to Sierra I suggest the following steps to get GDB working:

    1. Install a newer gcc (Should take about 60 minutes - depending on your CPU etc...)

      brew install gcc

    2. Download the source code of GDB

    3. Since gcc and g++ are aliased to the old gcc and g++ make sure to link it to the newer gcc and g++ e.g.:

      export CC=`which gcc-6`

      export CXX=`which gxx-6`

    4. Configure & Compile gdb:

      ./configure

      make CFLAGS=-Wno-error=deprecated-declarations CXXFLAGS=-Wno-error=deprecated-declarations

      sudo make install

提交回复
热议问题