network texis API compilation

Zeus
Posts: 31
Joined: Thu Jul 29, 2004 5:12 pm

network texis API compilation

Post by Zeus »

Hi,
I am using gcc on linux and I wrote a sample program, which compiles ,but hard to link to.

Could you see any problems with the link below,

gcc -L/usr/local/morph3/api testqry.o /usr/local/morph3/api/txclnop.o -lntexis -lapi3 -lm -o testqry

I get the following errors,

/usr/local/morph3/api/libntexis.a(texiscl.o)(.text+0x174d): In function `ncg_start':
: undefined reference to `TXinitapp'
/usr/local/morph3/api/libntexis.a(texiscl.o)(.text+0x3f6c): In function `newindirect':
: undefined reference to `__ctype_b'
/usr/local/morph3/api/libntexis.a(ezsock.o)(.text+0x110c): In function `ezsvc2int':
: undefined reference to `__ctype_b'


etc....... <MORE ERRORS>
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

network texis API compilation

Post by mark »

The makefile in the api directory has the compilation rules.
Zeus
Posts: 31
Joined: Thu Jul 29, 2004 5:12 pm

network texis API compilation

Post by Zeus »

I ran the sample programs. The first error is gone, I still have undefined __ctype_b references.
something to do with libc version etc. I think.

we are running 2.6.5 linux kernel.

any ideas?
thanks!!
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

network texis API compilation

Post by mark »

Did you "run" or "compile" the samples? The test is to compile them. If they compile ok, use a similar command line to compile your program.

Which linux distro? What version of libc?
Zeus
Posts: 31
Joined: Thu Jul 29, 2004 5:12 pm

network texis API compilation

Post by Zeus »

I ran make netex3 and that is when I got the ctype_b errors.

The linux kernel version is 2.6.5
in regards to libc,

GNU C Library stable release version 2.3.3


Thanks!!!
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

network texis API compilation

Post by mark »

Looks like GNU changed the standard to darkness again with libc 2.3. Until texis gets rebuilt using that version of glibc the only workaround we know of is to get the libs from our ftp server
ftp://ftp.thunderstone.com/pub/linux/
Change the cc options
-lm -lcrypt -ldl -lpthread
to
libm.so.6 libcrypt.so.1 libdl.so.2 libpthread.so.0 libc.so.6 ld-linux.so.2
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

network texis API compilation

Post by mark »

FYI, the old libs are not needed to run once the linking is done (just like the bundled texis binaries). GNU does have back compatibility on the compiled binaries.
Zeus
Posts: 31
Joined: Thu Jul 29, 2004 5:12 pm

network texis API compilation

Post by Zeus »

Thanks that fixed it!!

I have one more issue.
I compiled a simple pgm and ran it. Worked fine. But, when I ran it through valgrind, a memory profiler, I got the following message (indicating a leak, the stack trace has been provided),

40 bytes in 1 blocks are definitely lost in loss record 4 of 5
==17630== at 0x1B9053F9: calloc (vg_replace_malloc.c:176)
==17630== by 0x8060D5A: tspailst (in /home/skalyanaraman/testsql/testqry)
==17630== by 0x8057330: n_fldnames (in /home/skalyanaraman/testsql/testqry)
==17630== by 0x8050CB4: n_getitx (in /home/skalyanaraman/testsql/testqry)
==17630== by 0x805C176: vgettsql (in /home/skalyanaraman/testsql/testqry)
==17630== by 0x805C265: n_gettsql (in /home/skalyanaraman/testsql/testqry)
==17630== by 0x804B7B8: main (testqry.c:29)

I am calling n_gettsql(), here is my program:

int main(int argc, char* argv[])
{

SERVER *se;
TSQL *ts;
char* selectstr = "select DOCID from documenttext where DOCTEXT like %s;";
char* query;
char* database = "/home/skalyanaraman/database/testdb";
int* docid;

query = argv[1];

if(serveruser("PUBLIC") && servergroup("") && serverpass("") && (se=openserver("",""))!=SERVERPN)
{
n_setdatabase(se,database);

if((ts=n_opentsql(se))!=TSQLPN) /* initialize the Texis SQL API */
{

if(n_settsql(ts, selectstr))
{
/* execute the select with the supplied Metamorph query */
if(n_exectsql(ts,query))
{
while(n_gettsql(ts,"%d",&docid))
{
printf("DoCID : %d\n",docid);

}

}
}

n_closetsql(ts); /* shutdown the Texis SQL API */
}
closeserver(se); /* disconnect from server */
}
return 0;
}
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

network texis API compilation

Post by mark »

Are you compiling client/server or with with NCGDIRECT?
And which do you really want? Do you want to be able to communicate with texis on other computers (client/server) or just directly with databases on the local computer (NCGDIRECT)?
Zeus
Posts: 31
Joined: Thu Jul 29, 2004 5:12 pm

network texis API compilation

Post by Zeus »

The above program was compiled as client server.

I would want to communicate on local server, no need for network access. I thought, there is no way to run queries intelligently (i.e. using indexes) using direct API.
That is why I did a client/server and used localhost.

thanks!!
Post Reply