查看静态库.a文件包含的内容用下面的命令解压:
- ar x libgdal.a
然后就可以查看文件了:
- ls
- adler32.o cpl_recode.o dted_create.o gdalpamrasterband.o geo_write.o nitfimage.o tif_fax3sm.o tif_tile.o
- compress.o cpl_recode_stub.o dted_ptstream.o gdalproxydataset.o gt_citation.o nitfwritejpeg_12.o tif_float.o tif_version.o
- cpl_atomic_ops.o cplstringlist.o gdalallregister.o gdalproxypool.o gt_overview.o nitfwritejpeg.o tif_flush.o tif_vsi.o
- cpl_base64.o cpl_string.o gdalallvalidmaskband.o gdalrasterband.o gt_wkt_srs.o overview.o tif_getimage.o tifvsi.o
- cpl_conv.o cplstring.o gdalcolortable.o gdalrasterblock.o infback.o rasterio.o tif_jpeg_12.o tif_warning.o
- cpl_csv.o cpl_strtod.o gdaldataset.o gdal_rat.o inffast.o rpftocfile.o tif_jpeg.o tif_write.o
- cpl_error.o cpl_time.o gdaldefaultasync.o gdal_rpcimdio.o inflate.o tif_aux.o tif_luv.o tif_zip.o
- cpl_findfile.o cpl_vsil.o gdaldefaultoverviews.o geo_extra.o inftrees.o tif_close.o tif_lzma.o trees.o
- cpl_getexecpath.o cpl_vsil_readahead_reader.o gdaldllmain.o geo_free.o jpgdataset_12.o tif_codec.o tif_lzw.o uncompr.o
- cplgetsymbol.o cpl_vsil_sparsefile.o gdaldrivermanager.o geo_get.o jpgdataset.o tif_color.o tif_next.o vsidataio.o
- cpl_hash_set.o cpl_vsil_stdin.o gdaldriver.o geo_names.o libgdal.a tif_compress.o tif_ojpeg.o xtiff.o
- cpl_http.o cpl_vsil_subfile.o gdalmajorobject.o geo_new.o libgdal.so tif_dirinfo.o tif_open.o zutil.o
- cplkeywordparser.o cpl_vsil_unix_stdio_64.o gdal_misc.o geo_normalize.o libogr.a tif_dir.o tif_packbits.o
- cpl_list.o cpl_vsi_mem.o gdalmultidomainmetadata.o geo_print.o mgrs.o tif_dirread.o tif_pixarlog.o
- cpl_minixml.o cpl_vsisimple.o gdalnodatamaskband.o geo_set.o nitfaridpcm.o tif_dirwrite.o tif_predict.o
- cpl_multiproc.o cpl_xml_validate.o gdalnodatavaluesmaskband.o geo_simpletags.o nitfbilevel.o tif_dumpmode.o tif_read.o
- cpl_path.o crc32.o gdalopeninfo.o geotiff.o nitfdataset.o tif_error.o tif_strip.o
- cpl_progress.o deflate.o gdalpamdataset.o geo_tiffp.o nitfdes.o tif_extension.o tif_swab.o
- cpl_recode_iconv.o dted_api.o gdalpamproxydb.o geotiff_proj4.o nitffile.o tif_fax3.o tif_thunder.o
自己打包静态库,还是用ar命令:
- ar -rcs output/linux_debug_x64/libgdal.a build/port/obj/Debug64/*.o build/gcore/obj/Debug64/*.o build/frmts/obj/Debug64/*.o build/ogr/obj/Debug64/*.o
还可以将.a文件和.o文件一起打包:
- ar -rcs output/linux_debug_x64/libgdal.a build/port/obj/Debug64/*.o build/gcore/obj/Debug64/*.o build/frmts/obj/Debug64/*.o output/linux_debug_x64/libogr.a
参数c是创建
参数s是添加索引
参数r是将后面的*.o或者*.a文件添加到目标文件中
为了兼容性,可以使用参数f,解释如下:
- f Truncate names in the archive. GNU ar will normally permit file names of any length. This will cause it to create archives which are not compatible with the
- native ar program on some systems. If this is a concern, the f modifier may be used to truncate file names when putting them in the archive.
查看.a文件的symbols(符号),用下面的命令:
- nm -g libNAME.a
会打印每个包含的文件,以及文件内的symbol。
http://blog.csdn.net/csfreebird/article/details/11741075