2

I have obtained the sqlite source code with:

sudo apt-get install fossil
mkdir sqlite
cd sqlite
fossil clone http://www.sqlite.org/cgi/src/doc/trunk a
fossil open a
rm a

and compiled it with the instructions on the README. Now I want to run make test.

The README says that that requires Tcl development files. On Ubuntu 14.04 I run:

sudo apt-get install tcl8.6-dev

Then if I make test it gave tcl.h not found

So I located tcl.h and run:

CPATH="$CPATH:/usr/include/tcl8.6" make test

But now it gives:

/tmp/cc4jwHgX.o: In function `dbFreeStmt':
/home/ciro/git/sqlite/./src/tclsqlite.c:451: undefined reference to `Tcl_Free'
/tmp/cc4jwHgX.o: In function `closeIncrblobChannels':
/home/ciro/git/sqlite/./src/tclsqlite.c:189: undefined reference to `Tcl_UnregisterChann

 ...

I have tried:

cd /usr/lib/x86_64-linux-gnu
sudo ln -s libtcl8.6.so libtcl.so

with not success.

Ciro Santilli OurBigBook.com
  • 26,663
  • 14
  • 108
  • 107
  • I suggest you ask on StackOverflow -- that's where the Tcl experts are. – glenn jackman Jan 03 '15 at 18:00
  • Can you clarify exactly where/how you got the source? I unpacked and configured the (latest) sqlite-autoconf-3080704.tar.gz file from the site you linked but the Makefile doesn't appear to have a `test` target. BTW why do you need to build sqlite from source at all? – steeldriver Jan 03 '15 at 18:39
  • @steeldriver added clone method. I'm pretty sure `make test` exists since it runs (and fails), and since the README says it exists. I'm compiling it to learn database internals. – Ciro Santilli OurBigBook.com Jan 03 '15 at 20:18
  • I think maybe you should have installed the `tcl-dev` meta package instead of the specific `tcl8.6-dev` version package - it appears to include a `/usr/lib/tcl-Config.sh` script that sources a suitable Tcl build environment. I was able to `make` and `make test` without modifying anything. – steeldriver Jan 03 '15 at 20:35
  • @steeldriver thanks for the tip. It definitely is the better package, as it contains the symlinks to the 8.6 version, but I still get the same errors: the include would need to be `tcl/tcl.h` to work. The `.so` is now there, but I get the same link errors as before :( – Ciro Santilli OurBigBook.com Jan 04 '15 at 11:05
  • @steeldriver ah, I've cloned again and restarted the process and it works the problem is that I hadn't recompiled... Please add your `tcl-dev` comment as an answer and get 25 rep :) – Ciro Santilli OurBigBook.com Jan 04 '15 at 12:03

1 Answers1

2

The sqlite configure script appears to look for a Tcl installation as follows:

checking for Tcl configuration... found /usr/lib/tclConfig.sh
checking for existence of /usr/lib/tclConfig.sh... loading

This shell script sources a suitable environment such as INCLUDE and LIB directives, but it is provided by the tcl-dev meta package, rather than the specific tcl8.6-dev package that you installed.

If you install the tcl-dev meta package and do a clean build then the Tcl components should be located without any need to set other variables in the make command.

The tclConfig.sh script seems to be Tcl's own equivalent of the more generic pkg-config mechanism.

steeldriver
  • 131,985
  • 21
  • 239
  • 326