xTuple/Postbooks+MSVC is as easy as 1,2,3

Have you ever considered compiling xTuple/PostBooks on Windows? Perhaps you tried to set up an environment for our last Bug Derby and ran into problems. Sometimes getting things to work correctly requires arcane rituals or absurdly ridiculous actions. Please don't ask me why I have a jellybean stuck to my forehead. It doesn't have to be that way, and I'm here to share my latest experiences with you. When you're done following the instructions below, you'll have a development environment you can use for our up-coming Bug Derby.

Before we get started, let me set your mind at ease. This is not a technical document with a lot of boring, hard to understand commands. Setting up the environment for compiling is literally as easy as 1, 2, 3. Once we have the environment set up we can then get the source code to compile. That is also as easy as 1, 2, 3. Ok I cheated a little on my counting to get the 1, 2, 3; I think it may be the jelly bean. Nothing fancy. No magic.

Ready?

1. We need to download a compiler, in this case we are going to use Microsoft's Visual C++ (MSVC) 2008 Express. This is a free tool available from Microsoft. You can download it from http://www.microsoft.com/Express/VC/. Go ahead and get that download going.

What about MinGW? Min Gee What? Forget that for now -- this is for everyone out there in Windows land. There are reasons to use MSVC; some are technical and others are not. We could go into those, but I don't want to upset the jelly bean.

Once you have finished the MSVC download, go ahead and start the install. I accepted all the defaults. Next, Next, I Agree, Next, Next, you get the idea.

2. Now we need to download and install the Qt libraries. Starting with Qt 4.6.0 you can download precompiled libraries for MSVC. The install for this can be found at http://qt.nokia.com/downloads/windows-cpp-vs2008.

Oh, this latest version is so great! It comes with PostgeSQL support already compiled in. If you have done this in the past, this is usually where the hocus pocus and other strange stuff came in. No, No, No, not you jelly bean.

As before, when the Qt download is done, start the install and accept all the defaults.

3. Finally, we just need a little magic... whoops I didn't mean that. I meant... the purely simple and wonderful step of configuring Qt and MSVC together. Bear with me please -- this will be painless. I promise! We need to run the program "Visual Studio with Qt 4.6.0" which is in the Qt program folder created during the Qt install. Find, Run, Done. Easy as 1, 2, 3.

Wow! That was the easiest setup of a development environment I have ever done. I don't think the jelly bean had to help me at all. That's right, I said I didn't need you, jelly bean.

To recap setting up a development environment:

  1. Download/Install MSVC
  2. Download/Install Qt libs for MSVC
  3. Run Qt's Visual Studio with Qt 4.6.0 program

Next, we need to get source code and compile the application. For this step it is important that you use SVN and get the latest source code. If you don't, you may need the jelly bean yourself. Oh, he likes that thought, but I don't and don't think you do either. The latest 3.5 development code fixes a couple compilation problems under MSVC so we can all be happy.

Let's reset the count. :)

1. Download and install a tool for SVN. I used RapidSVN but if you have another preference then please use your own favorite SVN client. I got the latest version of RapidSVN for Windows from http://www.rapidsvn.org/download/release/0.12/. While that is downloading -- it shouldn't take long -- we can get ourselves a snack. Hmmm, the jelly bean seems to be missing now that I want him.

Again, I took all the defaults when installing.

2. Now we need to checkout the source code. We will need to checkout both OpenRPT and PostBooks. Uh oh, the jelly bean is lurking about. I will try to keep this as simple as possible. Start RapidSVN and go to "Repository | Checkout..." to bring up the checkout screen. Once open, we need to enter in the source URL and the Destination Directory and click Ok to checkout a project. Let's do this twice with the following information for each project:

  • OpenRPT
    • URL: https://svn.code.sf.net/p/postbooks/code/openrpt/trunk
    • Destination Dir: C:\xTuple\openrpt
  • PostBooks
    • URL: https://svn.code.sf.net/p/postbooks/code/xtuple/trunk
    • Destination Dir: C:\xTuple\xtuple

If you get an SSL Certificate message you can select one of the options to Temporarily or Permanently accept it. The jelly bean thinks that is funny. It's out of our control so we will just accept it and not give in to the jelly bean.

3. Compile time. The last step. The quickest and easiest way to do this is on the command line. Qt provides a tool shortcut in the Qt program group that sets everything up nicely. We will run that program, called "Qt 4.6.0 Command Prompt." Once that is open we want to cd to the OpenRPT source directory we checked-out with RapidSVN and start the build process. To do this we will issue the following commands:

  • cd C:\xTuple\openrpt
  • qmake
  • nmake

Oh, look at all the messages. It's like an Italian opera where you know there is some intelligent meaning in the singing but you can't keep up with it all. We will just enjoy the performance for what it is and try not to read too much into it. Was that a jelly bean among the performers on the stage? Naw, I must be seeing things.

When that has completed we will need to compile the xTuple project. Using the same command prompt we opened previously, we can issue basically the same commands as before, just to a different directory. Issue the following commands:

  • cd C:\xTuple\xtuple
  • qmake
  • nmake

This may take a while. You may want to go watch a movie or work... I guess.

What? I'm awake. I'm awake. Oh, it's done? Congratulations! See that wasn't that hard.

To recap compiling the source code:

  1. Download/Install RapidSVN
  2. Checkout the latest OpenRPT and PostBooks source
  3. Compile OpenRPT and PostBooks

That's it. No Magic, special incantations, or weird behaviour. The jelly bean is vanquished and he tasted mighty good. Using the MSVC IDE, or your favorite editor, you can start to change source code. You can participate in the up-coming Bug Derby and know you already have a development environment set up. Just don't forget to update your source using RapidSVN as we are constantly making changes.

I still marvel at how much easier this is getting. If you have any questions, or *gasp* problems, let me know and I will see if I can clear things up.

Addendum: Thar be jelly beans!

I noticed that if I was in the Qt Command console then I could execute applications without a problem. When I tried to navigate with the File Explorer and click on the executable I got a message about a missing DLL. I solved this by adding C:\Qt\4.6.0\bin to my PATH environment variable. This can be done in the Control Panel under Advanced Options.

Chris Ryan

Lead Software Engineer at xTuple, November 2001-September 2011

Developed and Managed ERP product in addition to designing and developing several other applications for the company. Defined and managed the development and release processes for all products. Setup and managed corporate network infrastructure, servers, and services.