Rivet - OpenBsd 4.9

PWQ Septempber 2011

I have installed Apache Rivet on openBSD. This may have been explained before but the apache email archives are not searchable so I describe here for others to reference.

Extra steps are involved due to apache running in chroot environment.

Configure options:

   ./configure --with-apache=/var/www/ --with-tcl=/usr/local/lib/tcl/tcl8.5/ 


  1. Get default tcl8.5 package of build from ports standard flavor. Rivet will not load into apache if threads are compiled in.
  2. edit src/Makefile and remove -v option from rm command as it is not supported in OpenBSD.
  3. makedir -p /var/www/var and create link /var/www/var/www to '..
  4. makedir -p /var/www/usr/local/lib/tcl/tcl8.5 and copy recursive from /usr/local/lib/tcl/tcl8.5
  5. cp other relevant libraries (such as libtcl85.so.*) to /var/www/usr/local/lib. Use ldd to find dependent libraries.
  6. pkg_add itcl-3.4b1p0 and copy to /var/www/usr/local/lib/tcl. Rivet packages depend on it
  7. pkg_add tcllib-1.12 anc copy md5 module to /var/ww/usr/local/lib/tcl. DIO Session support requires it.

Rivet Config

Put options into /var/www/conf/modules/rivet.conf. It will be autoloaded by apache.

LoadModule rivet_module /usr/lib/apache/modules/mod_rivet.so
AddType application/x-httpd-rivet .rvt
AddType application/x-rivet-tcl .tcl

AddType 'application/x-httpd-rivet;charset=utf-8' rvt

RivetServerConf ChildInitScript "package require DIO"

RivetServerConf ChildInitScript \
        "::DIO::handle Mysql DIO -user ???? -pass ???? -db ???"

RivetServerConf ChildInitScript \
        "package require Session; Session SESSION -debugMode 0"

Replace ??? with data specific to your database. This line and line following are only needed if you use sessions.


I noticed an error in the current rivet manual. The DIO command array takes its arguments in the opposite order to that shown in the manual.

There could be more changes I made and forgot about, check your /var/www/logs/error_log to see messages from Rivet as to what problems are detected.


The following are observations that may be generic to Rivet, or may be artifacts of the build process under OpenBSD that I have used.

  1. Possibly due to nothreaded compile, Itcl objects are left around across invocations. If you leave DIO database handles and ITcl objects around then the next script may end up with name clashes. If your script fails with an untrapped error then expect issues with left over commands.
  2. SESSIONS using msql seem to file spasmodically with "mysqlsel/db server: MySQL server has gone away" error. Adding:
            DIO close

to the end of every script seems to stop this happening.

Note: destroying the DIO object causes sessions to abort every page until apache is restarted.