Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with Oracle 12.2 precompiler #9778

Closed
wolfiepop1974 opened this issue Sep 5, 2019 · 21 comments
Closed

Problem with Oracle 12.2 precompiler #9778

wolfiepop1974 opened this issue Sep 5, 2019 · 21 comments
Labels
resolved: answered The issue contained a question which has been answered

Comments

@wolfiepop1974
Copy link

wolfiepop1974 commented Sep 5, 2019

When i try to compile with proc precompiler i get a lot of messages of this tipe:

Syntax error at line 20, column 27, file /usr/include/openssl/comp.h:
Error at line 20, column 27 in file /usr/include/openssl/comp.h
    int (*init) (COMP_CTX *ctx);
..........................1
PCC-S-02201, Encountered the symbol "*" when expecting one of the following:

   , )

Syntax error at line 21, column 30, file /usr/include/openssl/comp.h:
Error at line 21, column 30 in file /usr/include/openssl/comp.h
    void (*finish) (COMP_CTX *ctx);
.............................1
PCC-S-02201, Encountered the symbol "*" when expecting one of the following:

   , )

Syntax error at line 22, column 31, file /usr/include/openssl/comp.h:
Error at line 22, column 31 in file /usr/include/openssl/comp.h
    int (*compress) (COMP_CTX *ctx,
..............................1
PCC-S-02201, Encountered the symbol "*" when expecting one of the following:

   , )

Syntax error at line 25, column 29, file /usr/include/openssl/comp.h:
Error at line 25, column 29 in file /usr/include/openssl/comp.h
    int (*expand) (COMP_CTX *ctx,
............................1
PCC-S-02201, Encountered the symbol "*" when expecting one of the following:

   , )

Syntax error at line 44, column 10, file /usr/include/openssl/comp.h:
Error at line 44, column 10 in file /usr/include/openssl/comp.h
COMP_CTX *COMP_CTX_new(COMP_METHOD *meth);
.........1
PCC-S-02201, Encountered the symbol "*" when expecting one of the following:

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

Syntax error at line 45, column 29, file /usr/include/openssl/comp.h:
Error at line 45, column 29 in file /usr/include/openssl/comp.h
void COMP_CTX_free(COMP_CTX *ctx);
............................1
PCC-S-02201, Encountered the symbol "*" when expecting one of the following:

   , )


The same happens with another header files, like env.p, asn1.h, etc. More examples:

Error at line 654, column 36 in file /usr/include/openssl/evp.h
   654  void EVP_EncodeInit(EVP_ENCODE_CTX *ctx);
   654  ...................................1
   654  PCC-S-02201, Encountered the symbol "*" when expecting one of the follo
        wing:
        
           , )
        
Error at line 655, column 38 in file /usr/include/openssl/evp.h
   655  void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *out
        l,
   655  .....................................1
   655  PCC-S-02201, Encountered the symbol "*" when expecting one of the follo
        wing:
        
           , )

Error at line 992, column 29 in file /usr/include/openssl/asn1.h
   992  int ASN1_i2d_fp(i2d_of_void *i2d, FILE *out, void *x);
   992  ............................1
   992  PCC-S-02201, Encountered the symbol "*" when expecting one of the follo
        wing:
        
           , )
        
Error at line 1011, column 42 in file /usr/include/openssl/asn1.h
  1011  void *ASN1_d2i_bio(void *(*xnew) (void), d2i_of_void *d2i, BIO *in, voi
        d **x);
  1011  .........................................1
  1011  PCC-S-02201, Encountered the symbol "d2i_of_void" when expecting one of
         the following:
        
           ... auto, char, const, double, enum, float, int, long,
           ulong_varchar, OCIBFileLocator OCIBlobLocator,
           OCIClobLocator, OCIDateTime, OCIExtProcContext, OCIInterval,
           OCIRowid, OCIDate, OCINumber, OCIRaw, OCIString, register,
           short, signed, sql_context, sql_cursor, static, struct,
           union, unsigned, utext, uvarchar, varchar, void, volatile,
           a typedef name, exec oracle, exec oracle begin, exec,
           exec sql, exec sql begin, exec sql type, exec sql var,
        The symbol "enum," was substituted for "d2i_of_void" to continue.

Is possible to integrate OpenSSL with Oracle Pro*C? i was searching on tne net about this topic but i couldn't find nothing at all....

I tried to analize this case, and i think that the problem is on the precompiler, because the typedef struct is not taken on count on the same header file, like it doesn't exist....

@wolfiepop1974 wolfiepop1974 added the issue: bug report The issue was opened to report a bug label Sep 5, 2019
@levitte
Copy link
Member

levitte commented Sep 5, 2019

Note: message re-edited to add better mardown markup for output text

@levitte
Copy link
Member

levitte commented Sep 5, 2019

I assume that you're building an application of your own, is that it? Can you show the #include lines from the C unit that fails to build?

@levitte
Copy link
Member

levitte commented Sep 5, 2019

It might be as simple as you needing to #include <openssl/ossl_typ.h> first...

@wolfiepop1974
Copy link
Author

I'm using two includes in my .pc file:

#include <openssl/ssl.h>
#include <openssl/err.h>

If i compile using gcc everything goes fine, but using proc i have the problem...

On my component i'm adding TLS 1.2 security on the sockets already implemented... The syntax for using OpenSSL don't have problem, this happens on the precompiler phase....

@levitte
Copy link
Member

levitte commented Sep 5, 2019

I have no idea how that precompiler works, like what assumptions it works under...

@wolfiepop1974
Copy link
Author

wolfiepop1974 commented Sep 5, 2019

