Subject: gcc and compiling.
To: None <port-i386@netbsd.org>
From: Ben Bogart <bbogart@acs.ryerson.ca>
List: port-i386
Date: 08/07/2000 15:53:12
I've been trying to compile the aol web server but I cannot get it to
compile. This is the error I am getting:

tcl8x.c:48: redefinition of `Tcl_ThreadCreateProc'
../include/tcl.h:402: `Tcl_ThreadCreateProc' previously declared here
tcl8x.c:290: syntax error before `*'
gmake[1]: *** [tcl8x.o] Error 1
gmake: *** [all] Error 1

I've looked at the includes and deffintions and I can't understand why
there could be an error on line 290: 

   280	 * Side effects:
   281	 *	May block the current thread.  The mutex is aquired when
   282	 *	this returns.  Will allocate memory for a Ns_Mutex
   283	 *	and initialize this the first time this Tcl_Mutex is used.
   284	 *
   285	 *----------------------------------------------------------------------
   286	 */
   287	
   288	NS_EXPORT void
   289	Tcl_MutexLock(mutexPtr)
   290	    Tcl_Mutex *mutexPtr;	/* Really (Ns_Mutex **) */
   291	{
   292	    Ns_Mutex *nsmutexPtr = (Ns_Mutex *) mutexPtr;
   293	
   294	    if (*nsmutexPtr == NULL) {
   295		MASTER_LOCK;
   296		if (*nsmutexPtr == NULL) {
   297		    static int next;
   298		    char buf[20];
   299	

There are references to in the includes to Tcl_Mutex_ as well as
Tcl_Mutex. I am not a C programmer so I'm not able to debug this. I think
it might have to do with the version of gcc that comes with netbsd? Or it
could be the wrong makefile options. (there are no netbsd sets)

I will put the Makefile on the end of this email. I've tried openbsd and
freebsd flag sets with no help. (both give the same error) With the
solaris options it compiles fine under solaris, but with the freebsd or
openbsd options it returns the exact same error as netbsd.

Could I make a new entry for netbsd? What flags should it have? perhaps a
combination of openbsd and solaris flags?

I would greatly appriciate any help you could give me.

Thanks for your time.

Makefile:

#
# Makefile.global --
#
#      This is the common Makefile that contains all variables and
#      utilities used by AOLserver source code and modules.
#


#
# Installation locations.
#
INST         =   /usr/local/aolserver
INSTBIN      =   $(INST)/bin
INSTLOG      =   $(INST)/log
INSTMOD      =   $(INST)/modules
INSTTCL      =   $(INSTMOD)/tcl
INSTSRV      =   $(INST)/servers/server1
INSTSRVMOD   =   $(INSTSRV)/modules
INSTSRVPAG   =   $(INSTSRV)/pages


#
# Common build variables.
#
CC           =   gcc
LD           =   ld

CFLAGS       +=  -g -I../include -D_REENTRANT

LIBNSTHREAD  =   ../thread/libnsthread.a

LIBS         +=  

MKDIR        =   mkdir -p
RM           =   /bin/rm -f
CP           =   /bin/cp -fp
FIND         =   find
MV           =   /bin/mv
LN           =   ln -s
AR           =   ar
ARFLAGS      =   rv
RANLIB       =   true

#
# Auto-detect the platform
#
#PLATFORM = unknown
PLATFORM = freebsd

#
# Linux -- gcc
#
#  Red Hat 6.1 is known to work -- it has working glibc 2.1 and Linuxthreads.
#  glibc 2.1 (libc6) and its Linuxthreads component are absolutely required.
#  glibc 2.0 (libc6) and BSD libc5 are obsolete on Linux and do not work.
#  Linux supports SMP to some extent.  It will get better eventually.
#  Some SMP systems accumulate zombie processes (this is a kernel issue).
#  Note that we use the compiler to create shared objects, not the linker.
#
ifeq (Linux,$(shell uname))
    PLATFORM=linux
    LDFLAGS+=-Wl,-E
    CFLAGS+=-pipe -fPIC -Wall -Wno-unused
    LIBS+=-ldl -lpthread 
    LDSO=$(CC) -shared
    CFLAGS+=-DHAVE_CMMSG=1 -DUSE_FIONREAD=1 -DHAVE_COND_EINTR=1
endif


#
# Sun Solaris SPARC and x86 -- gcc
#
#  Free Solaris distributions are available on promotion at http://sun.com/.
#  The "-pipe" option to gcc does not work on some versions of Solaris.
#  -lresolv is only needed by reverse-host lookup modules like nsperm.
#  Solaris 7 binaries will not run on Solaris 2.6 (this is a Solaris problem).
#  Cygnus "GNUPro" DOES NOT WORK.  Use GNU gcc and /usr/ccs/bin/ld.
#  GNU gcc 2.8.1 and 2.95.2 from http://www.sunfreeware.com/ work fine.
#  Solaris 7 pthreads sometimes report cond_wait timeouts (a Solaris bug).
#  SMP is fully supported.
#
ifeq (SunOS,$(shell uname))
    PLATFORM=solaris
    # CC=/opt/SUNWspro/bin/cc
    # CFLAGS+=-KPIC
    CFLAGS+=-D_POSIX_PTHREAD_SEMANTICS -fPIC -Wall -Wno-unused
    LIBS+=-lsocket -lnsl -ldl -lposix4 -lpthread -lresolv
    LD=/usr/ccs/bin/ld
    #LDSO=$(LD) -G
    LDSO=$(CC) -shared
    AR=/usr/ccs/bin/ar
    CFLAGS+=-DUSE_PTHREAD_SYSSCOPE=1 -DUSE_DUPHIGH=1 -DHAVE_FORK1=1
    # Flags for pshared mutexes and conditions.
    CFLAGS+=-DUSE_PTHREAD_PSHARED=1 -DHAVE_ETIME_BUG=1
endif


#
# FreeBSD 3.x -- gcc
#
#  The pthread library that ships with FreeBSD 3.3 or better is required.
#  FreeBSD does not yet support SMP -- evidently a FreeBSD 4.x release will.
#
ifeq (FreeBSD,$(shell uname))
    PLATFORM=freebsd
    CFLAGS+=-pthread -D_THREAD_SAFE
    LDFLAGS+=-pthread -Wl,-E
    LDSO=$(CC) -shared
    RANLIB=ranlib
    CFLAGS+=-DHAVE_CMMSG=1 -DNO_TIMEZONE=1 -DHAVE_TIMEGM
endif


#
# OpenBSD 2.5 or better -- gcc
#
# Contributed by Michael Yoon <michael@yoon.org>
# SMP is not supported.
#
ifeq (OpenBSD,$(shell uname))
    PLATFORM=openbsd
    CFLAGS+=-pthread -D_THREAD_SAFE
    LDFLAGS+=-pthread -Wl,-E
    LDSO=$(CC) -shared
    RANLIB=ranlib
    CFLAGS+=-DHAVE_CMMSG=1 -DUSE_DLSYMPREFIX=1 -DUSE_RTLD_LAZY=1
    CFLAGS+=-DNO_TIMEZONE=1 -DHAVE_TIMEGM
	#Added by bbogart (From Solaris)
    CFLAGS+=-DUSE_PTHREAD_SYSCOPE=1 -DUCE_DUPHIGH=1 -DHAVE_FORK1=1
    CFLAGS+=-DUCE_PTHREAD_PSHARED=1 -DHAVE_ETIME_BUG=1 
    CFLAGS+=-D_POSIX_PTHREAD_SEMANTICS -fPIC -Wall -Wno-unused

endif


#
# SCO Unixware 7.x -- cc
#
#  Free Unixware 7 is available free on promotion at http://sco.com/.
#  This should be changed to gcc as soon as possible -- anybody?
#  GNU gcc is on the Skunkware disc and at http://sco.com/.
#  Both cc and gcc require the UnixWare Development Kit (UDK) version 7.x.
#  The UDK is free on promotion -- it's needed the dev utils and libs.
#  SMP support is not known.
#  For best results use Unixware 7.1 or later with all patches applied.
#  This is *not* "SCO OpenServer," which is the older Xenix-based product.
#
ifeq (UnixWare,$(shell uname))
    PLATFORM=unixware
    CC=cc
    CFLAGS+=-D__unixware -Kpic -Kthread
    LDFLAGS=-Wl,-B export
    LDSO=$(LD) -G
    LIBS+=-Kthread -lsocket
    CLFAGS+=-DUSE_PTHREAD_SYSSCOPE=1 -DHAVE_SENDV=1 -DHAVE_CMMSG=1
endif


#
# Mac OS X Server -- cc
#
#  The Mac OS X Server cc is gcc; the Mac OS X Server make is gmake.
#  Tested under releases 1.0 and 1.02.
#  No SMP support as of this writing.
#
ifeq (Rhapsody,$(shell uname))
    PLATFORM=osx
    CC=cc
    LD=cc
    CFLAGS+=-dynamic -traditional-cpp -pipe -Wall -Wno-unused
    LDSO=$(LD) -bundle -undefined suppress
    RANLIB=ranlib
    CFLAGS+=-DUSE_CTHREADS=1 -DHAVE_CMMSG=1 -DUSE_DYLD -DUSE_DLSYMPREFIX=1
    CFLAGS+=-DNO_RAND48=1 -DNO_TIMEZONE=1
endif


#ifeq (unknown,$(PLATFORM))
#    error unknown platform
#endif


#
# Set the names of the Tcl libraries
#
#    Note:  Tcl 7.6 on *BSD has a different name for no apparent reason.
#
TCL8X_DIR=tcl8.3.0
TCL8X_LIB=libtcl8.3g.a
TCL76_DIR=tcl7.6
ifeq (bsd, $(findstring bsd, $(PLATFORM)))
  TCL76_LIB=libtcl76.a
else
  TCL76_LIB=libtcl7.6.a
endif

LIBTCL76=../$(TCL76_DIR)/unix/$(TCL76_LIB)
LIBTCL8X=../$(TCL8X_DIR)/unix/$(TCL8X_LIB)






B. Bogart
Convergent Media Designer
--------------------------
Through scientific absolution we move further and further away from ourselves.