Operating System - HP-UX
1753604 Members
6661 Online
108797 Solutions
New Discussion юеВ

Re: Duplicate Symbol sqlca in <file1.o> and <file2.o>

 
SOLVED
Go to solution
soumya das
Advisor

Duplicate Symbol sqlca in <file1.o> and <file2.o>

Hi all Make file experts,

I am getting the above mentioned error ie.
Duplicate Symbol sqlca in and while running a makefile which is as follows :

include ../../Include_Paths

#CC = /opt/softbench/bin/cc
CC = /opt/softbench/bin/aCC
CCFLAGS = -g0 +Z -D_HPUX_SOURCE -DRW_MULTI_THREAD -D_REENTRANT -mt -y
CFLAGS = -g +Z -D_HPUX_SOURCE -DRW_MULTI_THREAD -D_REENTRANT -D_REENTRANT -y
PROC_FLAGS = MODE=ORACLE DBMS=v8 unsafe_null=yes
.SUFFIXES :
.SUFFIXES : .cc .h .pc .o

ORACLE_HOME = /oracle9i/app/oracle/product/9.2.0
PROC_COMP = $(ORACLE_HOME)/bin/proc
PROC_FLAGS = CODE=CPP CPP_SUFFIX=cc
PROC_INCLUDE = SYS_INCLUDE=/opt/aCC/include/iostream SYS_INCLUDE=/opt/aCC/include

PROC_src=SvlDataHandler.pc SvlDataMgr.pc

SRCS = $(PROC_SRC:.pc=.cc)

CC_SRCS = $(SRCS)

OBJS = $(CC_SRCS:.cc=.o)

#LD_FLAGS = -b
LD_FLAGS = -L$(CONFIGURATIONAPI) -L$(COLLECTIONAPI) -L$(EVENTAPI) -L$(SOCKETAPI) -L$(MQAPI) -lconfigurationmanager -lcollectionmanager -leventmanager -lsocketlib -lmqapi -limqi23ah -lmqm -lmqic -b
IFLAGS = -I$(CONFIGURATIONAPI) -I$(COLLECTIONAPI) -I$(EVENTAPI) -I$(SOCKETAPI) -I$(MQAPI)

TARGET = libsvlmessagehandler.sl

$(TARGET) : $(OBJS)
$(CC) $(OBJS) $(CCFLAGS) $(LD_FLAGS) -o $@
chatr +s enable $(TARGET)
rm -rf Static.sadb

.pc.cc:
$(PROC_COMP) $(PROC_FLAGS) $(PROC_INCLUDE) $<

.cc.o: $(CC_SRCS)
$(CC) $(CCFLAGS) $(IFLAGS) -c $< -o $@

clean:
rm -rf $(SRCS) $(OBJS) *.lis



Now in the line --
PROC_src=SvlDataHandler.pc SvlDataMgr.pc

if I put only one .pc file say only SvlDataHandler.pc then this does not arise. I have also made sure that sqlca is not defined in both the .pc files.

Can any of the make file expert suggest any cjhanger in my make file so that this error does not appear.

Earlier I put the same question in the forum and also got some suggetions like adding +allowdups and -h sqlca ld. But in my make file LD_PATH is defined and if I use those options with other LD Flag options those were not taken saying illegal options.

So if anyone can help?

--regards,
Soumya Das
6 REPLIES 6
Stephen Keane
Honored Contributor

Re: Duplicate Symbol sqlca in <file1.o> and <file2.o>

You want to pass the options to the linker, without the compiler trying to parse them. So try something like

-Wl,-hsqlca

in your LD_FLAGS, note that is -W followed by the letter L (but in lowercase) not the number 1 (one) which can look the same in some fonts.
soumya das
Advisor

Re: Duplicate Symbol sqlca in <file1.o> and <file2.o>

Hi Stephen,


Thanks for ur reply .

I amended LD_FLAG in the following way ..

LD_FLAGS = -L$(CONFIGURATIONAPI) -L$(COLLECTIONAPI) -L$(EVENTAPI) -L$(SOCKETAPI) -L$(MQAPI) -lconfigurationmanager -lcollectionmanager -leventmanager -lsocketlib -lmqapi -limqi23ah -lmqm -lmqic -b -Wl,-hsqlca

But the same error is coming ...Duplicte sqlca in the object files.
Stephen Keane
Honored Contributor
Solution

Re: Duplicate Symbol sqlca in <file1.o> and <file2.o>

How about:

-Wl,-hsqlca,+allowdups

Peter Godron
Honored Contributor

Re: Duplicate Symbol sqlca in <file1.o> and <file2.o>

Soumya,
thanks for creating the new thread!
You forgot to add the previous link to give people more background:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=815153

Sorry to see my answers were not worth any points ;-)

The problem as I see it is that the make script you posted uses the CC varibale to do the whole job, whereas we do seperate stages for pre-compile,compile and link.
So the LD_FLAGS is passed to aCC, which it apparently does not understand.sqlca is pulled in from the oracle lib when you pass the program through precompile.
Peter Godron
Honored Contributor

Re: Duplicate Symbol sqlca in <file1.o> and <file2.o>

Soumya,
Stephen's solution works for me, so it was just a case of getting the answer to a make expert. Thanks Stephen!
We got there with a lot of effort.
Thanks
soumya das
Advisor

Re: Duplicate Symbol sqlca in <file1.o> and <file2.o>

Thanks Stephen,

the option -Wl,-hsqlca,+allowdups worked for my makefile with some warnings.

Many a thaks to u for the solution.

--regards,
soumya