On the messages obtained, looks like the definition of the structure wasn't identified by the precompiler. But the strange point is that the definition happened a few lines before that the function prototype...

The OpenSSL version is 1.0.1p

@levitte
Copy link
Member

levitte commented Sep 5, 2019

Oh wow, that's an old OpenSSL! That's older than I have answers for...
(the 1.0.1 series reached end-of-life a while ago already, so we have dropped support for it)

The best I can suggest is to start with upgrading to 1.0.2. It should be compatible with what you're using today. Eventually, you will have to upgrade to even newer, but 1.0.2 is good enough for now.

@wolfiepop1974
Copy link
Author

I agree, thats an old version.... but the user has problems with the environment... we are trying to use 1.0.2r....

@levitte
Copy link
Member

levitte commented Sep 5, 2019

Do you have this same problem with 1.0.2r?

@wolfiepop1974
Copy link
Author

wolfiepop1974 commented Sep 5, 2019

Some similar....

Syntax error at line 22, column 31, file /usr/include/openssl/comp.h:
Error at line 22, column 31 in file /usr/include/openssl/comp.h
    int (*compress) (COMP_CTX *ctx,
..............................1
PCC-S-02201, Encountered the symbol "*" when expecting one of the following:

I continue searching on the Net, but now looking for environment on gcc and proc, and i found that if i collect the path used by the GCC i can solved the mayor part of them.... i'm on this...

@wolfiepop1974
Copy link
Author

After change that path environment i got only two messages, one is the same on typedef struct and another one is about another include of gcc......

@wolfiepop1974
Copy link
Author

wolfiepop1974 commented Sep 5, 2019

I've added:
/usr/include/openssl,/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2/include,/usr/include

to the path of libraries on proc y now i got:

Syntax error at line 239, column 24, file openssl/bio.h:
Error at line 239, column 24 in file openssl/bio.h
void BIO_set_flags(BIO *b, int flags);
.......................1
PCC-S-02201, Encountered the symbol "*" when expecting one of the following:

   , )

@levitte
Copy link
Member

levitte commented Sep 5, 2019

Why did you add /usr/include/openssl? That's completely unnecessary, because the inclusion directives are expected to be like #include <openssl/bio.h>

@wolfiepop1974
Copy link
Author

wolfiepop1974 commented Sep 5, 2019

It looks like unnecessary, but it helps to reduce the number of errors....

Now the error looks like the others, one struct dont recognized, but defined a few lines before on the same header file:

typedef struct bio_st BIO; (the definition of struct)

void BIO_set_flags(BIO *b, int flags);      (* don't recognized by the precompiler)

@levitte
Copy link
Member

levitte commented Sep 5, 2019

You're not showing what you're actually doing, so there's not much we can say...

@wolfiepop1974
Copy link
Author

wolfiepop1974 commented Sep 5, 2019

The error was posted, one step before you ask why i do that change....

The path in the configuration of the precompiler was the only change. I obtained that path collecting the info of the gcc compiler, and pasting that path on the precompiler.

That was the only change, and i got less errors, as i said before. And still in 1.0.1p, tomorrow we will update to 1.0.2p and repeat the testing.

The proc precompiler take a configuration file, in that file i added the path i showed before. That was the only change, nothing in my component and nothing in OpenSSL. What more do you need to see?

@levitte
Copy link
Member

levitte commented Sep 5, 2019

You talk as if I somehow knew anything about that precompiler. I know nothing about it, I do not know how you run it, on what you run it, or what to expect from it. I said so among my first comments. And yet, you continue to present me errors, and seem to think that it will somehow provide enough knowledge...

That being said, it looks to me like that precompiler doesn't deal well with types that, at least as far as it's able to read, are opaque (i.e it's a typedef of a struct where the struct itself isn't defined). Could that guess lead to something fruitful?

(is there a manual for this precompiler that you can give us a url to?)

@wolfiepop1974
Copy link
Author

OK, i was posting the message in the hope that somebody could help me. Sorry if feel this like personal.

The precompiler "translates" a series of special commands that Oracle recognize into ansi C sentences for make posible his compilation into a exe file.

This is the URL for the documentation of this precompiler: https://docs.oracle.com/cd/E11882_01/appdev.112/e10825/toc.htm

I agree that this tool looks "incomplete" about the precoessing of all the capabilities of Ansi C, and i think tahtat it has limitations on the use of structures of ansi C (been typedef struct one of this structures).

This is not a problem of OpenSSL, the structures are defined and are utilized on the flow of the application, but is a fact that the precompiler has problems parsing the header files.

@wolfiepop1974
Copy link
Author

wolfiepop1974 commented Sep 8, 2019 via email

@michael-o
Copy link
Contributor

michael-o commented Sep 17, 2019

If OpenSSL uses C99, you have a problem. Pro*C does not properly support C99 mode. The best you can do -- and this is what we do -- wrap your code with defines and add it to the proc call. That code path will be disabled for the Oracle preprocessor, but then picked up by your compiler and its preprocessor. At worst, file an issue in MOSC. At best, migrate to unixODBC and Oracle's ODBC driver.

@levitte levitte added resolved: answered The issue contained a question which has been answered and removed issue: bug report The issue was opened to report a bug labels Dec 5, 2019
@mattcaswell mattcaswell added resolved: answered The issue contained a question which has been answered and removed resolved: answered The issue contained a question which has been answered labels Dec 5, 2019
@mattcaswell
Copy link
Member

This question seems to have been answered. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolved: answered The issue contained a question which has been answered
Projects
None yet
Development

No branches or pull requests

4 participants