LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   cpp command for .pc file (https://www.linuxquestions.org/questions/programming-9/cpp-command-for-pc-file-757512/)

eljuventino 09-24-2009 10:43 AM

cpp command for .pc file
 
hello everyone !!!i'm here again for he help and i'm grateful for all the members that help me go on with my project!!i'm porting a product from aix system to linux rhel5 system !!

i'm compiling withy gcc and i'm using pro*C for precompiling!!
i have in one of the makefiles that i have to compile .pc file with cpp then put the reslt of this command in ...tmp.pc than precompile this one with pro*C :

1- do a cpp command to .pc file.
2-put the result of this command to ...tmp.pc file.
3-precompile with pro*C the ...tmp.pc file.

is that possible to do a cpp command to a .pc file ?

anyway i execute the cpp command to the .pc file
then this result :

Code:

# 1 "su_lgm_lib_commit.pc"
# 1 "<interne>"
# 1 "<ligne de commande>"
# 1 "su_lgm_lib_commit.pc"
# 22 "su_lgm_lib_commit.pc"
# 1 "/usr/local/oracle/9.2.0/precomp/public/sqlca.h" 1
# 59 "/usr/local/oracle/9.2.0/precomp/public/sqlca.h"
struct sqlca
        {
                  char sqlcaid[8];
                  int sqlabc;
                  int sqlcode;
        struct
          {
                    unsigned short sqlerrml;
                    char sqlerrmc[70];
          } sqlerrm;
                  char sqlerrp[8];
                  int sqlerrd[6];
                  char sqlwarn[8];
                  char sqlext[8];
        };





        struct sqlca sqlca
# 94 "/usr/local/oracle/9.2.0/precomp/public/sqlca.h"
        ;
# 23 "su_lgm_lib_commit.pc" 2
# 1 "su_lgm.h" 1
# 18 "su_lgm.h"
# 1 "/home/oracle/Open2/syu/inc/su_globals.h" 1
# 22 "/home/oracle/Open2/syu/inc/su_globals.h"
static char globals_h[]="@(#)$Workfile:  su_globals.h  $,$Revision: 2.1 $,$Modtime:  30 Jan 2003 15:36:32  $";
static char su_globals_h[] = "@(#)## su_globals.h 02.00.00 17/07/97 $Revision: 2.1 $";
# 19 "su_lgm.h" 2
# 1 "/home/oracle/Open2/syu/inc/su_logclass.h" 1
# 21 "/home/oracle/Open2/syu/inc/su_logclass.h"
static char logclass_h[]="@(#)$Workfile:  su_logclass.h  $,$Revision: 2.1 $,$Modtime:  05 Feb 2003 11:39:48  $";
static char su_logclass_h[] = "@(#)## su_logclass.h 02.01.01 07/10/97 $Revision: 2.1 $";
# 20 "su_lgm.h" 2
#include "/usr/include/stdio.h"
#include "/usr/include/features.h"
#include "/usr/include/sys/cdefs.h"
#include "/usr/include/bits/wordsize.h
#include/usr/include/gnu/stubs.h"



# 1 "/usr/include/bits/wordsize.h" 1 3 4
# 5 "/usr/include/gnu/stubs.h" 2 3 4


# 1 "/usr/include/gnu/stubs-32.h" 1 3 4
# 8 "/usr/include/gnu/stubs.h" 2 3 4
# 353 "/usr/include/features.h" 2 3 4
# 29 "/usr/include/stdio.h" 2 3 4
...

after that the precompilatin with pro*C and i got those errors:

Code:

Pro*C/C++: Release 9.2.0.4.0 - Production on Thu Sep 24 13:21:37 2009

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

Error at line 0, column 0 in file su_lgm_lib_commit_tmp.pc
PCC-F-02102, Fatal error while doing C preprocessing
Error at line 44, column 30 in file su_lgm_lib_commit_tmp.pc
    44  # 1 "/usr/include/stdio.h" 1 3 4
    44  .............................1
    44  PCC-S-02014, Encountered the symbol "3" when expecting one of the follo
        wing:
       
          newline,
       
Error at line 45, column 31 in file su_lgm_lib_commit_tmp.pc
    45  # 28 "/usr/include/stdio.h" 3 4
    45  ..............................1
    45  PCC-S-02014, Encountered the symbol "4" when expecting one of the follo
        wing:
       
          newline,
       
Error at line 46, column 33 in file su_lgm_lib_commit_tmp.pc
    46  # 1 "/usr/include/features.h" 1 3 4
    46  ................................1
    46  PCC-S-02014, Encountered the symbol "3" when expecting one of the follo
        wing:
       
          newline,
       
Error at line 47, column 35 in file su_lgm_lib_commit_tmp.pc
    47  # 329 "/usr/include/features.h" 3 4
    47  ..................................1
    47  PCC-S-02014, Encountered the symbol "4" when expecting one of the follo
        wing:
       
          newline,
       
Error at line 48, column 34 in file su_lgm_lib_commit_tmp.pc
    48  # 1 "/usr/include/sys/cdefs.h" 1 3 4
    48  .................................1
    48  PCC-S-02014, Encountered the symbol "3" when expecting one of the follo
        wing:
       
          newline,
       
Error at line 49, column 36 in file su_lgm_lib_commit_tmp.pc
    49  # 313 "/usr/include/sys/cdefs.h" 3 4
    49  ...................................1
    49  PCC-S-02014, Encountered the symbol "4" when expecting one of the follo
        wing:
       
          newline,
       
Error at line 50, column 38 in file su_lgm_lib_commit_tmp.pc
    50  # 1 "/usr/include/bits/wordsize.h" 1 3 4
    50  .....................................1
    50  PCC-S-02014, Encountered the symbol "3" when expecting one of the follo
        wing:
       
          newline,
       
Error at line 51, column 36 in file su_lgm_lib_commit_tmp.pc
    51  # 314 "/usr/include/sys/cdefs.h" 2 3 4
    51  ...................................1
    51  PCC-S-02014, Encountered the symbol "3" when expecting one of the follo
        wing:
       
          newline,
       
Error at line 52, column 35 in file su_lgm_lib_commit_tmp.pc
    52  # 330 "/usr/include/features.h" 2 3 4
    52  ..................................1
    52  PCC-S-02014, Encountered the symbol "3" when expecting one of the follo
        wing:
       
          newline,

obviously all those problem are because the precompile doesn't understand 1 23 near the .h file i tried to replace those number with include it works and the errors goes away but it's evident it's not the correct solution!!

finally i tried to precompile directly the .pc file it works but the problem but i don't undersatn why the creators of the product do this when they compile the code in AIX.

i hope that u can help me with this!!!
any idea that can help me with this

Sergei Steshenko 09-24-2009 01:09 PM

Quote:

Originally Posted by eljuventino (Post 3695658)
hello everyone !!!i'm here again for he help and i'm grateful for all the members that help me go on with my project!!i'm porting a product from aix system to linux rhel5 system !!

i'm compiling withy gcc and i'm using pro*C for precompiling!!
i have in one of the makefiles that i have to compile .pc file with cpp then put the reslt of this command in ...tmp.pc than precompile this one with pro*C :

1- do a cpp command to .pc file.
2-put the result of this command to ...tmp.pc file.
3-precompile with pro*C the ...tmp.pc file.

is that possible to do a cpp command to a .pc file ?

anyway i execute the cpp command to the .pc file
then this result :

Code:

# 1 "su_lgm_lib_commit.pc"
# 1 "<interne>"
# 1 "<ligne de commande>"
# 1 "su_lgm_lib_commit.pc"
# 22 "su_lgm_lib_commit.pc"
# 1 "/usr/local/oracle/9.2.0/precomp/public/sqlca.h" 1
# 59 "/usr/local/oracle/9.2.0/precomp/public/sqlca.h"
struct sqlca
        {
                  char sqlcaid[8];
                  int sqlabc;
                  int sqlcode;
        struct
          {
                    unsigned short sqlerrml;
                    char sqlerrmc[70];
          } sqlerrm;
                  char sqlerrp[8];
                  int sqlerrd[6];
                  char sqlwarn[8];
                  char sqlext[8];
        };





        struct sqlca sqlca
# 94 "/usr/local/oracle/9.2.0/precomp/public/sqlca.h"
        ;
# 23 "su_lgm_lib_commit.pc" 2
# 1 "su_lgm.h" 1
# 18 "su_lgm.h"
# 1 "/home/oracle/Open2/syu/inc/su_globals.h" 1
# 22 "/home/oracle/Open2/syu/inc/su_globals.h"
static char globals_h[]="@(#)$Workfile:  su_globals.h  $,$Revision: 2.1 $,$Modtime:  30 Jan 2003 15:36:32  $";
static char su_globals_h[] = "@(#)## su_globals.h 02.00.00 17/07/97 $Revision: 2.1 $";
# 19 "su_lgm.h" 2
# 1 "/home/oracle/Open2/syu/inc/su_logclass.h" 1
# 21 "/home/oracle/Open2/syu/inc/su_logclass.h"
static char logclass_h[]="@(#)$Workfile:  su_logclass.h  $,$Revision: 2.1 $,$Modtime:  05 Feb 2003 11:39:48  $";
static char su_logclass_h[] = "@(#)## su_logclass.h 02.01.01 07/10/97 $Revision: 2.1 $";
# 20 "su_lgm.h" 2
#include "/usr/include/stdio.h"
#include "/usr/include/features.h"
#include "/usr/include/sys/cdefs.h"
#include "/usr/include/bits/wordsize.h
#include/usr/include/gnu/stubs.h"



# 1 "/usr/include/bits/wordsize.h" 1 3 4
# 5 "/usr/include/gnu/stubs.h" 2 3 4


# 1 "/usr/include/gnu/stubs-32.h" 1 3 4
# 8 "/usr/include/gnu/stubs.h" 2 3 4
# 353 "/usr/include/features.h" 2 3 4
# 29 "/usr/include/stdio.h" 2 3 4
...

after that the precompilatin with pro*C and i got those errors:

Code:

Pro*C/C++: Release 9.2.0.4.0 - Production on Thu Sep 24 13:21:37 2009

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

Error at line 0, column 0 in file su_lgm_lib_commit_tmp.pc
PCC-F-02102, Fatal error while doing C preprocessing
Error at line 44, column 30 in file su_lgm_lib_commit_tmp.pc
    44  # 1 "/usr/include/stdio.h" 1 3 4
    44  .............................1
    44  PCC-S-02014, Encountered the symbol "3" when expecting one of the follo
        wing:
       
          newline,
       
Error at line 45, column 31 in file su_lgm_lib_commit_tmp.pc
    45  # 28 "/usr/include/stdio.h" 3 4
    45  ..............................1
    45  PCC-S-02014, Encountered the symbol "4" when expecting one of the follo
        wing:
       
          newline,
       
Error at line 46, column 33 in file su_lgm_lib_commit_tmp.pc
    46  # 1 "/usr/include/features.h" 1 3 4
    46  ................................1
    46  PCC-S-02014, Encountered the symbol "3" when expecting one of the follo
        wing:
       
          newline,
       
Error at line 47, column 35 in file su_lgm_lib_commit_tmp.pc
    47  # 329 "/usr/include/features.h" 3 4
    47  ..................................1
    47  PCC-S-02014, Encountered the symbol "4" when expecting one of the follo
        wing:
       
          newline,
       
Error at line 48, column 34 in file su_lgm_lib_commit_tmp.pc
    48  # 1 "/usr/include/sys/cdefs.h" 1 3 4
    48  .................................1
    48  PCC-S-02014, Encountered the symbol "3" when expecting one of the follo
        wing:
       
          newline,
       
Error at line 49, column 36 in file su_lgm_lib_commit_tmp.pc
    49  # 313 "/usr/include/sys/cdefs.h" 3 4
    49  ...................................1
    49  PCC-S-02014, Encountered the symbol "4" when expecting one of the follo
        wing:
       
          newline,
       
Error at line 50, column 38 in file su_lgm_lib_commit_tmp.pc
    50  # 1 "/usr/include/bits/wordsize.h" 1 3 4
    50  .....................................1
    50  PCC-S-02014, Encountered the symbol "3" when expecting one of the follo
        wing:
       
          newline,
       
Error at line 51, column 36 in file su_lgm_lib_commit_tmp.pc
    51  # 314 "/usr/include/sys/cdefs.h" 2 3 4
    51  ...................................1
    51  PCC-S-02014, Encountered the symbol "3" when expecting one of the follo
        wing:
       
          newline,
       
Error at line 52, column 35 in file su_lgm_lib_commit_tmp.pc
    52  # 330 "/usr/include/features.h" 2 3 4
    52  ..................................1
    52  PCC-S-02014, Encountered the symbol "3" when expecting one of the follo
        wing:
       
          newline,

obviously all those problem are because the precompile doesn't understand 1 23 near the .h file i tried to replace those number with include it works and the errors goes away but it's evident it's not the correct solution!!

finally i tried to precompile directly the .pc file it works but the problem but i don't undersatn why the creators of the product do this when they compile the code in AIX.

i hope that u can help me with this!!!
any idea that can help me with this

AFAIK .pc files are the ones used by 'pkg-config' - have you tried

man 1 pkg-config

?

If yes, have you read the DESCRIPTION part (line #13 in my case) ?

The part gives a typical command line.


Maybe in your case .pc files are used for something else - I don't know.

eljuventino 09-24-2009 01:24 PM

.pc is an extension for the file that can precompild with pro*C!!!

chrism01 09-25-2009 12:10 AM

When I used to work with Pro*C, you wrote your C and SQL code into a .pc file, then the Oracle Pre-compiler converted the Oracle stuff into pure C (ie you get a *.c file), then you used a normal C compiler to compile and link.
Your 1st post sounds like you're trying to compile, then pre-compile.

eljuventino 09-25-2009 04:16 AM

Quote:

Originally Posted by chrism01 (Post 3696385)
When I used to work with Pro*C, you wrote your C and SQL code into a .pc file, then the Oracle Pre-compiler converted the Oracle stuff into pure C (ie you get a *.c file), then you used a normal C compiler to compile and link.
Your 1st post sounds like you're trying to compile, then pre-compile.

yeah that's what i did all the time !!but now in the makefile where i try to lauch first it compile the .pc file with the command cpp then the makefile launch the command to precompile with pro*C to get in the final the pure C .*
the problem that i'm try to port the product and those makefile which are prepared for compiling its better to not modify it.that's the problem for me .the main question is :can we launch the cpp command ion .pc file ?
if that possible what's the idea for doing it ?
or can i just do what i usually do that i precompile .pc file then compile it with gcc?


All times are GMT -5. The time now is 11:19 PM.