3

I have a problem here that I can't quite explain. The linker is complaining that a symbol from the Oracle client libraries is undefined:

$ gcc-4.6 -L/usr/local/oracle/product/11.2.0/dbhome_1/lib -lcurl -m64 -lpthread -lclntsh  advarc.o wintbx.a winlib_o.a   -o advarc
advarc.o: In function `main':
advarc.c:(.text+0x1c68): undefined reference to `sqlcxt'
advarc.c:(.text+0x1f19): undefined reference to `sqlcxt'
advarc.c:(.text+0x1fb3): undefined reference to `sqlcxt'
advarc.c:(.text+0x21cc): undefined reference to `sqlcxt'
advarc.c:(.text+0x25f9): undefined reference to `sqlcxt'
advarc.o:advarc.c:(.text+0x2693): more undefined references to `sqlcxt' follow
wintbx.a(stlthread.o): In function `initialiseThread':
stlthread.c:(.text+0x70): undefined reference to `pthread_setconcurrency'
stlthread.c:(.text+0x8a): undefined reference to `pthread_create'
winlib_o.a(winlib_o.o): In function `dbconnect':
winlib_o.c:(.text+0x8f6): undefined reference to `sqlcxt'
winlib_o.c:(.text+0xa39): undefined reference to `sqlcxt'
winlib_o.a(winlib_o.o): In function `dbdisconnect':
winlib_o.c:(.text+0xb03): undefined reference to `sqlcxt'
winlib_o.a(winlib_o.o): In function `dbdynamic':
winlib_o.c:(.text+0xd44): undefined reference to `sqlcxt'
winlib_o.c:(.text+0xef3): undefined reference to `sqlcxt'
winlib_o.a(winlib_o.o):winlib_o.c:(.text+0xf89): more undefined references to `sqlcxt' follow
collect2: ld returned 1 exit status

But according to nm, the symbol is defined:

nm /usr/local/oracle/product/11.2.0/dbhome_1/lib/libclntsh.so | grep sqlcxt
0000000001d154f0 T sqlcxt

I was able to build and run the same code up to (and including) Ubuntu 11.04. The libclntsh library has been re-linked against the new system libraries.

1 Answer 1

2

I don't know if it is still the case with gcc-4.6, but in earlier versions you needed to append the libraries you wanted to link against. Try:

gcc-4.6 -L/usr/local/oracle/product/11.2.0/dbhome_1/lib advarc.o wintbx.a winlib_o.a -lcurl -m64 -lpthread -lclntsh  -o advarc

(I changed the order of the arguments)

2
  • Linked. I am still confused as to why this issue only just appeared (was working in 11.04, not sure what version of gcc I was on; 4.5 I think). Oh, well, it works now. Thanks.
    – dlp
    Oct 25, 2011 at 13:14
  • I am glad it worked. Maybe you or someone else edited the Makefile since the upgrade to 11.10.
    – bjoernz
    Oct 25, 2011 at 13:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .