The build environment includes the system headers, compilation system, and libraries. These are explained in the following sections.
A single set of system headers supports both 32-bit and 64-bit compilation environments. You need not specify a different include path for the 64-bit compilation environment. Starting with Oracle Solaris 11, the <system/header> is available as an IPS package that contains core C and C++ header files.
To understand the changes made to the headers to support the 64-bit environment, you should understand the various definitions in the <sys/isa_defs.h> header file. This header contains a group of well known #defines and sets these for each instruction set architecture. Inclusion of <sys/types.h> automatically includes <sys/isa_defs.h>.
The symbols in the following table are defined by the compilation environment:
The following symbols are derived from a combination of the symbols defined above:
If writing completely portable code is not possible, and specific 32-bit versus 64-bit code is required, make the code conditional by using _ILP32 or _LP64. This makes the compilation environment machine independent and maximizes the portability of the application to all 64-bit platforms.
The Oracle Solaris operating environment provides shared libraries for both 32-bit and 64-bit compilation environments.
32-bit applications must link with 32-bit libraries, and 64-bit applications must link with 64-bit libraries. It is not possible to create or execute a 32-bit application by using 64-bit libraries. The 32-bit libraries continue to be located in /usr/lib and /lib. The 64-bit libraries are located in a subdirectory of the appropriate lib directory. Because the placement of the 32-bit libraries has not changed, 32-bit applications built on prior releases are binary compatible. Portable Makefiles should refer to any library directories by using the 64 symbolic links. The /usr/lib/64 is symbolic link to /usr/lib/sparcv9 on SPARC systems and /usr/lib/amd64 on x86 systems.
In order to build 64-bit applications, you need 64-bit libraries. The compiler and other tools such as ld, ar, and as are capable of building 64-bit programs and 32-bit programs. Of course, a 64-bit program built on a system running the 32-bit operating system cannot execute in that 32-bit environment. However, in the future releases of Oracle Solaris, 32-bit might not be the default compilation mode.