views:

575

answers:

4

Hi,

I am to take up the task of porting a C++ networking application code base of quite a size from Solaris to Linux platform. The code also uses third party libraries like ACE. The application when written initially was not planned for a possible porting in future.

I would like to get some advice and suggestions as to how I go about the task. What would be the best methods to follow.

-Prabhu. S

+6  A: 

ACE is a plus there, as it is multiplatform. You must check where and how your type sizes are used. If ACE_* basic types are used you are hitting a streak there, as those are portable, else I would start by changing the Solaris version into using multiplatform data types and elements (use ACE facilities since you already have that in place).

If you are using any Solaris only external library, you will have to locate an equivalent in linux and write a wrapper so that the rest of the application does not need to know what implementation is being used.

After that, migration into linux should be straight forward with just one code base. You should compile and test it through-fully.

David Rodríguez - dribeas
+1  A: 

List what your current external dependencies are. Find what of these are available on Linux. For those that aren't, you have to find a replacement. If the references to those external dependencies aren't abstracted away behind functions or objects, refactor the code so it is so. Then replace the dependencies, so you can implement the abstracting functions with the replacement.

Bernard
+3  A: 

"There is no such thing as a portable application only applications that have been ported"

First start with using the same tools on both platforms, if you can. I.E. if the Solaris version has not been changed to use GCC and GNU make etc, I advise you to change this first and get the Solaris build working. You will find that you will fix compiler problems first and not try to fix them on Linux at the same time as trying to port the application.

Second make sure you can get all the same libraries on each platform at the same version. I think you can get ACE for Linux. Make sure that the libraries at that version work on Solaris. This will limit compatibility problems.

Once you have done that then the real work starts.

You will need to compile each source file one at a time and find the functions that are not available in Linux. First look for a replacement that is available in both OSs. If there is no simple replacement then create two libraries one for Solaris and one for Linux. Create wrapper classes or functions to abstract the incompatibilities away.

If this sounds like a lot of work - it is.

David Allan Finch
+1  A: 

I'm in agreement with what David Allan Finch wrote. Take the port one step at a time. In addition:

Are you coming from Solaris/SPARC or Solaris x86? If it's x86, you'll have no endian issues, but if it's SPARC, you'll need to examine your code to make sure that there are no byte-order (endian) issues.

Is the Solaris code 32-bit or 64-bit? Certainly keep the address space the same initially.

tpgould