简体   繁体   中英

Mac OS X Yosemite C++ Eclipse error: “Error while launching command: gdb --version”

I am following a C++ Eclipse tutorial and learning how to debug. I filled in the sections of the Debug Configurations window as it said in the tutorial and clicked 'Debug'. I get the error "Error while launching command: gdb --version". I found a similar post here: Mac C++/eclipse cannot debug: Error while launching command: gdb --version

and there the user said he already had GDB installed. I tried to install it using the instructions at this link: http://www.patosai.com/blog/post/installing-gdb-on-mac-os-x-yosemite

and when I entered the first command "brew install gdb" I got the following in my terminal:

Error: No available formula for gdb

==> Searching formulae...

cgdb gdbm pgdbf

==> Searching taps...

homebrew/dupes/gdb Caskroom/cask/macgdbp

I think there may have been a problem there because when I entered the final command of the "Installing GDB on Mac OS X Yosemite" tutorial above: "codesign -s gdb-cert /usr/local/bin/gdb" it said "no such file or directory.

Can anyone see where I've made an error please? Thanks :)

Seems like brew was unable to find gdb in its default search location. The line 'Searching Taps...' means that brew is searching other git repositories for the software you are trying to install.

In this case it found two repositories that contain something useful.

homebrew/dupes/gdb and Caskroom/cask/macgdbp

homebrew/dupes/gdb would be the one you need as this is the gdb version apple used for xcode before it switched to other tools.

This site has a really good tutorial for installing gdb using either brew or macports http://ntraft.com/installing-gdb-on-os-x-mavericks/

I used this command to try to install gdb.

brew install homebrew/dupes/gdb

this should produce the following output

Installing gdb from homebrew/homebrew-dupes
Downloading http://ftpmirror.gnu.org/gdb/gdb-7.9.1.tar.xz

./configure --prefix=/usr/local/Cellar/gdb/7.9.1 --with-system-readline --with-lzma --with-python=/usr
make
config.status: creating Makefile
config.status: creating testsuite/Makefile
config.status: creating config.h
config.status: executing default commands**strong text**
make: *** [all] Error 2

The installation process failed on my macbook. This was most likely due to me using the os x 10.11 beta. But it might also be because the gdb version on brew does not work well with yosemite and higher. If this is the case you could try the macports install using the above tutorial.

I can't currently use macports because my os x version. but if you are using yosemite it should be fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM