Stuart Cassoff wrote:
> Stuart Henderson wrote:
>> On 2009/10/29 22:32, Stuart Cassoff wrote:
>>> I understand about -lpthread, but this is the result without it.
>> we use -pthread not -lpthread
> 
> I'd be extremely happy to know how I can make this work without -lpthread.
> 
> Stu


I don't seem to be able to figure this out and could use some help.
Here is something demonstrating the situation.



Build and load a small Tcl extension:

$ cat qz.c

#include <tcl.h>
int Qz_Init (Tcl_Interp *interp) {
  Tcl_InitStubs(interp, "8.5", 0);
  Tcl_PkgProvide(interp, "qz", "6.9");
  return TCL_OK;
}

$ cc -Wall -pthread -c -I/usr/local/include/tcl8.5 -o qz.o qz.c

$ cc -Wall -pthread -shared -L/usr/local/lib -ltclstub85 -o libqz69.so.0.0 qz.o

$ tclsh8.5
% load ./libqz69.so.0.0
% package require qz
6.9


Link with dbus and pthread:

$ cc -Wall -pthread -shared -L/usr/local/lib -ltclstub85 -ldbus-1 -lpthread -o 
libqz69.so.0.0 qz.o

$ tclsh8.5
% load ./libqz69.so.0.0
% package require qz
6.9


Link with dbus only:

$ cc -Wall -pthread -shared -L/usr/local/lib -ltclstub85 -ldbus-1 -o 
libqz69.so.0.0 qz.o

$ tclsh8.5
% load ./libqz69.so.0.0
tclsh8.5:/usr/local/lib/libdbus-1.so.7.1: undefined symbol 'pthread_cond_signal'
tclsh8.5:/usr/local/lib/libdbus-1.so.7.1: undefined symbol 
'pthread_condattr_init'
tclsh8.5:/usr/local/lib/libdbus-1.so.7.1: undefined symbol 'pthread_equal'
tclsh8.5:/usr/local/lib/libdbus-1.so.7.1: undefined symbol 
'pthread_condattr_destroy'
tclsh8.5:/usr/local/lib/libdbus-1.so.7.1: undefined symbol 
'pthread_cond_broadcast'
tclsh8.5:/usr/local/lib/libdbus-1.so.7.1: undefined symbol 'pthread_cond_init'
tclsh8.5:/usr/local/lib/libdbus-1.so.7.1: undefined symbol 
'pthread_mutex_unlock'
tclsh8.5:/usr/local/lib/libdbus-1.so.7.1: undefined symbol 'pthread_self'
tclsh8.5:/usr/local/lib/libdbus-1.so.7.1: undefined symbol 
'pthread_mutex_destroy'
tclsh8.5:/usr/local/lib/libdbus-1.so.7.1: undefined symbol 'pthread_mutex_lock'
tclsh8.5:/usr/local/lib/libdbus-1.so.7.1: undefined symbol 'pthread_cond_wait'
tclsh8.5:/usr/local/lib/libdbus-1.so.7.1: undefined symbol 
'pthread_cond_destroy'
tclsh8.5:/usr/local/lib/libdbus-1.so.7.1: undefined symbol 'pthread_mutex_init'
tclsh8.5:/usr/local/lib/libdbus-1.so.7.1: undefined symbol 
'pthread_cond_timedwait'
%



Thanks,
Stu

Reply via email to