首页 > 解决方案 > 如何从另一个目录安装 GDB?

问题描述

我正在尝试在我的机器上安装 GDB,但在运行 ./configure 时出现此错误:

configure: error: GDB must be configured and built in a directory separate from its sources.

To do so, create a dedicated directory for your GDB build and invoke
the configure script from that directory:

      $ mkdir build
      $ cd build
      $ <full path to your sources>/gdb-VERSION/configure [etc...]
      $ make

于是我创建了一个新目录:/Users/SomeName/SomePath/gdb

我尝试运行以下命令:

./Users/SomeName/SomePath/gdb/configure

但这也不起作用,我收到一个错误:

-bash: ./Users/SomeName/SomePath/gdb/configure: No such file or directory

如何从另一个文件夹运行 C 程序?我第一次遇到这个问题。提前致谢!

标签: c

解决方案


假设您已将 gdb 源存储在/home/SomeName/gdb-sources并希望在单独的文件夹中构建 gdb,就像/home/SomeName/gdb-build您需要更改并从内部gdb-build调用configure脚本一样。gdb-sourcesgdb-build

完整示例:

mkdir /home/SomeName/gdb-build
cd /home/SomeName/gdb-build
/home/SomeName/gdb-sources/configure 
make -j

推荐阅读