1751925 Members
5123 Online
108783 Solutions
New Discussion юеВ

C compiler error

 
Javier Ortiz Guajardo
Frequent Advisor

C compiler error

Hi. I have this problem, we are migrating from server HP-UX form HP-UX 11.0 64bits PA-RISK to HP-UX 11.23 64bit ia64 integrity server model.
I have a C program and i receive this error

/libda05/dnpl/source $cc -Ae -lm SAP718B.c -lcl -lcurses -o SAP718B
"SAP718B.c", line 317: warning #3197-D: the prototype declaration of
"FILE *fopen(const char *, const char *)" (declared at line 285 of
"/usr/include/stdio.h") is ignored after this unprototyped
redeclaration
FILE *fopen(), *fp1;
^

"SAP718B.c", line 660: warning #2111-D: statement is unreachable
a=system("date");
^

ld: Unsatisfied symbol "RfcReceive" in file SAP718B.o
ld: Unsatisfied symbol "RfcOpen" in file SAP718B.o
ld: Unsatisfied symbol "RfcClose" in file SAP718B.o
ld: Unsatisfied symbol "RfcCall" in file SAP718B.o
4 errors.

i┬┤ve already put the libraries in the /usr/lib.

The c programs has this line
RfcRc = RfcReceive hRfc,Importing,Tables,&RfcException);

Please your help to solve the problem.
The obstacles are those things that the people see when they left to see their goals.
6 REPLIES 6
Sandman!
Honored Contributor

Re: C compiler error

Javier,

Seems like you are not linking your source code to any of the SAP libraries. It is possible that your source code depends on them, more so since this error is being reported by the link-loader (ld), which resolves external dependencies.

~hope it helps
Javier Ortiz Guajardo
Frequent Advisor

Re: C compiler error

Ok i found the library but now i receive the following error

922:/libda05/dnpl/source => cc -lm SAP718B.c /usr/lib/librfc.a -lcl -lcurses >
"SAP718B.c", line 317: warning #3197-D: the prototype declaration of
"FILE *fopen(const char *, const char *)" (declared at line 285 of
"/usr/include/stdio.h") is ignored after this unprototyped
redeclaration
FILE *fopen(), *fp1;
^

"SAP718B.c", line 660: warning #2111-D: statement is unreachable
a=system("date");
^

ld: Mismatched Data ABI. Expected None but found EF_IA_64_ABI64 in file /usr/lib/librfc.a[rfcilib.o]
Fatal error.

Please your help.
The obstacles are those things that the people see when they left to see their goals.
Sandman!
Honored Contributor

Re: C compiler error

Javier,

You have to compile your source in 64-bit mode by supplying the +DD64 switch at the command line i.e.

# cc +DD64 -lm SAP718B.c ...

~hope it helps
A. Clay Stephenson
Acclaimed Contributor

Re: C compiler error

The first warning is easy:

FILE *fopen(), *fp1;
^
simply change this to:
FILE *fp1;

because your unprototyped function declaration reflects a coding that is at least 15 years out of date. fopen is already declared in an included header file so your declaration is not needed and conflicts with the prior definition.


"SAP718B.c", line 660: warning #2111-D: statement is unreachable
a=system("date");

This one is more difficult but it is telling you that this statement will never be executed because, for example, it follows an unconditional return or exit or it is enclosed in a condition that is always false.


ld: Mismatched Data ABI. Expected None but found EF_IA_64_ABI64 in file /usr/lib/librfc.a[rfcilib.o]
Fatal error.

This one is telling you that you have mismatched binaries between your object files and those of this library. This can be the result of not compiling all the objects under the same data model or even mismatched machine types.
If it ain't broke, I can fix that.
Arunvijai_4
Honored Contributor

Re: C compiler error

Hi,

You need to have IA-64 version of the library which you are trying to link. Otherwise, you will receive mismatched ABI error.

Prior to compile, export CFLAGS, CPPFLAGS and LDFLAGS.

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Dennis Handly
Acclaimed Contributor

Re: ld errors on Integrity

$ cc -lm SAP718B.c /usr/lib/librfc.a -lcl -lcurses
ld: Mismatched Data ABI. Expected None but found EF_IA_64_ABI64 in file /usr/lib/librfc.a[rfcilib.o]

As Arun says, you need a IPF version of librfc. These would typically be in /usr/lib/hpux32/ or /usr/lib/hpux64/.

If you used -lrfc, the linker would find the right one.

(Note: -lm should be after your .c or .o files.  This is why you get that mismatch, it finds the PA libm first.
Also -lcl should be replaced by -lunwind, unless you need some Fortran libs.)