objarni's picture

Automatic building of OpenTK trunk

Project:The Open Toolkit library

As discussed in this thread, it would be good if OpenTK had a continous integration build server, featuring this:

  • Hourly update-prebuild-build of OpenTK trunk
  • Generation of "build report" in eg. HTML format, viewable from OpenTK.com

This would make it easier for OpenTK developers to know whether a commit has "broken the trunk", and minimize traffic on the forums for issues of mere compilation errors.


  • What OSs should the build script build on?
  • What build tool should be used? NAnt, xbuild, VisualStudio, ..?
  • Should the script also produce "nightly builds" of the OpenTK library?

Lets update the above together, since I'm not sure of the details on how to build OpenTK (never done it, shame on me!)


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
iliak's picture


I suggest using Visual Studio Express Edition as a building tool as it's free and every one can have access.

the Fiddler's picture


Status:open» confirmed

On Windows, the best solution is to use MSBuild, the build engine that ships with .Net. There is no need to launch an IDE just to build a project (and how would you instruct Visual Studio to build a project anyway)?

On Linux, we have to choose between XBuild (Mono's MSBuild implementation), Nant, makefiles or another custom solution.

  • I just tested XBuild that ships with Mono 2.4 and it fails to build OpenTK (it enters an infinite loop - better than previous versions, but still not good enough).
  • Nant fails to build OpenTK.Utilities for some reason, but this shouldn't be terribly hard to work around. Unfortunately, Nant is a dead project and I'm not so sure it's a good idea to rely on it - however it would work until XBuild is fixed.
  • Makefiles: MonoDevelop fails to create them for the OpenTK project structure. It's not hard to create them by hand, but I'd rather not do that.
  • Custom solution: a script that invokes gmcs directly. Only as the very last resort.

The actual build scripts are trivial:

cd opentk/trunk
svn up
cd Build
mono Build.exe vs
[msbuild|mono xbuild] OpenTK.sln /configuration:Debug
[msbuild|mono xbuild] OpenTK.sln /configuration:Release

The output for the build commands would be redirected to a logfile that would be copied to a specific location for further processing.

The build server could run some form of Linux with side-by-side Mono installations (for testing multiple versions), plus a Windows VM for testing on Windows. Mono's compiler is the same across operating systems, so there's no need to test *compilation* on Mac OS (testing if it runs is another issue entirely).

The final issue is finding the actual server. Does anyone know of any free build services out there?

the Fiddler's picture


I am currently investigating the openSUSE build service as a way to build OpenTK packages automatically. My current understanding is that this will require some changes to the project structure (or at least provide an autotools build script) - if anyone is familiar with the service, please make a post.

objarni's picture


What mono version is it to build OpenTK? I'm running Ubuntu 9.04 at home "vanilla" install so to speak.. Might be possible to set something up there, if it is just about checking whether it builds or not. (I can upload the resulting HTML-file to some ftp-site I have access too, then OpenTK.com can use that URL..)

Since I got my computer 24/7 anyway, why not put it to use :)

the Fiddler's picture


OpenTK builds correctly on Ubuntu 9.04 (ships with Mono 2.0.1).

I've managed to trace why XBuild 2.4 is failing and will log a bug report to the Mono bug tracker. If I manage to find a simple workaround for this issue, it should be trivial to create a daily build task that uploads the build results to an ftp server.

Objarni, can you please check whether the attached version of xbuild works on your system (just run it from a terminal and see if it crashes)? If it runs, can you test the following sequence of commands?

svn co https://opentk.svn.sourceforge.net/svnroot/opentk/trunk opentk/trunk
cd opentk/trunk/Build
wget http://www.opentk.com/files/issues/xbuild.tar.gz
tar -xvf xbuild.tar.gz
mono Build.exe vs
./xbuild OpenTK.sln /target:OpenTK

If it compiles, awesome!

Edit: fixed a typo.

xbuild.tar.gz17.97 KB
objarni's picture


Fiddler, I'm at work :(

Not sure I'm home before 1900 GMT..

the Fiddler's picture


Status:confirmed» in progress

No prob, it's not as if this is urgent. :)

objarni's picture



Glad to help when I can! l8r..

objarni's picture


Ok this is the output from the above script commands:
(cutting away the co of opentk)

Creating VS2005 project files
Prebuild v2.0.4
Copyright (c) 2004-2008
Matthew Holmes (matthew@wildfiregames.com),
Dan Moorehead (dan05a@gmail.com),
David Hudson (jendave@yahoo.com),
Rob Loach (http://www.robloach.net),
C.J. Adams-Collier (cjac@colliertech.org),
See 'prebuild /usage' for help
Creating Visual C# 2005 solution and project files
...Creating project: Bind
...Creating project: Build
...Creating project: Examples
...Creating project: OpenTK
...Creating project: OpenTK.Utilities
** (./xbuild.exe:5196): WARNING **: The following assembly referenced from /home/olof/Projects/opentk/trunk/Build/xbuild.exe could not be loaded:
     Assembly:   Microsoft.Build.Engine    (assemblyref_index=4)
     Public Key: b03f5f7f11d50a3a
The assembly was not found in the Global Assembly Cache, a path listed in the MONO_PATH environment variable, or in the location of the executing assembly (/home/olof/Projects/opentk/trunk/Build/).
** (./xbuild.exe:5196): WARNING **: Could not load file or assembly 'Microsoft.Build.Engine, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
Unhandled Exception: System.TypeLoadException: Could not load type 'Mono.XBuild.CommandLine.MainClass' from assembly 'xbuild, Version=, Culture=neutral, PublicKeyToken=null'.
the Fiddler's picture


Which probably means that xbuild needs the correct Mono stack to function. Thanks for testing, it seems that Nant is the only way to support different Linux distros (unless Prebuild manages to create a working autotools script - I'd forgotten it could do that, let me check).

Edit: the autotools target actually worked! It managed to build OpenTK.dll and OpenTK.Utilities.dll but failed on Examples.exe. I'm not sure I like this approach, but it offers an avenue that does not depend on nant.