Blog dedicated to Oracle Applications (E-Business Suite) Technology; covers Apps Architecture, Administration and third party bolt-ons to Apps

Friday, December 28, 2007

Adventures with PL/SQL native compilation settings

Recently we enabled PL/SQL native compilation in an upgraded 11.5.10.2/10.2.0.3 instance. Some of the packages were not compiling and giving these errors:

SQL> show err;
Errors for PACKAGE BODY EXAMPLE_NATIVE_PKG:

LINE/COL ERROR
-------- -----------------------------------------------------------------
0/0 PLS-00923: native compilation failed: C compilation or linking
failed:spdzj.c:Could not invoke program
/opt/SunProd/SUNWspro8/bin/cc:No such file or directory

To solve this error you will have to configure gcc as the primary compiler:

Login as root user
cd /opt
find . -name cc
If the find command returns the path of cc, copy it

Check if primary compiler exists:

ls -ltr /opt/SunProd/SUNWspro8/bin/cc.

If the above file doesn't exist, that means primary compiler is missing. As an alternative, we have to now configure gcc as the primary compiler. Login as oracle user. Change directory to your 10.2.0 ORACLE_HOME

cd $ORACLE_HOME/plsql
vi spnc_commands

Comment line 21 in the file:
#/opt/SunProd/SUNWspro8/bin/cc %(src) -xO1 -Xa -xstrconst -dalign -xF -mr -xildoff -errtags=yes -xarch=v9 -xchip=ultra3 -W2,-AKNR_S -Wd,-xsafe=unboundsym -Wc,-Qiselect-funcalign=32 -xcode=abs44 -Wc,-Qgsched-trace_late=1 -Wc,-Qgsched-T5 -KPIC -I$(ORACLE_HOME)/plsql/include -I$(ORACLE_HOME)/plsql/public -G -o %(so)

Uncomment line 27:
/usr/local/bin/gcc -B/usr/ccs/bin %(src) -c -fPIC -mhard-float -mhard-quad-float -mcpu=v9 -DSLU8NATIVE -DSLS8NATIVE-D_REENTRANT -DSOLARIS -DSLMXMX_ENABLE -DSLTS_ENABLE -D_SVID_GETTOD -DEO_SUPPRESS_DEBUG -DEO_SUPPRESS_TRACE -O1 -m64 -I$(ORACLE_HOME)/plsql/include -I$(ORACLE_HOME)/plsql/public -o %(obj)

In line 27, the last few characters are (obj) change this to (so). Line 27 should read:
/usr/local/bin/gcc -B/usr/ccs/bin %(src) -c -fPIC -mhard-float -mhard-quad-float -mcpu=v9 -DSLU8NATIVE -DSLS8NATIVE-D_REENTRANT -DSOLARIS -DSLMXMX_ENABLE -DSLTS_ENABLE -D_SVID_GETTOD -DEO_SUPPRESS_DEBUG -DEO_SUPPRESS_TRACE -O1 -m64 -I$(ORACLE_HOME)/plsql/include -I$(ORACLE_HOME)/plsql/public -o %(so)

Unless you do these steps, since plsql native compilation is enabled, you'll get this kind of errors while compiling packages/procedures:

SQL> alter package EXAMPLE_NATIVE_PKG compile body;
Warning: Package Body altered with compilation errors.

SQL> show error
Errors for PACKAGE BODY EXAMPLE_NATIVE_PKG
LINE/COL ERROR
-------- -----------------------------------------------------------------
0/0 PLS-00923: native compilation failed: C compilation or linking
failed:spdzj.c:Could not invoke program
/opt/SunProd/SUNWspro8/bin/cc:No such file or directory

If you do not change (obj) with (so) as per metalink note 429524.1, you'll get ORA-600 :

alter package EXAMPLE_NATIVE_PKG compile
ERROR at line 1:
ORA-00603: ORACLE server session terminated by fatal error

In Alert log:
ORA-00600: internal error code, arguments: [skkxerrp], [skkxdllwri], [SlfFopen], [$ORACLE_HOME/plsql_nativelib/EXAMPLE_NATIVE_PACKAGE__B__1824152.so], [No such file or directory], [], [], []

5 comments:

Anonymous said...

Hi Vikram ,

Can you pls let me know how can we check whther native compilation is enabled in an instance or not...?

Thnx,
Praveen

Vikram Das said...

You can check for these initialization parameters :

plsql_code_type = NATIVE
plsql_native_library_subdir_count
plsql_native_library_dir

select name,value from v$parameter
where name in
(
'plsql_code_type',
'plsql_native_library_subdir_count',
'plsql_native_library_dir'
);

If native mode is enabled, the value of parameter plsql_code_type will be NATIVE.

- Vikram

Anonymous said...

Thanks for the tip!

Cheers,
Dave.

Abdulla Chozhimadathil said...

How to configure in windows with MINGW GCC, PLS-00923: native compilation failed: C compilation or linking
failed:gcc: error: CreateProcess: No such file or directory

Abdulla Chozhimadathil said...

How to configure in windows with MINGW GCC, PLS-00923: native compilation failed: C compilation or linking
failed:gcc: error: CreateProcess: No such file or directory