Find the answer to your Linux question:
Results 1 to 4 of 4
Dear All, Please help in linking a library in using GCC. I am compiling Pro*C code. When the maKe file start compiling if prints following : Code: Processing File : ...
  1. #1
    Just Joined!
    Join Date
    Apr 2011
    Posts
    2

    Unhappy GCC linker failed to link

    Dear All,

    Please help in linking a library in using GCC. I am compiling Pro*C code. When the maKe file start compiling if prints following :

    Code:
    Processing File : readg.pc
    Processing File : MedLib.pc
    proc DEFINE=__linux__ DEFINE=_PROC_ MODE=ORACLE DBMS=V8  UNSAFE_NULL=YES INCLUDE=/home/med/src/common INCLUDE=/u01/app/oradb11r2/product/11.2.0/dbhome_3/rdbms/demo INCLUDE=/u01/app/oradb11r2/product/11.2.0/dbhome_3/rdbms/public INCLUDE=/export/home/cl10gr2/oracle/rdbms/public iname=readg_x
    It compile successfully but in the end it complains that:

    Code:
    gcc: -ltabs: linker input file unused because linking not done
    gcc: -lnapi: linker input file unused because linking not done
    The final command that tries to generate executable is a follow:

    Code:
    /usr/bin/gcc  -o  readgfile -P readg_x.o cdrsort.o mtcprc.o encoder.o mtcbuil.o dbtprc.o dbtbuil.o MedLib_x.o DFMLIB_x.o Dyn_SQL_x.o   -L/home/med/src/lib -L/u01/app/oradb11r2/product/11.2.0/dbhome_3/lib/ -ltabs -lnapi -lclntsh `cat /u01/app/oradb11r2/product/11.2.0/dbhome_3/lib/ldflags`   `cat /u01/app/oradb11r2/product/11.2.0/dbhome_3/lib/sysliblist` -ldl -lm
    But after that it start complaining reference not found about the function that was declared in one of the library. Like this:

    Code:
    readg_x.o: In function `main':
    /home/med/src/readg/readg_x.c:565: undefined reference to `options'
    /home/med/src/readg/readg_x.c:570: undefined reference to `oraconnect'
    /home/med/src/readg/readg_x.c:591: undefined reference to `oracommit'
    I tried different options but unable to find the reason why it is not linking the libraries correctly.
    It would be great help if someone guide where I am missing.

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Building Oracle applications with Pro*C. Yech! Myself, I stick with the OCI libraries. Much better, and easier to deal with. No preprocessing required, unlike embedded SQL. Without your code, Makefile, and other stuff, I really can't say what is going on. The last error messages indicate that you aren't linking the required Oracle libraries, whichever contain 'oraconnect', 'oracommit', etc. Final note, is that in the first block of code you show, it appears that you are using Oracle 8? What distribution+version of Linux are you running on? That is so old (Oracle 8i), that I would have to wonder if that may be related to your problem. What does Oracle say? Do you have an Oracle support contract?
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Apr 2011
    Posts
    2
    Rubberman Thank you for your reply.
    Yeah it is linking issue but I am unable to find why is it so. As per my investigation the order of object files is a matter of concern for GCC. But the same order get compiled on SUN OS.
    I am using Oracle 11gR2. That was wrongly mentioned there but I think it have no effect.
    Here are OS informations :
    Linux test200.unitech.com 2.6.18-128.el5 #1 SMP Wed Dec 17 11:41:38 EST 2008 x86_64 x86_64 x86_64 GNU/Linux

    Oracle support contract not sure about it.

  4. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Quote Originally Posted by abu_abdullah View Post
    Rubberman Thank you for your reply.
    Yeah it is linking issue but I am unable to find why is it so. As per my investigation the order of object files is a matter of concern for GCC. But the same order get compiled on SUN OS.
    I am using Oracle 11gR2. That was wrongly mentioned there but I think it have no effect.
    Here are OS informations :
    Linux test200.unitech.com 2.6.18-128.el5 #1 SMP Wed Dec 17 11:41:38 EST 2008 x86_64 x86_64 x86_64 GNU/Linux

    Oracle support contract not sure about it.
    Well, Linux is not Solaris. Libraries are different, found in different places, etc. One of the joys of cross-platform development. We used to have a make include file for each platform that would be pulled into the main Makefile, depending upon the platform we were building on. That way, the appropriate CFLAGS, CPPFLAGS, LDFLAGS, etc would be set correctly to deal with all this cruft. Sometimes, I would have to run the "strings" command against a bunch of libraries to find which ones contained which functions. I seem to recall that Oracle was not particularly great in this regard, consistency across platforms, that is... Also, that was a good 15 years ago.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...