SUMMARY: Using SunOS4-built libraries with SunOS5

From: Mark B. Hamby (
Date: Fri Jul 28 1995 - 23:50:42 CDT

My question was:

> I have a library built under Sun OS 4.1.3. My people need to link with it
> under Solaris 2.4. They keep getting the following error:
> ld: fatal: file libLeHooks.a: unknown type, unable to process using elf(3E) libraries
> ld: fatal: File processing errors. No output written to plotimage
> *** Error code 1
> Must I do something special to link Solaris 1.x libraries with Solaris 2.x?

Summarized answers:

Bottom line: No, Solaris 1.x libraries cannot be used with Solaris 2.x.
Solaris 2.x libraries use ELF format, unlike Solaris 1.x libraries which uses
coff (a.out) format.

Other reasons supplied by Casper Dik <casper@Holland.Sun.COM>:

        - a different object format (the lesser problem)
        - different naming converntions (a.out objects have "_" prepended
          to symbols)
        - compiled with a different set of include files & constants
          the SunOS 4.x code expects different constants (such as SOCK_STREAM)
          and different structure types (like struct stat/ FILE*)

- Recompile the libraries under Solaris 2.x if source available.
- Obtain Solaris 2.x versions of the libraries from the vendor.
- Build a Solaris 1.x binary from a Solaris 1.x host or cross-linker
  (like GNU's ld), and use Solaris 2.x's binary compatibility mode to
  run the executable.
- Somehow get GNU's linker to read Solaris 1.x's coff formatted libraries
  and still produce a Solaris 2.x binary. It is not known if this was a
  viable solution.

Thanks to:
Kevin Sheehan <>
Stephen Harris <>
Richard Pieri <>
Guy Harris <>
Edward C. Zimmermann <>
Casper Dik <casper@Holland.Sun.COM>

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:10:30 CDT