Moving from Solaris to Red Hat Enterprise Linux: A Quick Start Guide for Application Developers
April 12, 2010
Application developers moving from Solaris to Red Hat Enterprise Linux will find its UNIX-like development environment very familiar. There are differences, though, which developers need to be aware of when porting code from one to the other.
The Shell Environment
Red Hat Enterprise Linux ships with Korn shell version 93 (ksh-93), while Solaris 10 ships with version 88 (ksh-88). With a few exceptions, ksh-93 is backward-compatible with ksh-88.
Red Hat Enterprise Linux does not ship different sets of utilities for different standards. Most of the utilities are from the GNU project, with many favoring BSD semantics. GNU utilities support long options ("--help") as well as the standard short options ("-h") in UNIX.
Some environment variables used in Solaris are not supported by Red Hat Enterprise Linux (e.g., NETPATH, MSGVERB and SEV_LEVEL). XSI extension NLS variables (NLS, NLSPATH) are not set by default. In addition to the standard "LC_" environment variables, Red Hat Enterprise Linux supports LC_PAPER, LC_NAME, LC_ADDRESS, LC_TELEPHONE, LC_MEASUREMENT, and LC_IDENTIFICATION. The TZ environment variable is not set by default, but is supported.
RPM Package Manager
RPM is a package management tool used to install, upgrade and verify software on Red Hat Enterprise Linux. RPM packages are similar to Solaris packages, but are "upgraded" rather than "patched."
To install, upgrade, verify or remove a package with RPM, use the "rpm" tool with various switches ("-i" for install, "-v" for verbose, and so on). See the rpm manual page for details.
To build RPM packages, use the "rpmbuild" tool. First you need to write a "spec" file describing the software package, similar to the "prototype" file used in Solaris. See the Fedora Project RPM Guide for details.
Red Hat Enterprise Linux 5 ships with the "yum" tool, while earlier versions ship with the "up2date" tool. Both tools are designed to simplify the process of installing and updating software.
The Red Hat Enterprise Linux development environment is based on the GNU Compiler Collection (GCC). The GNU C library system interface is compatible with POSIX (ISO/IEC 9945) specifications. Red Hat Enterprise Linux does not include all the extensions to those standards that Solaris does; for example, the Sun C compiler supports many extensions via #pragmas that the GNU C Compiler does not support.
Some function prototypes are in different header files, depending on the standard specified at compile time.
For ANSI standards there are compile flags, but preprocessor directives must be used for the various UNIX standards.
GCC syntax is similar to the Sun C compiler syntax. For example, the following command compiles a C program into an executable: gcc -g hello.c -o hello
Use the "-O" flag for optimization, and use "-O2" instead of "-fast".
For C++, use g++ instead of gcc.
Use the "-fPIC" option to compile position-independent code for use in shared libraries.