linux 64bit下与32bit库的链接 [英] Linking with 32bit libraries under linux 64bit

查看:41
本文介绍了linux 64bit下与32bit库的链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

让我解释一下.我将 网络机器人aldebaran SDK.我的操作系统是 Debian Squeeze amd64.Webots(64 位)不能与 aldebaran SDK 一起使用,因为它们的库是为 32 位编译的.我没有要在 64 位中重新编译的库源.尝试在 webots 下编译默认的 nao 控制器时,出现以下错误:

Let me explain. I'm using webots in combination with aldebaran SDK. My operating system is Debian Squeeze amd64. Webots (64bit) will not work with aldebaran SDK because their libraries are compiled for 32bit. I do not have the source of the libs to recompile in 64bit. While trying to compile the default nao controller under webots, i get the following error:

g++ -o naoqi_for_webots
naoqi_for_webots.o naoproxy.o-L"/usr/local/webots/lib" -lController -L"/home/alex/naoqi-sdk-1.10.44-linux/lib"-lnaoqiclient/usr/bin/ld: 跳过不兼容/home/vor73x/naoqi-sdk-1.10.44-linux/lib/libnaoqiclient.so搜索 -lnaoqiclient 时/usr/bin/ld: 找不到 -lnaoqiclient

g++ -o naoqi_for_webots
naoqi_for_webots.o naoproxy.o -L"/usr/local/webots/lib" -lController -L"/home/alex/naoqi-sdk-1.10.44-linux/lib" -lnaoqiclient /usr/bin/ld: skipping incompatible /home/vor73x/naoqi-sdk-1.10.44-linux/lib/libnaoqiclient.so when searching for -lnaoqiclient /usr/bin/ld: cannot find -lnaoqiclient

做一个

文件 libnaqoqiclient.so

file libnaqoqiclient.so

告诉我:

libnaoqiclient.so:ELF 32 位 LSB 共享对象,Intel 80386,版本 1 (SYSV),动态链接,未剥离

libnaoqiclient.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, not stripped

webots 中的默认项目有一个 Makefile,其中包括:

The default project in webots has a Makefile which among other things has:

其他库:LIBRARIES=-L"$(AL_DIR)/lib" -lnaoqiclient

additional libraries: LIBRARIES=-L"$(AL_DIR)/lib" -lnaoqiclient

我已经下载并安装了 32 位版本的 webots,它与 libnaoqiclient.so 链接良好,但不会与其他 webots 库 (libController.so) 链接,ld 再次抱怨类型不兼容.

I have downloaded and installed the 32bit version of webots, which links fine with the libnaoqiclient.so but will not link with other webots libraries (libController.so) where again, ld complains about incompatible type.

我可以使用 64 位网络机器人与 32 位 aldebaran sdk 进行链接吗?我可以使用 webots 32bit 与 32bit aldebaran 链接吗?(我应该,但我仍然收到错误).我如何向 ld (或通过 Makefile 甚至更好)指定库是 32bits ?或者在使用 webots 32bit 的情况下,我如何指定我想要一个 32bit 二进制文件?我不在乎我的二进制文件是 32 位还是 64 位,我不在乎我是使用 32 位还是 64 位版本的 webots,我只想能够编译控制器.

Can I link using webots 64bit with the 32bit aldebaran sdk ? Can I link using webots 32bit with the 32bit aldebaran ? (I should, but I still get errors). How can I specify to ld (or through Makefile even better) that the library is 32bits ? Or in the case of using webots 32bit how can I specify that I want a 32bit binary ? I do not care if my binary is 32 or 64bit, I do not care if I use the 32 or 64bit version of webots, all I want is to be able to compile the controllers.

推荐答案

好吧,您不能混合搭配 32 位和 64 位代码.如果您使用 -m32 编译所有代码(使其构建为 32 位),则您可以让您的应用程序链接如果您有 32 位所有可用库的版本.

Well, you can't mix and match 32-bit and 64-bit code. If you compile all your code using -m32 (to make it build as 32-bit), you may be able to get your application to link if you have 32-bit versions of all your libraries available.

这篇关于linux 64bit下与32bit库的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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