Li haonan
Li haonan

Reputation: 630

Tk/Tcl extensions: error while compile BLT

I am compile BLT under OS X 10.10.5, while I make after ./configure, some error occur here:

FDSM_lhn@Nirvana:~/Downloads/blt2.4z$ sudo make -I/opt/X11/include
Password:
(cd src; /Applications/Xcode.app/Contents/Developer/usr/bin/make all)
gcc -c -Wall -O6   -I. -I.  bltAlloc.c
warning: optimization level '-O6' is not supported; using '-O3' instead
In file included from bltAlloc.c:1:
In file included from ./bltInt.h:80:
./bltNsUtil.h:50:20: error: conflicting types for 'Tcl_FindCommand'
EXTERN Tcl_Command Tcl_FindCommand _ANSI_ARGS_((Tcl_Interp *interp,
                   ^
/usr/local/include/tclDecls.h:1486:20: note: previous declaration is here
EXTERN Tcl_Command      Tcl_FindCommand(Tcl_Interp *interp, const char *name,
                        ^
In file included from bltAlloc.c:1:
In file included from ./bltInt.h:80:
./bltNsUtil.h:67:23: error: conflicting types for 'Tcl_CreateNamespace'
EXTERN Tcl_Namespace *Tcl_CreateNamespace _ANSI_ARGS_((Tcl_Interp *interp,
                      ^
/usr/local/include/tclDecls.h:1460:24: note: previous declaration is here
EXTERN Tcl_Namespace *  Tcl_CreateNamespace(Tcl_Interp *interp,
                        ^
In file included from bltAlloc.c:1:
In file included from ./bltInt.h:80:
./bltNsUtil.h:72:23: error: conflicting types for 'Tcl_FindNamespace'
EXTERN Tcl_Namespace *Tcl_FindNamespace _ANSI_ARGS_((Tcl_Interp *interp,
                      ^
/usr/local/include/tclDecls.h:1482:24: note: previous declaration is here
EXTERN Tcl_Namespace *  Tcl_FindNamespace(Tcl_Interp *interp,
                        ^
In file included from bltAlloc.c:1:
In file included from ./bltInt.h:80:
./bltNsUtil.h:75:12: error: conflicting types for 'Tcl_Export'
EXTERN int Tcl_Export _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Namespace *nsPtr,
           ^
/usr/local/include/tclDecls.h:1469:13: note: previous declaration is here
EXTERN int              Tcl_Export(Tcl_Interp *interp, Tcl_Namespace *nsPtr,
                        ^
1 warning and 4 errors generated.
make[1]: *** [bltAlloc.o] Error 1
make: *** [all] Error 2

What should I do to avoid this?

Upvotes: 0

Views: 300

Answers (1)

Donal Fellows
Donal Fellows

Reputation: 137567

You're working with an elderly codebase, so some surgery is required. Alas.

The four offending declarations in bltNsUtil.h need to be removed as Tcl now declares them properly; Tcl_FindCommand, Tcl_CreateNamespace, Tcl_FindNamespace and Tcl_Export are part of Tcl's public API and have been for years. (The problem declarations are on lines 50, 67, 72, and 75, plus probably one or two lines further in each case.)

Also, you're recommended to not use sudo while doing the build itself, but rather just when doing the install afterwards. Mere compilation of the code shouldn't require elevated permissions.

Upvotes: 0

Related Questions