LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 07-31-2009, 04:41 AM   #1
eljuventino
LQ Newbie
 
Registered: May 2009
Posts: 26
Blog Entries: 1

Rep: Reputation: 15
compiling with pro*c in linux


hi everyone!!i'm very happy to be one of the most great linux forums in the world and thanks for all great work that u do here!!

i'm new to linux i have some basic but still newer!!i have a project that i work on!!it's a product that has been installed and compiled in AIX system with xlc compiler!!my job here is to migrate this one to red hat linux entreprise 5 and compile all the makefile with GCC
also i have some .pc files that i'm trying to compile with pro*c !!and now i'm stuck with those errors :

$ make all
/usr/local/oracle/9.2.0/bin/proc sqlcheck=full userid=PSMS_USER/PSMS_USER dbms=v7 LINES=YES include=/home/oracle/Open2/COMMON/inc include=/home/oracle/Open2/ps/BOF/inc include=/home/oracle/Open2/ps/inc include=/home/oracle/Open2/ps/inc include=/home/oracle/Open2/syu/inc include=/home/oracle/Open2/lng/inc include=/home/oracle/Open2/lng/inc include=/home/oracle/Open2/com/inc iname=/home/oracle/Open2/ps/BOF/src_EDS/ps_bof_eds_lrmdb.pc

Pro*C/C++: Release 9.2.0.4.0 - Production on Wed Jul 29 13:12:44 2009

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

System default option values taken from: /usr/local/oracle/9.2.0/precomp/admin/pcscfg.cfg

Syntax error at line 365, column 6, file /home/oracle/Open2/ps/inc/ps_parslib_parsers.h:
Error at line 365, column 6 in file /home/oracle/Open2/ps/inc/ps_parslib_parsers
.h
bool CheckAndAssign_String(unsigned char dst_string[],
.....1
PCC-S-02201, Encountered the symbol "CheckAndAssign_String" when expecting one o
f the following:

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

Syntax error at line 376, column 6, file /home/oracle/Open2/ps/inc/ps_parslib_parsers.h:
Error at line 376, column 6 in file /home/oracle/Open2/ps/inc/ps_parslib_parsers
.h
bool get_send_log_flag(void);
.....1
PCC-S-02201, Encountered the symbol "get_send_log_flag" when expecting one of th
e following:

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

Syntax error at line 139, column 4, file /home/oracle/Open2/ps/BOF/inc/ps_bof_comlib_envdata.h:
Error at line 139, column 4 in file /home/oracle/Open2/ps/BOF/inc/ps_bof_comlib_
envdata.h
Input_Queue_Data BOF_iq;
...1
PCC-S-02201, Encountered the symbol "Input_Queue_Data" when expecting one of the
following:

} char, const, double, enum, float, int, long, ulong_varchar,
OCIBFileLocator OCIBlobLocator, OCIClobLocator, OCIDateTime,
OCIExtProcContext, OCIInterval, OCIRowid, OCIDate, OCINumber,
OCIRaw, OCIString, short, signed, sql_context, sql_cursor,
struct, union, unsigned, utext, uvarchar, varchar, void,
volatile, a typedef name,

Syntax error at line 0, column 0, file /home/oracle/Open2/ps/BOF/src_EDS/ps_bof_eds_lrmdb.pc:
Error at line 0, column 0 in file /home/oracle/Open2/ps/BOF/src_EDS/ps_bof_eds_l
rmdb.pc
PCC-S-02201, Encountered the symbol "<eof>" when expecting one of the following:

; : an identifier, end-exec, random_terminal

Error at line 0, column 0 in file /home/oracle/Open2/ps/BOF/src_EDS/ps_bof_eds_l
rmdb.pc
PCC-F-02102, Fatal error while doing C preprocessing
make: *** [/home/oracle/Open2/ps/BOF/src_EDS/ps_bof_eds_lrmdb.c] Erreur 1

