安装在32位系统的64位glib2进行交叉编译 [英] install 64-bit glib2 on 32-bit system for cross-compiling

查看:696
本文介绍了安装在32位系统的64位glib2进行交叉编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想交叉编译在32位的Ubuntu系统,64位可执行文件。这工作直到链接,在那里它没有由于缺少一个64位glib2(libglib-2.0.a)的

I'm trying to cross-compile a 64-bit executable on a 32-bit ubuntu system. This works up until linking, where it fails due to the lack of a 64-bit glib2 (libglib-2.0.a).

如果我是在64位系统上这样做,我会用 getlibs 安装32位glib2到/ usr / LIB32。然而,在32位机getlibs似乎并没有做opposite--安装64位glib2到/ usr / lib64下。

If I were doing this on a 64-bit system, I would use getlibs to install a 32-bit glib2 into /usr/lib32. However, on a 32-bit machine getlibs doesn't seem to do the opposite-- install a 64-bit glib2 into /usr/lib64.

我的quesiton是:我怎么手工做getlibs应该做的,就是安装64位glib2到/ usr / lib64下

My quesiton is: how do I manually do what getlibs should do, that is, install a 64-bit glib2 into /usr/lib64?

推荐答案

有一对夫妇的要对这个办法。最直接的就是下载自带的目标库,你需要一个工具链。鉴于这是最有可能不会发生的,下面就来解决这个问题的方法之一。

There a couple of ways of going about this. The most straight-forward is to download a toolchain that comes with target libraries you need. Given that this is most likely not going to happen, here's one way to solve this problem.

我会假设你正在使用的 GCC 作为您的交叉编译器。

I'm going to assume that you're using gcc as your cross-compiler.

  1. 复制了所有的图书馆,你需要在目标系统形成的一些文件夹
  2. 在你的Makefile(或命令行)设置CFLAGS(和CXXFLAGS如果C ++)于以下内容:

  1. Copy over all the libraries that you'll need form the target system to some folder
  2. In your Makefile (or command line) set CFLAGS (and CXXFLAGS if C++) to the following:

-L /路径/到/目标/库-Wl,-rpath链接/同/路径/为/第一

-L /path/to/target/libs -Wl,-rpath-link /same/path/as/first

需要注意的是-Wl,-rpath和链路没有一个空格他们之间,它必须是这个样子。

Note that -Wl, and -rpath-link do not have a space between them, it has to be this way.

-L 增加了对编译器看库路径。第二个参数, -Wl,-rpath链接添加了对连接器的路径。你必须有两个,否则编译器将解决符号但链接器会抱怨它没有图书馆链接nagainst。

-L adds library path for the compiler to look at. The second argument, -Wl,-rpath-link adds the path for the linker. You have to have both, otherwise the compiler will resolve the symbols but the linker will whine that it doesn't have the library to link nagainst.

这篇关于安装在32位系统的64位glib2进行交叉编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