Building Trac on Solaris
Trac is a great piece of software. However, it relies on a number of dependencies to work its magic and these can be painful to build on Solaris. This article describes what I had to do to build Trac with all its dependencies on Solaris 10.
Code lines beginning with "####" are comments to be read and not typed. Lines beginning with "$" indicate a shell command.
- Python 2.3 - 2.4
- Download and install latest Python from http://www.python.org/
- Or Install the SFWpy package from the Companion CD.
- Or install the Python package from http://www.sunfreeware.com/
- In this case I manually built Python 2.4.1 and installed it into /opt/python24/bin/python - the configure command I used was:
$ ./configure --prefix=/opt/python24 --enable-shared
- SWIG 1.3.19 - 1.3.21, or 1.3.24+
- http://www.swig.org/
I used version 1.3.27 and installed into /opt/swig
- GNU make (gmake) was required.
- Build/install with:
$ ./configure --prefix=/opt/swig --with-python=/opt/python24/bin/python
$ make
$ sudo gmake install # gmake required on Solaris 10
- Subversion 1.2.x (with SWIG bindings for Python)
- http://subversion.tigris.org/
- I used Subversion 1.2.3 and installed it in /opt/subversion123
- I already have Apache installed in /opt/apache
- I had to add a line to apr/include/apr.h as shown.
$ ./configure --prefix=/opt/subversion123 --with-ssl --with-apxs=/opt/apache/bin/apxs --with-swig=/opt/swig PYTHON=/opt/python24/bin/python
$ make
$ vim apr/include/apr.h
#### then add the following line near the top, exactly as-is ("#" and all):
#define PATH_MAX 1024 /* max # of characters in a path name */
$ make swig-py
$ sudo make install
$ sudo make install-swig-py
- SQLite
- http://www.sqlite.org/
- I used SQLite 3.2.7 and installed it in /opt/sqlite
$ ./configure --prefix=/opt/sqlite --enable-threadsafe --disable-tcl CFLAGS="-I/usr/local/include -L/usr/local/lib"
$ export PATH=/usr/xpg4/bin:$PATH # for a compatible awk
$ vim Makefile
#### search for the first occurrence of "-o sqlite3" by typing:
/-o sqlite3
#### append to end of this line:
-lrt
#### so the line will now look like:
-o sqlite3 $(TOP)/src/shell.c libsqlite3.la $(LIBREADLINE) -lrt
$ make
$ sudo make install
- PySQLite
- http://initd.org/tracker/pysqlite
- I used version 2.0.5.
- I had to modify setup.cfg to set my custom SQLite path, as shown.
$ vim setup.cfg
#### modify the two lines below to reflect the correct path:
include_dirs=/opt/sqlite/include
library_dirs=/opt/sqlite/lib
$ /opt/python24/bin/python setup.py build
$ sudo /opt/python24/bin/python setup.py install
$ sudo crle -u -l /opt/sqlite/lib
- Clearsilver - version >= 0.9.3 (0.9.14 recommended)
- http://www.clearsilver.net/
- I used version 0.9.14 and installed into /opt/clearsilver
- GNU diff is recommended (possibly required) so install it if needed (try "diff --version").
- GNU make was required also.
- Clearsilver was a pain to build, and this reference helped a bit http://groups.yahoo.com/group/ClearSilver/message/512
- The Trac guys recommend that Clearsilver is built thread safe. But how do you force and verify this?
$ ./configure --prefix=/opt/clearsilver --with-python=/opt/python24/bin/python --disable-apache --disable-perl --disable-ruby --disable-java --disable-csharp
$ vim rules.mk
#### modify the following two lines to match
INSTALL = $(NEOTONIC_ROOT)install-sh -c
LDSHARED = $(CC) -shared -fPic -mimpure-text
$ gmake
$ gmake
#### yes, two gmakes are required!
#### you will then get an error like: "ld: fatal: relocations remain against allocatable but non-writable sections"
#### but soldier on anyway...
$ cd python
$ LDFLAGS=-mimpure-text /opt/python24/bin/python setup.py build_ext --inplace
$ cd ..
$ gmake
$ sudo gmake install
$ cd python
$ LDFLAGS=-mimpure-text sudo /opt/python24/bin/python setup.py install
- Enscript [optional - for syntax colouring]
- http://directory.fsf.org/GNU/enscript.html
- I used enscript 1.6.1 and installed into /opt/enscript
$ ./configure --prefix=/opt/enscript
$ make
$ sudo make install
- Trac
- I used Trac 0.9.1 and it gets installed into /opt/python24
- So trac-admin is: /opt/python24/bin/trac-admin
- And the cgi/htdocs/templates are all in: /opt/python24/share/trac/
- I used Trac 0.9.1 and it gets installed into /opt/python24
$ /opt/python24/bin/python setup.py build
$ sudo /opt/python24/bin/python setup.py install
- So to make a new Trac instance in /export/tracdata/test you would use:
$ /opt/python24/bin/trac-admin /export/tracdata/test initenv
If you have any comments or want extra help or assistance building Trac, contact miles.chris at gmail; add a comment to this article; or post to the forum on this site.
I hope this helps.
ImportError: No module named svn
Following these instructions (almost exactly) I kept getting "ImportError: No module named svn" when running initenv.
Turned out the /svn-python/ was located in /opt/subversion123/lib/svn-python
Adding "/opt/subver..." to /opt/python24/lib/python2.4/site-packages/Extra.pth
fixed the problem it seems and initenv runs with no errors.
wiki.cs missing
This is quite odd, but initenv worked with no errors (see my previous comment) but it didn't seem to fully population the templates directory of my environment. It only had (README, site_css.css, site_footer.cs, site_header.cs, site_newticket.cs) nothing else. So it error'd out with "SystemError: Stat of /export/tracdata/test/templates/wiki.cs failed: [0] Error 0" because there was no wiki.cs file there. A manual copy of all the templates from the .../share/trac/templates seems to have it all working fine now.
Any ideas on why this would've happened, or how to fix it?
\\rgalgon at gmail//
subversion integration problem solved
Having built everything I tried to browse source I received an error like this: [path] does not appear to be a Subversion repository
The log was showing errors like this: 'Exception exceptions.AttributeError: "SubversionRepository
object has no attribute 'log'" in
The problem lies in libiconv (who might guess). Patching and rebuilding it was enough. This link tells how to do it: http://trac.edgewall.org/ticket/2560#comment:20
Note also that SWIG 1.3.29 did not work for me, too; I had to downgrade to 1.3.24 and all worked.
clearsilver rules.mk
my configure for clearsilver didn't filled the correct path to my PYTHON_SITE it was just PYTHON_SITE = this lead to: /usr/bin/ginstall -c neo_cgi.so /usr/bin/ginstall: too few arguments Try `/usr/bin/ginstall --help' for more information. make: *** [install] Error 1
if this is empty in your case, try inserting the correct path and run make install again...
nevertheless, thanks for this tutorial chris!
For thoose who builds with subversion 1.3.0
I failed to build subversion 1.3.0 with SWIG-bindings, make swig-py failed with "ld: fatal: relocations remain against allocatable but non-writable sections".
I got it working by patching the build/get-py-info.py with:
http://svn.collab.net/viewvc/svn/branches/1.3.x/build/get-py-info.py?rev=18156&p1=branches/1.3.x/build/get-py-info.py&p2=branches/1.3.x/build/get-py-info.py&r1=18155&r2=18156
...then it worked as a charm :)!
/Osten