this is my sys_include file:

sys_include=(/usr/include,/usr/lib/gcc/i386-redhat-linux/4.1.1/include,/usr/local/oracle/9.2.0/precomp/public)

include=(/usr/local/oracle/9.2.0/precomp/public)

include=(/usr/local/oracle/9.2.0/rdbms/demo)

include=/usr/local/oracle/9.2.0/network)

include=(/usr/local/oracle/9.2.0/plsql/public)

ltype=short

also i post some of the code that contain those errors :

in the file ps_parslib_parsers.c

...
bool CheckAndAssign_String(unsigned char dst_string[],
unsigned char *src_string,
int max_len);


void get_error_prod_mng(int *);
void set_error_prod_mng(int );
void reset_error_prod_mng(void);
void set_send_log_flag(void);
void reset_send_log_flag(void);
bool get_send_log_flag(void);
...

i saerched for the definition of the checkandassign_string function and i found it in another directory in the ps_parslib_parsers.c :

...
/*-----------------------------------------------------------------------------
FUNCTION CheckAndAssign_String
The function executes a copy between strings and then frees the source
string; the length of the source string is checked before assigning it
to the destination string.
The function must be used only with str_val as the source string (it is
the value returned by the parser).
---------------------------------------------------------------------------*/

bool CheckAndAssign_String(unsigned char dst_string[],
unsigned char *src_string,
int max_len)
{
if (strlen((char *)src_string) <= max_len)
{
strcpy((char *)dst_string, (char *)src_string);
/*if (strlen((char *)src_string) != 0)
{
*/
free(src_string);
/*} */
return TRUE;
}
else
{
/*if (strlen((char *)src_string) != 0)
{
*/
free(src_string);
/*} */
return FALSE;
}
}
...

also the input_Queue_Data that figures in the errors i found it in one .h lib like this :

/*=============================================================================
INPUT QUEUE DATA
===========================================================================*/

/*-----------------------------------------------------------------------------
MACROS
---------------------------------------------------------------------------*/

#define IQ_NAME_LEN 48 /* CLSQD.QName's length */

/*-----------------------------------------------------------------------------
TYPES AND STRUCTURES
---------------------------------------------------------------------------*/

typedef struct
{
/* name of the alias queue */
unsigned char nameIQ_NAME_LEN+1;

/* handle of the alias queue */
CLHOBJ handle;

} Input_Queue_Data;


/*=============================================================================
QUEUE MANAGER DATA
===========================================================================*/

/*-----------------------------------------------------------------------------
TYPES AND STRUCTURES
---------------------------------------------------------------------------*/

typedef struct
{
/* time of the wait reading operation on the BOF input queue */
unsigned long wait_time;

/* id of the connection to the queue manager */
CLHCONN connection_id;

/* input queue of BOF process */
Input_Queue_Data BOF_iq;

/* input queue of PSM Scheduler process */
Input_Queue_Data PSM_sched_iq;

} Queue_Manager_Data;

i will be grateful if u help me figure this out!!!if u need any explanation i'm here and thanks again!!
 
Old 07-31-2009, 02:35 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,539

Rep: Reputation: 149Reputation: 149
My guess is that it can't find the bool type. But I don't fully get which compiler you use for this compilation. It doesn't seem to be gcc.
 
Old 07-31-2009, 04:37 PM   #3
johnsfine
Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,142

Rep: Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127
Quote:
Originally Posted by Mara View Post
My guess is that it can't find the bool type.
I'm pretty sure that is correct.

The OP pasted in a whole lot of stuff, most of which doesn't tell us anything. But the quoted errors tell us the C compiler hasn't seen a typedef for bool and doesn't have one built in.

In C++, bool is a built-in type. In C it is not.

The harder thing to guess is where the typedef for bool was supposed to come from. It seems implied that this source code worked elsewhere and is being ported. I assume it is C (not C++) code in both places, so I don't know where the typedef for bool was supposed to be found.
 
