This discussion is archived
2 Replies Latest reply: May 23, 2013 5:29 AM by 1009876 RSS

Not able create a shared objects using gcc

1009876 Newbie
Currently Being Moderated
We are currently in the process of migrating all middle tier code from SunOS into Oracle Linux(RHEL Kernel).
In top the Oracle Linux Server release 5.6 , Im trying to compile some of the .pc code using proc & gcc for create a shared objects...

But I got below error while create a shared objects...

c++ -g -o libdbutil.so -shared query.o Prepares.o ContextServer.o Utils.o DateUtil.o db_util.o statusCheck.o db_transact.o db_isolation.o DatabaseManager.o DateUtilOra.o

statusCheck.o: In function `__static_initialization_and_destruction_0':
/home/raj/statusCheck.cc:315: multiple definition of `sqlca'
db_util.o:/home/raj/include/log.h:80: first defined here
db_transact.o:/home/raj/db_transact.cc:391: multiple definition of `sqlca'
db_util.o:/home/raj/log.h:80: first defined here
db_isolation.o: In function `operator new(unsigned long, void*)':
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/new:94: multiple definition of `sqlca'
db_util.o:/home/raj/log.h:80: first defined here
DatabaseManager.o:/home/raj/log.h:80: multiple definition of `sqlca'
db_util.o:/home/raj/log.h:80: first defined here
DateUtilOra.o: In function `__static_initialization_and_destruction_0':
/home/raj/DateUtilOra.cc:1252: multiple definition of `sqlca'
db_util.o:/home/raj/log.h:80: first defined here
collect2: ld returned 1 exit status
make: *** [libdbutil.so] Error 1


So I have tried with conditional preprocessor directivies while include the SQLCA header file.
Even not able to resolve the issue..

Please some help me to resolve the issue.
Thanks in advance.

Edited by: 1006873 on May 20, 2013 8:46 AM
  • 1. Re: Not able create a shared objects using gcc
    Steve_Clamage Pro
    Currently Being Moderated
    This forum is about general programming in C, C++ and Fortran, and for specific questions about using Sun/Oracle Studio compilers. Your question is about using Pro*C with gcc, which is none of the above.

    I would first check the gcc/linux documentation about creating shared objects. Verify that your command line is correct as far a gcc/linux is concerned. (There are differences from what you do with Studio on Solaris.)

    If you don't find the solution there, try a database programming forum for more about using Pro*C with gcc. A list of forums is here:
    https://forums.oracle.com/forums/category.jspa?categoryID=18
  • 2. Re: Not able create a shared objects using gcc
    1009876 Newbie
    Currently Being Moderated
    Hi , Thanks For the update..
    Like you told there is a problem with gcc compiler command option..need to add below command in gcc while create a shared objects if more than one object which contains the SQLCA.

    DSQLCA_STORAGE_CLASS=extern

    Thanks

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points