Indiana University
University Information Technology Services
  
What are archived documents?

On IU's research systems, how can I check the library file to see if a routine exists?

A software library is a collection of professionally developed software routines available for use in your programs.

To check either an archive (.a) or a shared object (.so) library file on Indiana University's research computing systems, use the nm command. For example, if you want to see if cos is inside the /usr/lib/libm.so library, you could give the command:

nm -g /usr/lib/libm.so | grep cos

You should see results similar to this:

[593] | 8312| 936|FUNC |GLOB |0 |9 |__acos [665] | 9264| 508|FUNC |GLOB |0 |9 |__acosh [554] | 28536| 200|FUNC |GLOB |0 |9 |__cos [611] | 14240| 816|FUNC |GLOB |0 |9 |__cosh [637] | 8312| 936|FUNC |WEAK |0 |9 |acos [574] | 9264| 508|FUNC |WEAK |0 |9 |acosh [667] | 28536| 200|FUNC |WEAK |0 |9 |cos [664] | 14240| 816|FUNC |WEAK |0 |9 |cosh

For /usr/lib/libm.a, use the following command:

nm -g /usr/lib/libm.a | grep cos

The results should be similar to the following:

/usr/lib/libm.a[acos.o]: .acos T 0 acos D 688 12 /usr/lib/libm.a[acosh.o]: .acosh T 0 acosh D 252 12 /usr/lib/libm.a[cos.o]: .cos T 0 cos D 624 12 /usr/lib/libm.a[cosh.o]: .cosh T 0 cosh D 524 12 .cos U - .cos U - /usr/lib/libm.a[acosF.o]: ._acos T 0 _acos D 688 12 /usr/lib/libm.a[cosF.o]: ._cos T 0 _cos D 624 12 /usr/lib/libm.a[coshF.o]: ._cosh T 0 _cosh D 524 12 /usr/lib/libm.a[_qacos.o]: ._qacos T 0 .acosl T 2012 _qacos D 2132 12 acosl D 2144 12 /usr/lib/libm.a[_qcosh.o]: ._qcosh T 0 .coshl T 628 _qcosh D 752 12 coshl D 764 12 /usr/lib/libm.a[_qsincos.o]: ._qcos T 100 .cosl T 2204 _qcos D 2308 12 cosl D 2332 12

You can see the cos function is in /usr/lib/libm.so and /usr/lib/libm.a.

You can also use the ar utility to check the content of an archive (.a) file:

ar -t /usr/lib/libm.a | grep cos

The results should appear similar to this:

acos.o acosh.o cos.o cosh.o acosF.o cosF.o coshF.o _qacos.o _qcosh.o _qsincos.o

On Quarry or Big Red, if you do not know which library files to search, the following command might locate the requested routine:

findobject w_exp.o

The results should be similar to this:

w_exp.o /usr/lib/x86_64-redhat-linux3E/lib64/libm.a 64-bit w_exp.o /usr/lib/libm.a 32-bit w_exp.o /usr/lib/i386-redhat-linux3E/lib/libm.a 32-bit w_exp.o /usr/lib64/libm.a 64-bit w_exp.op /usr/lib64/libm_p.a 64-bit w_exp.o /N/soft/linux-rhel4-x86_64/gcc-4.2.2/lib/libgcj.a 32-bit w_exp.o /N/soft/linux-rhel4-x86_64/gcc-4.2.2/lib64/libgcj.a 64-bit w_exp.o /N/soft/linux-rhel4-x86_64/gcc-4.1.1/lib/libgcj.a 32-bit w_exp.o /N/soft/linux-rhel4-x86_64/gcc-4.1.1/lib64/libgcj.a 64-bit

This document was developed with support from the National Science Foundation (NSF) under Grant No. 0503697 to the University of Chicago and subcontracted to Indiana University. Additional support was provided by IU through its participation in the TeraGrid, which is supported by the NSF under Grants No. 0833618, SCI451237, SCI535258, and SCI504075. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the NSF.

This is document aqoz in domains all and tgrid-all.
Last modified on February 16, 2009.
Please tell us, did you find the answer to your question?