Old 08-03-2009, 01:34 AM   #4
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

Rep: Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041
I was wondering if there's a version mismatch here:
/usr/local/oracle/9.2.0/bin/proc ...blah... dbms=v7

Does that version of Pro*C work on that version of the DB? Have you got the correct Pro*C libs?
 
Old 08-03-2009, 03:32 AM   #5
eljuventino
LQ Newbie
 
Registered: May 2009
Posts: 26
Blog Entries: 1

Original Poster
Rep: Reputation: 15
one of the member give me an advice to put in the line of pro*c this CODE=CPP and it's seem work but with some errors:


Citation:
make all
gcc -c -DLINUX -DUNIX_OPSYS -DDEBUG -I/home/oracle/Open2/COMMON/inc -I/home/oracle/Open2/dbg -I. -I/home/oracle/Open2/ps/BOF/inc -I/home/oracle/Open2/ps/inc -I/home/oracle/Open2/ps/inc -I/home/oracle/Open2/com/inc -I/home/oracle/Open2/syu/inc -I/home/oracle/Open2/lng/inc -I/usr/local/oracle/9.2.0/precomp/public /home/oracle/Open2/ps/BOF/src_EDS/ps_bof_eds_lrmdb.c
/home/oracle/Open2/ps/BOF/src_EDS/ps_bof_eds_lrmdb.c:117: erreur: expected identifier or ‘(’ before string constant
/home/oracle/Open2/ps/BOF/src_EDS/ps_bof_eds_lrmdb.c:131: erreur: expected identifier or ‘(’ before string constant
make: *** [/home/oracle/Open2/ps/BOF/src_EDS/ps_bof_eds_lrmdb.o] Erreur 1
et le code c'est le suivant:

Code :

// Prototypes
extern "C" { /*VOICI LA LIGNE ERREUR 117*/
void sqlcxt (void **, unsigned int *,
struct sqlexd *, const struct sqlcxp *);
void sqlcx2t(void **, unsigned int *,
struct sqlexd *, const struct sqlcxp *);
void sqlbuft(void **, char *);
void sqlgs2t(void **, char *);
void sqlorat(void **, unsigned int *, void *);
}

// Forms Interface
static const int IAPSUCC = 0;
static const int IAPFAIL = 1403;
static const int IAPFTL = 535;
extern "C" { void sqliem(char *, int *); }/*VOICI LA LIGNE ERREUR 131*/
 
Old 08-04-2009, 01:21 AM   #6
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

Rep: Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041
I think those errors indicate you're not linking a reqd lib file supplied by Oracle. Unfortunately, its been a long time since I used Pro*C, so I can't tell you what it is.
'extern' means declared here but defined elsewhere (iirc).

hmm this may help, although its a bit over my head, never used C++
http://forums.devshed.com/c-programm...er-472634.html
 
Old 08-04-2009, 07:52 AM   #7
johnsfine
Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,142

Rep: Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127
Quote:
Originally Posted by eljuventino View Post
one of the member give me an advice to put in the line of pro*c this CODE=CPP and it's seem work but with some errors:
It appears that some of the code you are trying to compile is C++ code in files with .c extensions.

That explains why you had a problem with bool which is built into C++ but can't be used in C without having a typedef for it. It also explains why you have a failure with extern "C" which is valid C++ code but meaningless in C.

That CODE=CPP thing sounds like it is intended to deal with that (tell the compiler to ignore the .c extension and process C++ code). But I've never heard of CODE=CPP so I don't know how it should be used and I didn't understand your description of how you did use it.

If it removed the errors with bool then it partially worked. If it didn't remove the error with extern "C" then it didn't completely work, because that is more of the same error. The code is C++ but the compiler was expecting C.

With GCC there are a few ways to force the compiler to process C++ code ignoring the .c extensions. If you are in control of the compile command lines, that may be a simple answer. But I get the idea the compile command lines are put together for you by a complicated makefile. In that case, it may be harder to figure out what to change in order to cause the makefile to generate the compile commands that cause gcc to process C++ code.

I don't speak any French, which makes it a little harder to read your posts, but your posts would be very hard to read even if they were 100% English. Code tags would help. But mainly you need a bit more and better explanation of what you're trying to accomplish and what exactly you did.

Quote:
Originally Posted by chrism01 View Post
I think those errors indicate you're not linking a reqd lib file supplied by Oracle.
I see only compile time errors that certainly don't mean anything like that. So I have no idea where you're seeing that.

Quote:
'extern' means declared here but defined elsewhere (iirc).
Yes, but extern "C" means something else (in addition to or instead of meaning defined elsewhere).

It can be used in C++ code to declare C code defined elsewhere so that C code may be called by this C++ code.
It can also be used to define C++ code (defined here) which presents a C interface so it can be called by C code elsewhere and/or called by other C++ that thinks it is calling C code.

Last edited by johnsfine; 08-04-2009 at 07:58 AM.
 
Old 08-05-2009, 02:11 AM   #8
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

Rep: Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041
Like I said, never used C++ ... that's why I didn't know that bit. The link seems to refer to this situation.
 
Old 08-05-2009, 04:06 AM   #9
eljuventino
LQ Newbie
 
Registered: May 2009
Posts: 26
Blog Entries: 1

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by johnsfine View Post
It appears that some of the code you are trying to compile is C++ code in files with .c extensions.

That explains why you had a problem with bool which is built into C++ but can't be used in C without having a typedef for it. It also explains why you have a failure with extern "C" which is valid C++ code but meaningless in C.

That CODE=CPP thing sounds like it is intended to deal with that (tell the compiler to ignore the .c extension and process C++ code). But I've never heard of CODE=CPP so I don't know how it should be used and I didn't understand your description of how you did use it.

If it removed the errors with bool then it partially worked. If it didn't remove the error with extern "C" then it didn't completely work, because that is more of the same error. The code is C++ but the compiler was expecting C.

With GCC there are a few ways to force the compiler to process C++ code ignoring the .c extensions. If you are in control of the compile command lines, that may be a simple answer. But I get the idea the compile command lines are put together for you by a complicated makefile. In that case, it may be harder to figure out what to change in order to cause the makefile to generate the compile commands that cause gcc to process C++ code.

I don't speak any French, which makes it a little harder to read your posts, but your posts would be very hard to read even if they were 100% English. Code tags would help. But mainly you need a bit more and better explanation of what you're trying to accomplish and what exactly you did.


I see only compile time errors that certainly don't mean anything like that. So I have no idea where you're seeing that.



Yes, but extern "C" means something else (in addition to or instead of meaning defined elsewhere).

It can be used in C++ code to declare C code defined elsewhere so that C code may be called by this C++ code.
It can also be used to define C++ code (defined here) which presents a C interface so it can be called by C code elsewhere and/or called by other C++ that thinks it is calling C code.
thanks a lot of your help and a good explanation!!CODE=CPP i use it in the pro*c line of precompilation!!know i use this solution and i do some modification that can put away the error related to extern "C" biut i'm afraid that not the correct solution and after that in the execution all goes wrong!!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HD1:IDE Suse 10.2 & Windows Xp Pro HD HD2: SATA XP PRO X64 HOW TO MOUNT HD 2 blazintilda2005 Linux - Hardware 1 04-13-2007 09:30 PM
Problems compiling driver for VIA P4M800 Pro ShadeX_12 Linux - Hardware 0 11-16-2006 10:03 PM
MDK10 + ATI 9500 Pro + IIYAMA VM PRO 410 Refresh Rate Problem Paladin13 Mandriva 2 06-29-2004 10:02 AM


All times are GMT -5. The time now is 05:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration