在编译时跳过不兼容的库 [英] Skipping Incompatible Libraries at compile

查看:34
本文介绍了在编译时跳过不兼容的库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在本地机器上编译我的项目的副本时,我收到一条错误消息,指出它正在跳过不兼容的库.当我在工作中使用托管在服务器上的实时版本时,情况并非如此[它完美地存在].

When I try to compile a copy of my project on my local machine, I get an error stating that it 's skipping over incompatible libraries. This isn't the case when I'm messing around with the live version hosted on the server at work [it makes perfectly there].

其他各种网站让我相信这可能是环境问题,因为我正在 64 位 Ubuntu 发行版上进行开发,并且我假设服务器版本在 32 位上运行.尽管如此,在将我的环境变量设置为:

Various other sites have lead me to believe that this might be an environment issue, as I'm developing on a 64-bit distro of Ubuntu and I assume the server version is running on 32-bit. Nevertheless, after setting my environment variables to:

CFLAGS+=" -m32"
CXXFLAGS+=" -m32"

我仍然收到相同的编译错误:

I still receive the same compile error of:

/usr/bin/ld: skipping incompatible /dvlpmnt/libPI-Http.a when searching for -lPI-Http

可以进行 haz 教程吗?

Can haz tutorial?

==编辑==

这是我听从乔纳森的建议后收到的输出:

This was the output I recieved when I followed Jonathan's advice:

http.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped

显然,有问题的库毕竟是 32 位的?

Apparently, the library in question is 32-bit after all?

推荐答案

该消息实际上并不是错误 - 它只是警告所涉及的文件的架构不正确(例如 32 位与 64-位,错误的 CPU 架构).链接器将继续寻找正确类型的库.

That message isn't actually an error - it's just a warning that the file in question isn't of the right architecture (e.g. 32-bit vs 64-bit, wrong CPU architecture). The linker will keep looking for a library of the right type.

当然,如果你也遇到了 can't find lPI-Http 这样的错误,那么你就有问题了:-)

Of course, if you're also getting an error along the lines of can't find lPI-Http then you have a problem :-)

在不知道构建系统和 makefile 的详细信息的情况下,很难提出确切的补救措施,但这里有一些黑暗中的镜头:

It's hard to suggest what the exact remedy will be without knowing the details of your build system and makefiles, but here are a couple of shots in the dark:

  1. 只是为了检查:通常你会添加标记为 CFLAGS 而不是CTAGS - 你确定这是正确的?(您所拥有的可能是正确的 - 这取决于您的构建系统!)
  2. 通常也需要将标志传递给链接器 - 因此您可能还需要修改 LDFLAGS
  1. Just to check: usually you would add flags to CFLAGS rather than CTAGS - are you sure this is correct? (What you have may be correct - this will depend on your build system!)
  2. Often the flag needs to be passed to the linker too - so you may also need to modify LDFLAGS

如果这没有帮助 - 您能否发布完整的错误输出,以及正在执行的实际命令(例如 gcc foo.c -m32 -Dxxx 等)?

If that doesn't help - can you post the full error output, plus the actual command (e.g. gcc foo.c -m32 -Dxxx etc) that was being executed?

这篇关于在编译时跳过不兼容的库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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