Operating System - Linux
1753318 Members
6320 Online
108792 Solutions
New Discussion юеВ

Error: ld: Duplicate symbol "sqlca" in files

 
Sreenivas RK
New Member

Error: ld: Duplicate symbol "sqlca" in files

Hello:
I am running into the exact same issue that was discussed earlier in the forum. However, the options specified and solutions suggested does not seem to work for me.

Here is my aCC environment:
/opt/aCC/bin/aCC:
$Revision: 92453-07 linker linker crt0.o B.11.37 040218 $
HP aC++ B3910B A.03.65
HP aC++ B3910B A.03.52 Language Support Library

and ld environment:
/opt/aCC/bin/aCC:
$Revision: 92453-07 linker linker crt0.o B.11.37 040218 $
HP aC++ B3910B A.03.65
HP aC++ B3910B A.03.52 Language Support Library

I tried the options of passing -Wl,-hsqlca
--> No change. Keep getting the Duplicate symbol error.
Tried passing +allowdups
--> that option is not recognized.

As Peter Gordon had mentioned in his first posting at http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=72147&admit=-682735245+1172421739710+28353475
These are coming in from two files that are written in ProC and have to use sqlca.

Anyone who has run into this issue and resolved this, if they could post the resolution will be VERY helpful.. :-)

Thanks in advance....
-RK
4 REPLIES 4
Dennis Handly
Acclaimed Contributor

Re: Error: ld: Duplicate symbol "sqlca" in files

It seems you need a Pro*C++, not Pro*C.

>and ld environment:

Why repeat the aCC version twice, just say you use aCC to link.

>I tried the options of passing -Wl,-hsqlca
--> No change. Keep getting the Duplicate symbol error.

The only way this will work is if you use ld -r and that -h option on one of the objects. And that sqlca are really separate objects and shouldn't have the same address. This doesn't seem correct because Pro*C would have made them static. So perhaps a better solution is to change all but one into extern.

>Tried passing +allowdups
--> that option is not recognized.

This is a ld option, so you need: -Wl,+allowdups
Sreenivas RK
New Member

Re: Error: ld: Duplicate symbol "sqlca" in files

Thank you Dennis for that answer...

Agreed! would have been enough to say I use aCC :-)

I tried passing it down to the linker using the -Wl option (before posting this originally) but that did not seem to work
and it was ill complaining about unrecognized option.

<>
That would make sense but I think the way Oracle has designed it is not that way.. (my understanding)....

<>
sqlca is defined in a header file provided by Oracle. You either include it or do not. If I take that header file and hack it in, it is not going to be portable going forward.... and we could run into issues migrating to future releases. Any ideas on how I can cirumvent that?

This dups issue does not happen if I use the Ae option of aCC. I cannot use just Ae, since we are migrating from 32 to 64-bit and BEA-Tuxedo is involved in the mix.

Thank you,
-RK
Dennis Handly
Acclaimed Contributor

Re: Error: ld: Duplicate symbol "sqlca" in files

If you have gotten the answers you wanted, see: (You can give points for every answer.)
http://forums1.itrc.hp.com/service/forums/helptips.do?#33

>That would make sense but I think the way Oracle has designed it is not that way.. (my understanding)....

So you think they should be separate or not? In C they would be shared.

>Any ideas on how I can cirumvent that?

Change the header to make it extern. Create another file that defines it and use a different header?? Is this an array? Is it initialized in multiple files? Or just assigned in each? Or better yet, compile one C source that includes the header.

You could use conditional compilation to add the "extern" for just C++. I probably would make sense to talk to Oracle to see what they say. You can't be the first with this problem.

>This dups issue does not happen if I use the -Ae option of aCC. I cannot use just -Ae, since we are migrating from 32 to 64-bit and BEA-Tuxedo is involved in the mix.

-Ae says to use C vs C++. I'm not sure what the change from +DD32 to +DD64 has to do with what language you use.
Sreenivas RK
New Member

Re: Error: ld: Duplicate symbol "sqlca" in files

Issue resolved. Can't believe I've been this dumb this long :-)

Oracle has provided the include file and they have everything inside it to handle these issues. It was really dumb or me not to look at and try to understand what it was doing.

All you got to do is to use Oracle's:
EXEC SQL INCLUDE SQLCA everywhere instead of the #include

That way, you leave it to Oracle's Preprocessor to generate the correct C code for you...

Dennis... thanks much for the reply and helping me re-think and look. Appreciate it :-)
-RK