如何使用 eclipse 调试 libtool 生成的脚本?

发布于 2024-12-16 13:28:19 字数 265 浏览 2 评论 0原文

我有一个使用 libtool 构建的大型 C++ 项目。问题是 eclipse 不会运行 libtool 生成的脚本,并且我收到“程序不是可识别的可执行文件”。错误信息。如何使用 Eclipse 调试器?我目前正在使用 kdevelop3 作为编辑器并使用洞察力进行调试..这太可怕了。

我也许可以运行实际的可执行文件,它位于项目目录的 ./libs 中,但随后我必须手动设置 LD_LIBRARY_PATH 之类的东西......必须有更好的方法来做到这一点。

任何帮助将不胜感激!

I have a large c++ project built with libtool. the problem is that eclipse will not run a libtool generated script, and I get a "Program is not a recognized executable." error message. how can I use eclipse debugger? I'm currently using kdevelop3 as an editor and debugging with insight.. which is horrible.

I could perhaps run the actual executable, thats in the ./libs of the project directory, but then I would have to manually set LD_LIBRARY_PATH and stuff like that... there must be a better way to so this.

any help would be appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

难忘№最初的完美 2024-12-23 13:28:19

Eclipse 中仍然不支持运行脚本而不是可执行文件,请参阅此错误。在引入该功能之前,您无法在 Eclipse 下调试启用 libtool 的项目,除非您保留类似

    path/to/configure --disable-shared

单独配置的内容,因此仅依靠静态链接来进行调试。

为此,您

  1. 从顶部菜单中打开Project|Properties

  2. 选择Autotools |从窗口左侧菜单中配置设置

  3. (可选)使用专用C/C++ Build|Builder设置|构建位置

  4. configure|Advanced 下,用 --disable-shared 填写“附加命令行选项”

Running a script instead of an executable is still unsupported in Eclipse, see this bug. Until the feature is introduced, you cannot debug a libtool-enabled project under Eclipse unless you keep something like a

    path/to/configure --disable-shared

separate configuration, thus relying on static linking only for debugging purposes.

To do that, you

  1. Open Project|Properties from the top menu

  2. Select Autotools|Configure Settings from the left menu of the window

  3. (Optionally) Create a new build configuration with a dedicated C/C++ Build|Builder Settings|Build location

  4. Under configure|Advanced, fill the "Additional command-line options" with --disable-shared

最终幸福 2024-12-23 13:28:19

您可以通过运行实际的可执行文件而不是 libtool 脚本来解决这个问题。可执行文件通常可以在 .libs/ 中找到。因此,在主选项卡上的调试配置中,将 C/C++ Application 的值设置为 .libs/my_application 之类的值。然后,您只需在调试配置中更新 LD_LIBRARY_PATH 即可。

转到调试配置的环境选项卡并创建一个名为 LD_LIBRARY_PATH 的新环境变量。您需要将 .libs 目录附加到路径中。因此,该值应如下所示: ${project_loc}/.libs:$LD_LIBRARY_PATH 假设您的 .libs 文件夹位于项目目录内。

You can work around it by running the actual executable instead of the libtool script. The executable will generally be found in .libs/. So in your debug configuration on the main tab set the value of C/C++ Application to something like .libs/my_application. Then all you'll need to do us update LD_LIBRARY_PATH within your debug configuration.

Go to the environment tab of your debug configuration and make a new environment variable called LD_LIBRARY_PATH. You'll want to append the .libs directory to the path. So the value should look like this: ${project_loc}/.libs:$LD_LIBRARY_PATH assuming your .libs folder is right inside of the project directory.

人间不值得 2024-12-23 13:28:19

我认为可以编写一个小包装程序来插入“sh libtool --modeexecute”的 exec 来运行 gdb。将其命名为“gdb-libtool”并调用它而不是 gdb。

我在 Windows 和 Linux 下进行开发,所以这是我自己需要的东西。

有一些棘手的地方,比如在 libtool 和 gdb 调用中获取正确的路径.. 去采取行动。

干杯,杰瑞。

I think one could write a little wrapper program to interpose an exec of 'sh libtool --mode execute' to run gdb. Call it 'gdb-libtool' and invoke that instead of gdb.

I am developing under both Windows and Linux so it's something I need for myself.

There are a few tricky bits, like getting the paths right at libtool and gdb invocation.. off to take a swat at that.

Cheers, Jerry.

场罚期间 2024-12-23 13:28:19

对于第一点,您可以通过将 -no-install 添加到 Makefile.am 中的 LDFLAGS 来禁用中间 libtool 脚本,或者您可以只运行make install 并从安装的二进制文件中进行调试。

对于第二点,您必须在启动 Eclipse 之前设置并导出您的 LD_LIBRARY_PATH。

For the first point, you can disable intermediate libtool script by adding -no-install to LDFLAGS in your Makefile.am OR you can just run make install and debug from installed binary.

For the second point, you'll have to set and export your LD_LIBRARY_PATH before launching eclipse.

薆情海 2024-12-23 13:28:19

您需要说服 eclipse 像这样启动 gdb:

$ libtool --mode=execute gdb <your-program>

请参阅 https:// /www.gnu.org/s/libtool/manual/html_node/Debugging-executables.html

You need to convince eclipse to start gdb like this:

$ libtool --mode=execute gdb <your-program>

See https://www.gnu.org/s/libtool/manual/html_node/Debugging-executables.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文