3

if i have code compiled under Solaris 8 and 10 and now have a vendor that wants to use my bin/exe under Linux. Could there be compatibility issues?

I am pretty sure i would need to compile/link under Linux OS for it to work 100% but i just wanted to know if someone can give me the breakdown as to why it would not work on Linux even though the exe has everything and there is nothing dynamic about it, as in it should not need anything further to run it. Unless we talking runtime libs, that if there is a mismatch might cause the exe to fail.

Dave Powell
  • 671
  • 5
  • 14
  • 26

2 Answers2

8

You have to recompile your application on Linux.

Linux is a completely different run-time compared to Solaris. Even if you have compiled your application statically, there's the interface/system calls to the kernel that is different among these two operating systems. The processor architecture might be different too, e.g. SPARC vs X86.

Both Solaris and Linux support most of the standard C and Posix APIs, so if you've not used any APIs exclusive to Solaris, recompiling on Linux is often not that big a deal - but you surly should test everything throughly, and be aware of any endianess, and potential 64 bit vs 32 bit issues.

nos
  • 223,662
  • 58
  • 417
  • 506
  • i am using a third party lib other than that just standard c/c++ libs. will those be a problem? i am unsure what constitutes a solaris api. unless by that you meant my program is making calls to solaris specific features which its not. – Dave Powell Feb 15 '11 at 21:17
  • By solaris api, I mean any functions found on Solaris that's not available on Linux. You'll need a linux version of the 3. party library you are using. – nos Feb 15 '11 at 21:47
2

Other things that I think will not allow your Solaris binary to run on Linux out of the box are:

  1. the hardware architecture:
    1.1 Solaris usually runs on Sun's own SPARC machines, especially 8 - 10 can run on Intel architectures as well;
    1.2 Linux usually runs on Intel machines (although it can run on Sparc machines).

  2. the compilers:
    2.1 Solaris 8 uses Sun's own compilers (Sun WorkShop 6+) & standard library implementation (so you'll have different library names, ABI incompatibilities and so on). Solaris 10 actually comes with gcc but you're probably not using it (I gather you're building on Solaris 8 only);
    2.2 Linux uses g++, same as above for library names, ABI incompatibilities & so on.

Eugen Constantin Dinca
  • 8,994
  • 2
  • 34
  • 51
  • i used gcc version 3.4.6 Thread model: posix on solaris 8. I also have built a version on solaris 10. Now third party lib could be an issue i guess since i did get the solaris version. – Dave Powell Feb 15 '11 at 22:22
  • @user245823: if when you run `file ` or `file ` you get something saying SPARC (i.e. ELF X-bit MSB executable SPARC Version Y) and your Linux does not run on SPARC you're probably not going to be able to just run your Solaris program on Linux... – Eugen Constantin Dinca Feb 15 '11 at 22:54