0

I'm using an application developed in Sun Solaris 8 and it depends of the architecture SPARC ( the application using some librairies of the system Solaris 8) .

Is it possible to export that application from SPARC to intel x86 ? Can i export also in another OS like Ubuntu, Windows or other ?

I hope that was clear and if you need more information i'll try to clarify. Thanks.

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
Hohenheim
  • 1,545
  • 1
  • 12
  • 28
  • Are you asking about recompiling from source for x86? Or do you only have binaries? – Peter Cordes Aug 17 '16 at 08:48
  • thank you for answering @PeterCordes i'm new in this project but i think it's concerning binaries. But if you have an answer for recompiling source too i'll take with pleasure – Hohenheim Aug 17 '16 at 08:51
  • 1
    Well if you only have binaries, then you need to either decompile/recompile (might not work), or you need a SPARC emulator, hopefully with JIT rather than an interpreter. If you have source, you just compile it against the x86 version of the libraries. (e.g. on x86-64 Solaris, or x86-64 Ubuntu, or whatever). – Peter Cordes Aug 17 '16 at 08:55
  • ok i'll get more information about the application, thank you for the answer and if i get some new thing i'll inform you @PeterCordes – Hohenheim Aug 17 '16 at 08:59
  • 3
    Your application is quite likely to run just fine on Solaris 10 or Solaris 11 on newer hardware - Solaris is **very** good at maintaining backwards compatibility. You might do better doing that, given the apparent lack of the original source code - and even if you do get the source, the cost and time necessary to port older Solaris code to Linux would likely be substantial. Porting to Windows would be even more difficult and time-consuming than porting to Linux. It depends on what's driving your need to migrate. – Andrew Henle Aug 17 '16 at 10:27
  • thanks for your answer @AndrewHenle . Yes i don't have the code source right now but it's an application about schemas of elecrtical network so it's using slgms the graphical editor essentially, i have a collaborater who wants to port this to linux so i try to find devices from the community of stackoverflow to have an idea and also to estimate the time to spend on it – Hohenheim Aug 17 '16 at 12:05
  • 1
    @Hohenheim It's a GUI application, then? What's the output from `ldd /path/to/application/executable(s)`. That would at least show what toolkit(s) were used to create the application. That may give an indication of how much work it will be. There are also a lot of little issues in porting from, say, SPARC Solaris to x86 Linux. Data endianess and different behavior of basic library calls, especially in edge or corner cases. If you don't have experience with both platforms, and experience in coding with the language(s) used, it's going to be a long slog, especially if reliability is a goal. – Andrew Henle Aug 18 '16 at 21:25

1 Answers1

2

I'm assuming we're talking about a native application here (a machine code binary).

Short answer: No to both questions.


Long answer:

Is it possible to export that application from SPARC to Intel x86?

Yes, but that would imply:

  • Fully reverse engineer it
  • Re-write in a suitable higher level language (e.g. C)
  • Compile for Intel x86

Can i export also in another OS like Ubuntu, Windows or other?

I assume you're talking about another OS running on SPARC architecture. If not, refer to previous answer. If yes, then you can, but you would have to:

  • Translate all system calls from Solaris to the new OS (this can range from relatively easy to very complicated depending on how different the OS architecture is).
  • Possibly modify ELF32 sections to conform to the new OS.

Additionally, for a non-UNIX target OS (e.g. Windows):

  • Rebuild the executable using the new OS executable format (e.g. NE, PE, LE...)

This is what pops on my head on a first thought.

m0skit0
  • 25,268
  • 11
  • 79
  • 127
  • @thank you for the answer ! So if i understand with your long answers : it's a little bit hard to export from SPARC to intel x86 . And if it's possible : it demands a lot of knowledge especially in C language. But my question will be maybe stupide : the application is developed in C on SPARC/Solaris 8 , it will be different if it's developed in the smae langage C for intel x86 ? it's not only a problem of compiling ? – Hohenheim Aug 17 '16 at 09:07
  • 1
    SPARC Linux might be able to run Solaris binaries, if it has a syscall compatibility layer in the kernel. IDK, but it's worth looking, because Solaris is/was the most popular OS for that platform. Early on, x86 Linux had a compat layer for FreeBSD system calls (but now it's the other way around: x86 FreeBSD kernels have a compat layer for x86 Linux binaries.) – Peter Cordes Aug 17 '16 at 09:07
  • 3
    @Hohenheim Well, depends on the size of the executable we're talking about. Also depends on your RE skill, but judging from your questions, I would put it in the "almost impossible" range of difficulty unless you're willing to sink insane amounts of time on it. It would involve more assembly and Solaris executable format knowledge than C. C is just an example. You could use any other language to rewrite it. It will be completely different even if both are written in C because the output of C language is machine code, and this is specific to each architecture. – m0skit0 Aug 17 '16 at 09:25
  • @PeterCordes *SPARC Linux might be able to run Solaris binaries...* I can't say that I personally see the point of doing that. "Take a SPARC server, load Linux on it, use it to emulate Solaris, then run Solaris binaries." Just run Solaris. What's the response *when* a bug is found when the applications are run on SPARC Linux under Solaris emulation? That's going to be an expensive Easter Egg hunt... – Andrew Henle Aug 17 '16 at 10:34
  • @AndrewHenle: Yeah unlikely, given that Solaris doesn't suck too much, and there's little reason for using SPARC hardware *other* than to run Solaris. One use-case is if you've had a SPARC system running Linux for years, and then someone just happens to give you a Solaris binary. Or more likely; for people that really want to work on the SPARC Linux port, and need to maintain compatibility. – Peter Cordes Aug 17 '16 at 15:37