bash 从 MacPorts Mavericks 安装时找不到 GDB 命令
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19931857/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
GDB command not found when installed from MacPorts Mavericks
提问by Jameo
I am trying to install GDB to work with LiteIDE, on Mavericks.
我正在尝试在 Mavericks 上安装 GDB 以与 LiteIDE 一起使用。
After some research, I found out that GDB does not come with Xcode anymore, and that you have to install it yourself. Short of actually installing GDB from source, and self code signing (id rather not do this), I would like to use MacPorts to get this done.
经过一番研究,我发现 GDB 不再与 Xcode 一起提供,您必须自己安装它。除了从源代码实际安装 GDB 和自我代码签名(id 而不是这样做)之外,我想使用 MacPorts 来完成这项工作。
I did port install gdb
, which ran and succeeded as far as I know. After the install, I closed terminal and then typed gdb
and I get -bash: gdb: command not found
我做到了port install gdb
,据我所知,它运行并成功了。安装后,我关闭终端,然后输入gdb
,我得到-bash: gdb: command not found
Does anyone have a solution for this, using MacPorts???
有没有人有解决方案,使用 MacPorts ???
回答by xryl669
You should use the command "ggdb" to start the MacPorts' build of gdb.
您应该使用命令“ggdb”来启动 MacPorts 的 gdb 构建。
I don't know why they have renamed it, probably a transient bug/change that will be fixed somehow, I suspect they wanted to avoid a collision with the alias "gdb" launching LLDB.
我不知道他们为什么要重命名它,可能是暂时的错误/更改会以某种方式修复,我怀疑他们想避免与启动 LLDB 的别名“gdb”发生冲突。
Edit: Reworded the answer to avoid ambiguities as reported by @trojanfoe
编辑:改写答案以避免@trojanfoe 报告的歧义
回答by Jameo
I finally figured it out, with some help from @xryl669. His tip that you have to use the command "ggdb" in order to access this port from macports, is correct. Also, however, I missed a command that displayed after the port installed:
在@xryl669 的帮助下,我终于弄明白了。他的提示是,您必须使用命令“ggdb”才能从 macports 访问此端口,这是正确的。但是,我也错过了安装端口后显示的命令:
You will need to make sure
/System/Library/LaunchDaemons/com.apple.taskgated.plist has the '-p' option,
e.g.
<key>ProgramArguments</key>
<array>
<string>/usr/libexec/taskgated</string>
<string>-sp</string>
</array>
To do this, type
为此,请键入
sudo nano /System/Library/LaunchDaemons/com.apple.taskgated.plist
And then add the "p" after -s. I don't really know what this does, but after this "ggdb" command started working for me
然后在 -s 后添加“p”。我真的不知道这是做什么的,但是在这个“ggdb”命令开始对我来说有效之后
Edit: Adding the p is recommended but simply using "ggdb" should do the trick
编辑:建议添加 p,但只需使用“ggdb”即可解决问题
回答by Michal Misiaszek
I spent some time and figured it out with help of great documentation.
1. Install ggdb using MacPorts: sudo port install gdb
, the file will be /opt/local/bin/ggdb.
2. Follow tutorial https://www.ics.uci.edu/~pattis/common/handouts/macmingweclipse/allexperimental/mac-gdb-install.htmland it works.
我花了一些时间并在很棒的文档的帮助下弄清楚了。1. 使用 MacPorts 安装 ggdb:,sudo port install gdb
文件将是 /opt/local/bin/ggdb。2. 按照教程https://www.ics.uci.edu/~pattis/common/handouts/macmingweclipse/allexperimental/mac-gdb-install.html 进行操作。
I spent number of days and many various tutorials, this one actually works ! Good luck.
我花了很多天和许多不同的教程,这个确实有效!祝你好运。
回答by Digital Trauma
I don't have Mavericks yet, but since Xcode 4.3, the command-line tools are optional: https://developer.apple.com/library/ios/documentation/DeveloperTools/Conceptual/WhatsNewXcode/Articles/xcode_4_3.html"The command-line tools are not bundled with Xcode 4.3 by default. Instead, they can be installed optionally using the Components tab of the Downloads preferences panel.".
我没有小牛队还没有,但因为Xcode的4.3,命令行工具可选:https://developer.apple.com/library/ios/documentation/DeveloperTools/Conceptual/WhatsNewXcode/Articles/xcode_4_3.html “的默认情况下,命令行工具未与 Xcode 4.3 捆绑在一起。相反,可以使用“下载”首选项面板的“组件”选项卡选择安装它们。” .
I have Xcode 5.0.1 on OSX 10.8.5 and gdb is definitely there after doing the optional command-line tools install:
我在 OSX 10.8.5 上有 Xcode 5.0.1,并且在安装了可选的命令行工具后,gdb 肯定在那里:
$ which -a gdb /usr/bin/gdb $ gdb --version GNU gdb 6.3.50-20050815 (Apple version gdb-1824) (Wed Feb 6 22:51:23 UTC 2013) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "x86_64-apple-darwin". $