使用 G++ 构建在 RedHat 版 Ubuntu 上

发布于 2024-12-20 02:54:51 字数 52 浏览 1 评论 0原文

在 Ubuntu 上构建并使用 GCC 时,有什么方法可以链接到 RedHat 静态库吗?

Is there any way to link against RedHat static libraries while building on Ubuntu and using GCC?

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

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

发布评论

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

评论(2

请别遗忘我 2024-12-27 02:54:51

将 RedHat 库和头文件复制到保留目录结构的目录,并为 GCC 提供 --sysroot 指令,告诉它在该目录中查找作为搜索库和头文件的前缀

Copy over the RedHat library and header files to a directory preserving directory structure and give GCC the --sysroot directive to tell it to look in that directory as prefix for searching libs and headers

疑心病 2024-12-27 02:54:51

我看到两个明显的解决方案:

  1. 将 /usr/lib、/lib 和 /usr/include 从 Red Hat 系统复制到子树中,并将 -I 和 -L 指向该子树。
  2. 将最小化的 RedHat 安装到 chroot 中并在那里进行编译。

第一个解决方案是最简单的,但您可能会遇到 libc 版本问题。第二种解决方案保证可以工作,但离运行完整的 RedHat 进行编译不远了。

I see two obvious solutions:

  1. Copy /usr/lib, /lib and /usr/include from a Red Hat system into a subtree and point -I and -L to this subtree.
  2. Install a minimal RedHat into a chroot and compile there.

The first solution is the easiest, but you might run into libc version issues. The second solution is guaranteed to work, but not far from running a complete RedHat for compilation.

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