免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 7855 | 回复: 5
打印 上一主题 下一主题

[Linux] linux下ar生成64位库为啥没有-m或-X选项 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-10-23 14:44 |只看该作者 |倒序浏览
请大家指点一下,我的linux版本是linux 2.6.32-220.el6.x86_64 #1 SMP Wed Nov 9 08:03:13 EST 2011 x86_64 x86_64 x86_64 GNU/Linux
ar的版本是
GNU ar version 2.20.51.0.2-5.28.el6 20091009
Copyright 2009 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) any later version.
This program has absolutely no warranty.

我想编译一个64位库,结果没有发现相应的选项,一个劲的报
ar: illegal option -- 6
Usage: ar [emulation options] [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file file...
       ar -M [<mri-script]
commands:
  d            - delete file(s) from the archive
  m[ab]        - move file(s) in the archive
  p            - print file(s) found in the archive
  q[f]         - quick append file(s) to the archive
  r[ab][f][u]  - replace existing or insert new file(s) into the archive
  t            - display contents of archive
  x[o]         - extract file(s) from the archive
command specific modifiers:
  [a]          - put file(s) after [member-name]
  [b]          - put file(s) before [member-name] (same as [i])
  [D]          - use zero for timestamps and uids/gids
  [N]          - use instance [count] of name
  [f]          - truncate inserted file names
  [P]          - use full path names when matching
  [o]          - preserve original dates
  [u]          - only replace files that are newer than current archive contents
generic modifiers:
  [c]          - do not warn if the library had to be created
  [s]          - create an archive index (cf. ranlib)
  [S]          - do not build a symbol table
  [T]          - make a thin archive
  [v]          - be verbose
  [V]          - display the version number
  @<file>      - read options from <file>
emulation options:
  No emulation specific options
ar: supported targets: elf64-x86-64 elf32-i386 a.out-i386-linux pei-i386 pei-x86-64 elf64-l1om elf64-little elf64-big elf32-little elf32-big srec symbolsrec verilog tekhex binary ihex

那位知道帮我看一下,在网上查了半天都没有64位的方法,都说-m64或者-X64,但是我的ar没有这个选项呀。

论坛徽章:
0
2 [报告]
发表于 2012-10-23 16:49 |只看该作者
问题已经解决,在此做一个总结,方便遇到一样问题的人参考;
AIX操作系统下,ar是有-X32 -X64 -X32_64三种模式的,因此使用者可以根据自己的需要选择模式,如果想我一样要使用configure编译的软件,请使用如下办法编译64位或者32位库
$ CFLAGS=-q64 FFLAGS=-q64 CXXFLAGS=-q64 AR='ar -X64'\
./configure
或者
$ export CFLAGS=-q64
$ export FFLAGS=-q64
$ export CXXFLAGS=-q64
$ export AR='ar -X64'
$ ./configure

在linux下由于没有-X选项(至少我的版本没有),可以使用OBJECT_MODE环境变量指定,方法如下:
$ export CFLAGS=-m64
$ export FFLAGS=-m64
$ export CXXFLAGS=-m64
$ export OBJECT_MODE=64
$ ./configure

上述,是我的总结经验,目前已经成功,如果大家有什么更好的办法,欢迎上来,大家共享一下。

论坛徽章:
0
3 [报告]
发表于 2012-10-24 22:52 |只看该作者
谢谢`学习了`~
楼主好人`解决问题以后还不忘留下解决方案`~

论坛徽章:
0
4 [报告]
发表于 2012-10-24 22:53 |只看该作者
谢谢`学习了`~
楼主好人`解决问题以后还不忘留下解决方案`~

论坛徽章:
0
5 [报告]
发表于 2012-10-24 22:54 |只看该作者
谢谢`学习了`~
楼主好人`解决问题以后还不忘留下解决方案`~

论坛徽章:
0
6 [报告]
发表于 2013-11-22 18:44 |只看该作者
HP  UNIX  呢?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP