Critcl 2

Critcl2 was superseded by Critcl3 in 2011. See the Critcl page for updated information.

New features in Critcl2:

  • Critcl now builds using a more traditional "gcc -c" step for each source file, followed by a "gcc -shared" step for linking a shared library
  • the critcl::cflags procedure can be used to specify compiler flags
  • the critcl::ldflags procedure can be used to specify linker flags
  • the critcl::framework" procedure for specifying frameworks to use under MacOS X
  • the critcl::clean_cache procedure and "critcl -clean" command are used to clean (i.e. empty) the Critcl cache
  • the critcl::debug command can be used to specify that debugging is enabled - either "memory" and/or "symbols"
  • the "bytearray" or "rawchar" types can be used as arguments and return values to critcl::cproc
  • the "int*", "float*" and "double*" types can be used as arguments and return values to critcl::cproc
  • improved cross-compiler support when using mingwin
  • all extensions are now built "thread enabled"

In addition, the compiler and platform specific commands are now stored in a configuration file. This will make it easier to support new platforms and toolchains. For example,

   #   Configuration file for the compiler toolchain

   # some defaults - you can override these in the platform specific section
   # but shouldn't need to for gcc or typical *nix toolchains

   compile         gcc -c
   link            gcc -shared
   preproc         gcc -dM -E
   tclstubs        -DUSE_TCL_STUBS
   tkstubs         -DUSE_TK_STUBS
   debug_memory    -DTCL_MEM_DEBUG
   debug_symbols   -g
   output          -o
   object          .o
   strip           -Wl,-s
   optimize        -O2
   noassert        -DNDEBUG
   threadflags     -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1    \
                   -DHAVE_PTHREAD_ATTR_SETSTACKSIZE=1 -DHAVE_READDIR_R=1   \
                   -DTCL_THREADS=1

   # OSX
   Darwin-ppc  compile   gcc -c
   Darwin-ppc  link      gcc -bundle
   Darwin-ppc  strip     

   # Windows
   Windows-x86 compile   gcc -c -nostdlib
   Windows-x86 link      gcc -shared

   # Linux - default to current platform
   Linux-*     compile   gcc -c -fPIC
   Linux-*     link      gcc -shared -s

   # for cross-compiling using mingw - this will be automatically selected
   # if mingw is recognised

   mingw       compile gcc -c -nostdlib
   mingw       link    gcc -shared

   # the following will only be selected on the command line

   # Linux - force 32 bit compile
   Linux-32    compile   gcc -c -fPIC -m32
   Linux-32    link      gcc -shared -s

   # Linux - force 64 bit compile
   Linux-64  compile   gcc -c -fPIC -m64
   Linux-64  link      gcc -shared -s

Until the changes are merged into the main Critcl source you can download the Critcl Starkit from http://www.digitalsmarties.com/pub/critcl.kit . It should be considered as work in progress - there are more changes being implemented, including recognising and handling several 64 bit environments.

The new Critcl was used in the development of Muzic. The changes were implemented by Steve Landers and sponsored by Eolas Technologies Inc. Thanks are due to Arjen Markus for his suggestions and assistance.


critcl2 & linking with custom library

milarepa - 2011-03-22 05:33:19

When trying to build cryptkit cith critcl, -lresolv and -lcl_Linux-x86 are passed to GCC.

/usr/lib/libresolv.so is found, but libcl_Lunix-x86.so is not found, despite I have links corretly in place in /usr/lib. (I have tried many places without success ...)

Any idea why this appends ?

fred@pc-salon:~/Downloads/cryptlibl340$ ../critcl  -k -f -pkg cryptkit bindings/cryptkit.tcl Compilation forced
Files kept in ~/.critcl/Linux-x86
Source: cryptkit.tcl 
mar. mars 22 10:12:47 CET 2011 - /home/fred/Downloads/cryptlibl340/bindings/cryptkit.tcl
gcc -r -nostdlib -DUSE_TCL_STUBS -fPIC -I/home/fred/.critcl/Linux-x86 -I/home/fred/Downloads/cryptlibl340 -o /home/fred/.critcl/Linux-x86/v035_f3376da98a25a3688b5158ce06d4a513_pic.o /home/fred/.critcl/Linux-x86/v035_f3376da98a25a3688b5158ce06d4a513.c  -L/home/fred/Downloads/cryptlibl340 -lcl_Linux-x86 -lresolv
/usr/bin/ld: cannot find -lcl_Linux-x86
collect2: ld returned 1 exit status
ERROR while compiling code in /home/fred/Downloads/cryptlibl340/bindings/cryptkit.tcl:

critcl build failed (/home/fred/Downloads/cryptlibl340/bindings/cryptkit.tcl)

AK - 2011-03-22 14:58:45

AK: -lcl, i.e. the library looked for is libcl... Could that be 'CryptLib'. In other words, it seems that cryptkit.tcl assumes that cryptlib is build and installed on your system. It might also be useful to look where in cryptkit.tcl the '-lcl' is declared, i.e. why it has this Linux-ix86 suffix.

stevel Further to AKs comments, this is a Cryptkit build issue, not a Critcl one. Follow the build instructions in the Cryptkit README file. It isn't an easy build, but it can be done if you follow the instructions carefully.