linkning linux的静态库与Cygwin的窗户 [英] linkning linux static libraries in windows with cygwin

查看:191
本文介绍了linkning linux的静态库与Cygwin的窗户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个二进制静态库 libfoo.a中编制了32位的Linux机器。我想编译它针对与Cygwin的编译我的Win32项目。

I'm having a binary static library libfoo.a compiled for 32 bit linux machine. I wish to compile it against my win32 project compiled with cygwin.

这可能吗?这似乎是可能的,因为在归档中的所有目标文件应该在标准 ELF 格式。

Is that possible? It seems to be possible, as all the object files in the archive should be in the standard ELF format.

不过我一直recieving联关于纳米中发现的 libfoo.a中功能错误。
当我创建了一个存根 libfoo.a中 libfoo.a中与相同的名称一些空的功能,我没有收到任何链接不再对这些功能的错误。

However I keep recieving linking errors about functions that nm finds in the libfoo.a. When I created a stub libfoo.a with some empty functions with the same names of those in libfoo.a, I didn't recieve linking errors about those functions any longer.

是,甚至有可能还是我失去了一些东西?
无论如何,我怎么能解决这个问题?

Is that even possible or am I missing something? At any rate, how can I troubleshoot this problem?

推荐答案

即使你链接时,你将无法避免建立在不同的平台上code的不兼容性成功。例如标头(glibc的等)是不同的那里。为了确保类似重整兼容性的其他机制似乎是对目标文件导出的符号使用。

Even if you succeed in linking you won't avoid incompatibility of code built on different platforms. For example headers (glibc and others) are different there. To ensure compatibility additional mechanisms similar to mangling seem to be used on symbols exported by object files.

试图联系在一起编译对象为不同的处理器架构文件时,我遇到过类似你们一个问题 - 纳米显示所有需要的功能都present,但是连接不相信

I've met a problem similar to yours when tried to link together object files compiled for different processor architecture - nm showed all needed functions are present, but linker didn't believe that.

这篇关于linkning linux的静态库与Cygwin的窗户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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