从 Linux 确定 AIX 的库存档是 32 位、64 位还是两者兼而有之
在 AIX 上,我将运行:
ar -X32 -t libdb2.a
并检查输出以确定存档中是否有 32 位对象。与 -X64 类似,用于检查 64 位对象。但是,如果我在另一个平台上,并且需要检查存档以查看其中的内容,该怎么办?通常,当我需要检查时,我会使用 Linux,但我也可以轻松地使用 Solaris 或 HP-UX。
我曾经检查过 shr.o 和 shr_64.o,因为这就是正在编译的内容,但这些内容开始出现在档案中的实际消息中,因此它们的可靠性已经下降到我认为的程度出现误报。
如果有人有一个指针,最好是我可以用 perl 做的事情,那就太好了。
On AIX, I would run:
ar -X32 -t libdb2.a
and check for output to determine if there is a 32-bit object in the archive. Similarly with -X64 for checking for a 64-bit object. However, what about if I'm on another platform, and need to check the archive to see what it has? Usually I'm on Linux when I need to check, but I could just as easily be on Solaris or HP-UX.
I used to check for shr.o and shr_64.o, since that's what's being compiled, but those are starting to show up in actual messages that are in the archives, and thus the reliability of these have dropped to the point where I'm getting false positives.
If anyone has a pointer, preferably something I can do in perl, that'd be great.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为没有简单的方法。如果您创建两个 AIX 归档文件,一个是 32 位,一个是 64 位,如下所示:
您最终得到的归档文件不是 linux
ar
可读的格式:我尝试使用
strings
查看档案中是否有任何明显的东西,但什么也没找到。您剩下的唯一选择是构建一个针对 AIX 的 binutils 软件包(下载 binutils,使用选项--target=powerpc-ibm-aix5.3
进行配置,运行make
并瞧:您在该构建树中的某处有一个名为powerpc-ibm-aix5.3-ar
的工具)。I don't think there is an easy way. If you create two AIX archives, one 32-bit and one 64-bit, as follows:
you end up with archives that are not in a readable format by the linux
ar
:I tried using
strings
to see if anything obvious was in the archives, but found nothing. Your ony remaining option is to build a binutils package targetting AIX (download binutils, configure with option--target=powerpc-ibm-aix5.3
, runmake
and voilà: you've got a tool calledpowerpc-ibm-aix5.3-ar
somewhere in that build tree).我建议从 .a 存档中提取 .o 文件之一,然后对其运行 file 命令。示例:
file
并非每个系统上的标准,但可以轻松编译。另外,还有一个 几个 perl 模块,它们的作用与 <代码>文件。ar
提供了p
命令来打印相关文件。例如:I'd suggest extract one of the .o files from the .a archive, and then running the file command on it. Example:
file
isn't standard on every system, but can easily be compiled. Alternatively, there are a couple of perl modules which do the same thing asfile
.ar
offers thep
command which prints the file in question. For example:所以......我迟到了一年,但我遇到了完全相同的问题。这是我解决问题的方法,我希望它可以帮助某人:
可能的结果:
或
解释:
存档库文件只是“.o”文件的集合,当您使用 ar 的“t”参数时,您会列出存档的内容,当您使用 ar 的“x”参数时,您会提取它们。输入 man ar 了解更多说明。
So... I'm one year late, but I just had the exact same problem. Here is how I solved it, I hope it helps someone:
Possible outcomes:
OR
Explanation:
An archive library file is just a collection of ".o" files, when you use the "t" argument of ar you list the contents of the archive and when you use the "x" argument of ar you extract them. Type man ar for further instructions.