Kailash
Kailash

Reputation: 63

Pro*C compilation on RHEL 8, problem in including math.h

I've a simple C code which I'm trying to compile on RHEL 8 machine wherein Oracle 19c client is installed. Here's the program:

#include <stdlib.h>
/* #include <math.h> */
#include <stdio.h>

void main()
{
  printf("\nHey!!\n");
}

This code gets compiled well with gcc as well as proc (Pro*C pre-compiler) commands.

But once I uncomment #include <math.h>, a lot of syntax errors are reported when proc command is run.

Command that I'm running is:

proc iname=test.c oname=test.cp \
                          include=/usr/lib/gcc/x86_64-redhat-linux/8/include/ \
                          include=. \
                          userid=<db connection string> \
                          sqlcheck=full \
                          define=ORACLE_PRECOMPILE \
                          code=ansi_c \
                          char_map=string \
                          dbms=v8 \
                          lines=yes \
                          ltype=long \
                          oraca=yes \
                          parse=full \
                          select_error=yes \
                          unsafe_null=yes

Syntax errors reported are (copying couple of errors only):

Syntax error at line 62, column 1, file /usr/include/bits/mathcalls.h:
Error at line 62, column 1 in file /usr/include/bits/mathcalls.h
__MATHCALL_VEC (cos,, (_Mdouble_ __x));
1
PCC-S-02201, Encountered the symbol "extern" when expecting one of the following
:

   ; , = ( [
The symbol ";" was substituted for "extern" to continue.

Syntax error at line 64, column 1, file /usr/include/bits/mathcalls.h:
Error at line 64, column 1 in file /usr/include/bits/mathcalls.h
__MATHCALL_VEC (sin,, (_Mdouble_ __x));
1
PCC-S-02201, Encountered the symbol "extern" when expecting one of the following
:

   ; , = ( [
The symbol ";" was substituted for "extern" to continue.

This same command works well when #include <math.h> is commented.

Also, this command works fine on old RHEL 6 machine even when math.h is included (of course after changing include path to RHEL 6 machine's include directory).

I tried searching for solution of this problem on internet but couldn't find any helpful article.

OS version:

cat os-release
NAME="Red Hat Enterprise Linux"
VERSION="8.4 (Ootpa)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="8.4"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Red Hat Enterprise Linux 8.4 (Ootpa)"

Any help on this will be very useful.

Upvotes: 1

Views: 2502

Answers (1)

Dave
Dave

Reputation: 11

I had the dame issue and simply added the line

define=_MATH_H

to the pcscfg.cfg located in the $ORACLE_HOME/precomp/admin directory which fixed the issue for me.

Upvotes: 1

Related Questions