64-bit compilation with Gcc on Oracle11.2 (Solaris11, x86)

Source: Internet
Author: User
Since version 11.2, Oracle has canceled lib32Directory under ORACLE_HOME, and has gone from a 3366bit dual-track to a 64bit single track. For some people who want to use 32bit, the solution is to install a 32bit OracleClient. (Of course, another ORACLEHOME is generated this time. This should be okay, but I did not try it.

Since version 11.2, Oracle has canceled the lib32 Directory under ORACLE_HOME, and has gone from a 32/64-bit dual-track to a 64-bit single-track route. For some people who want to use 32bit, the solution is to install a 32bit Oracle Client. (Of course, this time generates another oracle home. This should be okay, but I did not try it.

Since version 11.2, Oracle has canceled the lib32 Directory under ORACLE_HOME, and has gone from a 32/64-bit dual-track to a 64-bit single-track route.

For some people who want to use 32bit, the solution is to install a 32bit Oracle Client. (Of course, this time generates another oracle home. This should be okay, but I have never tried it .)

However, the problem I encountered is that users want to upgrade to 64bit, from the original cc to gcc, but do not want to modify a large number of make files.

1. Install the gcc package.

First, search for gcc.

# Pkg search gcc

INDEX ACTION VALUE PACKAGE
Pkg. description set GCC Runtime-Shared libraries used by gcc and other gnu components pkg:/system/library/gcc-3-runtime@3.4.3-0.175.0.0.0.2.537
Pkg. summary set GCC Runtime libraries pkg:/system/libraries/gcc-3-runtime@3.4.3-0.175.0.0.0.2.537
Pkg. summary set GCC-4.5 Compilers pkg:/developer/gcc-45@4.5.2-0.175.0.0.0.2.537
Pkg. summary set GCC-4.5 Runtime pkg:/system/library/gcc-45-runtime@4.5.2-0.175.0.0.0.2.537
Basename hardlink usr/sfw/bin/gcc pkg:/developer/gcc-3@3.4.3-0.175.0.0.0.2.537
Basename link usr/bin/gcc pkg:/developer/gcc-45@4.5.2-0.175.0.0.0.2.537
Pkg. description set GCC Runtime-Shared libraries used by gcc and other gnu components pkg:/system/library/gcc-3-runtime@3.4.3-0.175.0.0.0.2.537
Pkg. summary set gcc-The gnu c compiler pkg:/developer/gcc-3@3.4.3-0.175.0.0.0.2.537
Basename dir usr/gcc pkg:/system/library/gcc-45-runtime@4.5.2-0.175.0.0.0.2.537
Basename dir usr/gcc/4.5/lib/gcc pkg:/system/library/gcc-45-runtime@4.5.2-0.175.0.0.0.2.537
Basename dir usr/sfw/lib/gcc pkg:/developer/gcc-3@3.4.3-0.175.0.0.0.2.537
Basename dir usr/sfw/libexec/gcc pkg:/developer/gcc-3@3.4.3-0.175.0.0.0.2.537
Basename dir usr/gcc pkg:/developer/gcc-45@4.5.2-0.175.0.0.0.2.537
Basename dir usr/gcc/4.5/lib/gcc pkg:/developer/gcc-45@4.5.2-0.175.0.0.0.2.537
Basename file usr/gcc/4.5/bin/gcc pkg:/developer/gcc-45@4.5.2-0.175.0.0.0.2.537

The gcc Package information of several versions is provided here.

For example, you want to install gcc compiler of version 3.4.3.

# Pkg install pkg:/developer/gcc-3@3.4.3-0.175.0.0.0.2.537

2. Create a cc file without modifying the make File

The following is an example (partial) of the Make file using the original Unix cc ).

# Makefile
PROC = proc
CC = cc

INCLUDE =-I $ {ORACLE_HOME}/precomp/public-I ../inc
INC =$ {HOME}/JBP/src/inc/
OBJ =$ {HOME}/JBP/src/obj/

......

Where is the installed gcc?

# Which gcc
/Usr/sfw/bin/gcc

Make a cc file with the following simple content:

/Usr/sfw/bin/gcc-m64 $ *

Note: Here-m64 indicates that gcc generates 64-bit compilation code.

$ * Receives all parameters after cc.

Cc must be executable.

# Ls-l cc
-Rwxr-xr-x 1 root 25 Nov 6 14:21 cc

3. Verify

$ Echo $ SHELL
/Usr/bin/bash

$ Echo $ PATH
/Usr/bin:/usr/sbin:/usr/sfw/bin

$ Which cc
/Usr/sfw/bin/cc

$ More test. c
# Include

Int main (void ){

Printf ("Content-type: text/plain \ n ");
Printf ("Hello, World! ");

Return 0;

}

$ Cc test. c

$ Ls-ltr
Total 15
-Rw-r -- 1 zhang staff 130 November 5 test. c
-Rwxr-xr-x 1 zhang staff 9992 November 7 a. out

$ File a. out
A. out: ELF 64-bit LSB executable AMD64 Version 1, dynamically linked, not stripped, no debugging information available

It can be seen that the Object file generated by using the gcc alias is 64bit.

Similarly, there is no exception in using the make file to compile the link.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.