Can Binaries compiled in Solaris 10 to run in Solaris 8

Will it be possible to run a binary in Solaris 8 which is compiled using Sun Studio 11 C++ and STL code in a Solaris 10 machine?Is there any compilers options to be added so that it can be backwards compatible with Sol 8?JoeV
[246 byte] By [joe.vijay] at [2007-11-26 7:42:19]
# 1

No, and No.

The compatibility rule is that code compiled on an earlier version of Solaris can be run on a later version of Solaris (with some limitations), but not the other way around.

The reason is that code compiled on later versions of Solaris typically rely on interfaces that do not exist in earlier versions of Solaris. Later versions of Solaris preserve older interfaces, to allow old code to continue to run.

Limitations on using binaries on later Solaris versions are that all system libraries must be linked dynamically (using the shared rather than the archive version of libraries), and that only documented public interfaces be used. Sun provides the AppCert program to verify that you use only public interfaces.

Similar compatibility rules apply to compiler versions: You can usually link to a binary created by an older compiler, but you cannot expect to link a binary from a newer compiler into a program built with an older compiler. The reasons are the same -- reliance on newer interfaces.

So the rule for developers is to decide on the earliest Solaris version that you intend to allow your customers to use, and build on that version.

If you supply libraries, build them with the earliest compiler that you intend to allow your customers to use.

Your customers can then use your binaries on the same or later versions of Solaris, and use your libraries with the same or later compiler versions.

For completeness, you would want to test with all the later Solaris and compiler versions.

clamage45 at 2007-7-6 19:50:19 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 2

I had similar problem. Check these flags in documentation:

-xnolib

-B[i]binding[/i]

Problem with old math library i solved with something like this:

-xnolib /lib/libm.so.1 -lCstd -lCrun -lc

I know thats not nice to use /lib/libm.so.1 directly, but it worked.

C++ libraries was possible to link staticly (-Bstatic) to program i think. Maybe you can link staticly all, but program will be to big. Just try some possibilities :).

Olda79 at 2007-7-6 19:50:19 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 3

Do NOT link C++ runtime or system libraries statically. There are a few restricted cases where it may work. Real-world applications are likely to fail when using static system libraries.

If your application uses C++ shared libraries, or runs on different OS versions, it is likely to fail unless all C++ and system libraries are linked dynamically.

clamage45 at 2007-7-6 19:50:19 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 4

I think that if you use C++ only inside your program and outside communicate only with C functions, then you can staticly link C++ libraries without worry. Other libraries should be linked dynamicly, but you can replace link to the right version, which is on solaris 10 too(math library). Maybe im wrong but i think that this way it can work.

Olda79 at 2007-7-6 19:50:19 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 5
You might be able to get it to work, but that kind of tinkering is not supported by Sun. If you run into problems, our only advice will be"Don't do that. Build on the earliest Solaris version you intend to support, and link system libraries dynamically."
clamage45 at 2007-7-6 19:50:19 > top of Java-index,Development Tools,Solaris and Linux Development Tools...