Home > Enterprise Linux Tips > Migration & Integration > Porting Solaris applications to Linux, part 3
Enterprise Linux Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

MIGRATION & INTEGRATION

Porting Solaris applications to Linux, part 3


Ken Milberg
08.19.2004
Rating: --- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


Despite some skeptics' opinions, Linux really is different from Unix, and people who use Linux know that that difference is a good thing. Just the cost savings alone will make it worthwhile to port your Solaris applications to Linux, and cost reduction is just the tip of the iceberg. In this three-part series on Solaris-to-Linux porting, I've offered tips on laying the groundwork and working with compilers. Now, let's look at compiling successfully. To do that, you'll have to understand the differences between Solaris and Linux.

Let's start with compilers and finish with linkers. More than likely, you will be using either CC or GCC. Both the CC compiler and GNU compiler have extended the C language. Since the direction of the port is Sun to Linux, this is not a major issue. The options to select the various modes are very different. If you are going with the method of compiling your gcc code on the SPARC server, then you'll need to download the appropriate GNU tools and install them on your Sun box. Then, start building the app using gmake instead of make. After you have modified the makefiles to work with gmake, you'll need to change the name of your compiler to GCC from C and G++ from C++. At that point, you can start rebuilding your applications.

The options to tell the compiler to compile but not link (-c), specify the output file (-o), adding a search library directory (-lname), define preprocessor macro (-Uname), telling the compiler to leave out debugging (-g), compile but don't assemble (-S) and the option to stop printer warnings (-w) are the same on both compilers.

Unfortunately, there is an abundance of differences between both the compilers. Here are just some of them:

graph list sec ws
GCC Sparc cc Description
-static -Bstatic Has the compiler statically link the application
-O -fast Enables options to maximize speed of compiled app
-shared -G The linker creates a shared object with this flag
-flags -- help -v Prints summary of options
-save-temps -keeptmp Instructs compiler not to remove temp files
-M -H Prints the path name of each file being compiled

Another piece of software, which is also critical, is the linker. The linker controls the final form of the actual code and is critical that you use it correctly. Again, SPARC and the GNU version have some similarities on both platforms but also tons of differences. It is important to familiarize yourself with these differences. Go on-line to GNU and familiarize yourself with the documentation for the GNU linker to help you compare the two. Here's a table with some of the differences:

graph list sec ws
GNU Solaris Description
-shared -G Generates a shared object
-static -a Enables default behavior in static mode and prevents linking with shared libraries
-Ldir -L directory Adds directory to list of directories
-rpath path -R path Specifies search direction to run-time linker

There is a ton of information on-line that will help you understand the GNU tools better. Do not hesitate to do the research and spend the time understanding the new tools that you will be using. Start with GNU.org, but don't stop there.

One final note: It's important to understand that apps that are designed for SPARC servers use non-standard functions that can hinder a port to Linux. A provisional STL is supported on Intel's Linux that can help ease the pain of porting those apps. It provides the Solaris API threads that are layered on the POSIX thread library. STL is a component of Solaris Compatibility Libraries and is available in open source, though SourceForge.

In my next article on porting applications from Solaris to Linux, I'll cover training needs for shops moving from Unix to Linux. In the meantime, I'd like to get your input. Do you have questions about this topic? Would you like more information about compilers? Would you like more information about a certain porting task? Do you disagree with any of the advice I've offered in this series? If so, please write to me c/o editor@searchenterpriselinux.com, and I'll respond quickly.


Rate this Tip
To rate tips, you must be a member of SearchEnterpriseLinux.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Enterprise Linux Web Server & Application Server
HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersIT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 2003 - 2008, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts