Subject: How to fix tkgate?
To: None <tech-pkg@netbsd.org>
From: Julio M. Merino Vidal <jmmv@menta.net>
List: tech-pkg
Date: 06/08/2004 16:45:41
Hi all,

from kristerw@'s "pkgsrc NetBSD 1.6.2/i386 bulk build results 2004-06-07",
I see that tkgate is broken.  From the logs:

gcc -o tkgate -O2      -L/usr/X11R6/lib   tkgate.o tkgatewin.o ascii.o defaults.o edit.o error.o 	functions.o gates.o cursors.o simulate.o print.o editstate.o 	module.o selection.o join.o net.o verilog.o icon.o modint.o 	misc.o scopewin.o scope.o  tclfuncs.o wiresadd.o 	wiresedit.o wiresize.o wiresmove.o wiresnap.o wmstuff.o 	generic.o cpath.o zoom.o verify.o joint.o block.o in.o out.o tri.o ground.o vdd.o tap.o 	clock.o dip.o switch.o and.o or.o xor.o buffer.o adder.o mux.o demux.o 	register.o flipflop.o lshift.o rshift.o arshift.o roll.o concat.o tribuffer.o 	ram.o rom.o mult.o divide.o tty.o nmos.o pmos.o comment.o frame.o led.o -L/usr/pkg/lib -L/usr/X11R6/lib ../common/libvparser.a ../common/libcommon.a -lm  -ltk84 -ltcl84 -lX11      -Wl,-rpath,/usr/X11R6/lib
/tmp/bulktmp/cad/tkgate/work/.x11-buildlink/lib/libtcl84.so: undefined reference to `pthread_attr_destroy'
/tmp/bulktmp/cad/tkgate/work/.x11-buildlink/lib/libtcl84.so: undefined reference to `pthread_create'
/tmp/bulktmp/cad/tkgate/work/.x11-buildlink/lib/libtcl84.so: undefined reference to `pthread_getspecific'
/tmp/bulktmp/cad/tkgate/work/.x11-buildlink/lib/libtcl84.so: undefined reference to `pthread_attr_init'
/tmp/bulktmp/cad/tkgate/work/.x11-buildlink/lib/libtcl84.so: undefined reference to `pthread_exit'
/tmp/bulktmp/cad/tkgate/work/.x11-buildlink/lib/libtcl84.so: undefined reference to `pthread_key_delete'
/tmp/bulktmp/cad/tkgate/work/.x11-buildlink/lib/libtcl84.so: undefined reference to `pthread_attr_setscope'
/tmp/bulktmp/cad/tkgate/work/.x11-buildlink/lib/libtcl84.so: undefined reference to `pthread_cond_broadcast'
/tmp/bulktmp/cad/tkgate/work/.x11-buildlink/lib/libtcl84.so: undefined reference to `pthread_once'
/tmp/bulktmp/cad/tkgate/work/.x11-buildlink/lib/libtcl84.so: undefined reference to `pthread_key_create'
/tmp/bulktmp/cad/tkgate/work/.x11-buildlink/lib/libtcl84.so: undefined reference to `pthread_attr_setstacksize'
/tmp/bulktmp/cad/tkgate/work/.x11-buildlink/lib/libtcl84.so: undefined reference to `pthread_cond_init'
/tmp/bulktmp/cad/tkgate/work/.x11-buildlink/lib/libtcl84.so: undefined reference to `pthread_mutex_unlock'
/tmp/bulktmp/cad/tkgate/work/.x11-buildlink/lib/libtcl84.so: undefined reference to `pthread_self'
/tmp/bulktmp/cad/tkgate/work/.x11-buildlink/lib/libtcl84.so: undefined reference to `pthread_mutex_lock'
/tmp/bulktmp/cad/tkgate/work/.x11-buildlink/lib/libtcl84.so: undefined reference to `pthread_cond_wait'
/tmp/bulktmp/cad/tkgate/work/.x11-buildlink/lib/libtcl84.so: undefined reference to `pthread_cond_destroy'
/tmp/bulktmp/cad/tkgate/work/.x11-buildlink/lib/libtcl84.so: undefined reference to `pthread_mutex_init'
/tmp/bulktmp/cad/tkgate/work/.x11-buildlink/lib/libtcl84.so: undefined reference to `pthread_attr_setdetachstate'
/tmp/bulktmp/cad/tkgate/work/.x11-buildlink/lib/libtcl84.so: undefined reference to `pthread_join'
/tmp/bulktmp/cad/tkgate/work/.x11-buildlink/lib/libtcl84.so: undefined reference to `pthread_cond_timedwait'
/tmp/bulktmp/cad/tkgate/work/.x11-buildlink/lib/libtcl84.so: undefined reference to `pthread_setspecific'
*** Error code 1

The problem is that libtcl84 needs -lpthread and -lm (just try to link
a simple test program against it, and you'll see), but those two depends
are recorded nowhere.

I could patch tkgate to link against -lpthread too, but this doesn't look
right (because thread usage is "hidden by" libtcl84, and not used directly
in the program).

The other solution is to patch tcl so that the library ends up linked
with whatever else it needs.  I guess this is the best solution, right?
Does this work on all platforms we support?

Thanks.

-- 
Julio M. Merino Vidal <jmmv@menta.net>
The NetBSD Project - http://www.NetBSD.org/