[Yazlist] linking YAZ 1.8

Adam Dickmeiss adam at indexdata.dk
Fri Oct 26 20:16:53 CEST 2001


On Fri, Oct 26, 2001 at 12:13:24PM -0230, Jason MacDonald wrote:
> Hi,
>     I am attempting to compile yaz 1.8  into my server but I am having a few
> problems. I am really interested in version 1.8 for the threads on Unix. The
> problem I am having is during the linking process I get a bunch of undefined
> symbols. I am linking in the libraries;
> 
> .../server/libserver.la
> .../lib/libyazthread.la
> ....lib/libyaz.la

You should compile with libyazthread and libyaz only. And, in that
order. libayzthread replaces non-threading functions in libyaz.

YAZ's configure generates yaz-config which tells you how to
compile - and link with YAZ. Pass --libs (since you'd like
linking flags) and specify threads (since you're interested
in the threaded version). On my portable this gives:

adam at gamma:~/proj/tmp/yaz-1.8$ ./yaz-config --libs threads
-L/home/adam/proj/tmp/yaz-1.8/lib/.libs -lyazthread -lyaz -lpthread

As you can see YAZ tells you that you need linking with pthread as
well. That's on Linux/Solaris. On OpenBSD it's quite different.
So it should be safer to rely on yaz-config... 

I recommend using a Makefile, like this:

# Set this to your location for yaz-config
YAZCONFIG=../yaz-1.8/yaz-config

# Set CFLAGS and LIBS, threaded
CFLAGS=`$(YAZCONFIG) --cflags threads`
LIBS=`$(YAZCONFIG) --libs threads`

# Link your app
yourapp: yourapp.o
	$(CC) $(CFLAGS) -o yourapp yourapp.o $(LIBS)

# .c.o rule omitted - we assume it is built-in and is using CFLAGS.
# end of makefile

Note that if use GNU libtool yourself you should use --lalibs
instead of --libs for yaz-config. 

Cheers,
  Adam

> and the symbols left undefined are;
> data1_create
> statserv_getcontrol
> data1_nodetogr
> nmem_malloc
> nmem_destroy
> statserv_main
> data1_get_absyn
> data1_read_node
> oid_getentbyoid
> data1_nodetomarc
> yaz_log
> nmem_create
> data1_set_tabpath
> data1_nodetobuf
> atoi_n
> data1_destroy
> 
> Are there other libs that I should be linking in? Any help would be greatly
> appreciated.
> 
> _______________________________________________
> Yazlist mailing list
> Yazlist at indexdata.dk
> http://www.indexdata.dk/mailman/listinfo/yazlist

-- 
Adam Dickmeiss  mailto:adam at indexdata.dk  http://www.indexdata.dk
Index Data      T: +45 33410100           Mob.: 212 212 66



More information about the Yazlist mailing list