.a File Extension
.a file is, how to inspect static libraries, how Poly supports them, and when to rebuild or choose another archive format. File extension details for .a
Storage Only| File type | Static library or Unix ar archive |
|---|---|
| MIME type | |
| Encoding | Binary archive with ASCII headers, usually containing object files |
| Operating systems | Linux, macOS, Windows, Unix |
| Opens with | GNU ar, LLVM llvm-ar, Apple libtool, Linker toolchains |
| Poly support | Yes. Poly safely stores, syncs, shares, versions, and downloads .a files. |
| Indexed by Poly | Partial. Poly indexes the filename and ordinary file properties, not archive members or symbols. |
| Preview in Poly | No. Download the file to inspect it with an archive or compiler toolchain. |
| Poly agent | No. The Poly agent cannot read members packed inside a .a file. |
What kind of file is a .a?
A .a file is usually a static library used by Unix-like compiler toolchains. It normally uses the Unix ar container and holds compiled object files plus a symbol index that helps a linker find the code it needs. An ar container can hold other kinds of files, so the suffix describes a strong convention rather than a guarantee.1
Most conventional files start with the eight ASCII bytes !<arch>\n, or 21 3C 61 72 63 68 3E 0A in hexadecimal. Check that signature instead of trusting the filename. A GNU thin archive starts with !<thin>\n and refers to files elsewhere rather than embedding their contents.1
The de facto MIME type is application/x-unix-archive. It is not registered by IANA, and some tools instead use application/x-archive.2
library.a to .zip, .tar, or .lib does not convert the archive or make its object code compatible with another platform.How do I open a .a on my computer?
A .a library is meant for development tools, not a document viewer.
- On Linux and other Unix systems, use GNU
ar,nm, or the equivalents supplied by the compiler toolchain. - On macOS, use Apple's command-line developer tools, including
ar,nm, andlibtool. - On Windows, use
llvm-arfrom LLVM or a Unix-compatible development environment. Microsoft-native static libraries more commonly use.lib.
List members without extracting them:
ar t library.a
nm -s library.a
LLVM documents support for several archive styles, including GNU, BSD, Darwin, SVR4, and AIX big archives.3 Recognizing the outer archive does not guarantee that your linker can use its members. CPU architecture, object format, compiler ABI, and target operating system must also match.
Poly support for .a
Poly stores, syncs, shares, versions, and downloads .a files. They remain searchable by filename and ordinary file properties.
Poly does not infer the ar media type from the .a suffix, open an archive browser, extract members, index symbols or embedded object code, or pass those members to the Poly agent. Download the file and inspect it with a trusted compiler toolchain. Treat libraries from unknown sources as executable supply-chain inputs, even though the archive itself is not launched when you view it.
History of .a
The ar command and archive format appeared in the first edition of the Unix Programmer's Manual, dated November 3, 1971.4 Static libraries adopted the short .a convention, with “a” standing for archive.
The basic container survived because linkers can use its symbol table to select only the members needed by a program. Modern archivers also offer deterministic output, replacing variable timestamps and ownership fields so repeated builds can produce identical archives.3
Working with .a and alternatives
Choose the next step based on the file's purpose:
| Need | Best approach |
|---|---|
| Link the library into a program | Use it with a compatible compiler and linker |
| Inspect members or symbols | Use ar t, nm, or llvm-ar t |
| Move ordinary files between systems | Extract them and create a TAR or ZIP archive |
| Target another CPU or operating system | Rebuild the library from source for that target |
TAR preserves directory-oriented bundles and Unix metadata. ZIP offers broad desktop interchange and built-in compression. A static library needs ar structure, compatible object files, and usually a symbol index, so repackaging it as TAR or ZIP will stop it from working as a library.
Footnotes
- GNU Binutils. ar. The manual describes archive members, symbol indexes, ordinary archives, and thin archives. ↩ ↩2
- Internet Assigned Numbers Authority. Media Types Registry. Neither
application/x-unix-archivenorapplication/x-archiveis registered. ↩ - LLVM Project. llvm-ar Command Guide. The guide documents supported variants, symbol tables, and deterministic archives. ↩ ↩2
- Nokia Bell Labs. Unix Programmer's Manual, First Edition. The surviving manual is dated November 3, 1971 and documents
ar. ↩