NAO, qiBuild & Visual Studio 10

The following procedure installs Aldebaran Robotic’s qibuild tool for use with Visual C++ 10. It’s a sum-up of things written by Mike on his blog and notes from the documentation (yes, sometimes you should read that :-). It’s mainly for my own purposes, but maybe it can help someone out there..

  • Install Visual C++ 10
  • Install Python 2.6++ (qibuild uses Python scripts to setup and run stuff)
  • Install cmake and add to it the path
  • Download naoqi-sdk-1.12.2.2-win32-vs2010 from the NAO development site and add the bin folder to the path
  • Add the “python” and the – not yet existing – “pythonScripts” to the path.
  • Clone “git://github.com/aldebaran/qibuild.git” into your local repository
  • In your qibuild git directory, run “install-qibuild.bat”
E:devgitqibuild›install-qibuild.bat
Script installed in  E:devbinpy272Scriptsqitoolchain.py
Script installed in  E:devbinpy272Scriptsqibuild.py
Script installed in  E:devbinpy272Scriptsqisrc.py
Press any key to continue ...
  • Choose a workspace directory (called worktree in the cmake jargon) and go into it and … here we go…
cd E:devworkspacesqibuild
qibuild init --interactive
E:devworkspacesqibuild› qibuild init --interactive

Found CMake: e:devsdkcmake-2.8bincmake.exe
:: Please choose a generator
   1 Borland Makefiles
   2 MSYS Makefiles
   3 MinGW Makefiles
   4 NMake Makefiles
   5 NMake Makefiles JOM
   6 Unix Makefiles
   7 Visual Studio 10
   8 Visual Studio 10 IA64
   9 Visual Studio 10 Win64
   10 Visual Studio 11
   11 Visual Studio 11 Win64
   12 Visual Studio 6
   13 Visual Studio 7
   14 Visual Studio 7 .NET 2003
   15 Visual Studio 8 2005
   16 Visual Studio 8 2005 Win64
   17 Visual Studio 9 2008
   18 Visual Studio 9 2008 IA64
   19 Visual Studio 9 2008 Win64
   20 Watcom WMake
   21 CodeBlocks - MinGW Makefiles
   22 CodeBlocks - NMake Makefiles
   23 CodeBlocks - Unix Makefiles
   24 Eclipse CDT4 - MinGW Makefiles
   25 Eclipse CDT4 - NMake Makefiles
   26 Eclipse CDT4 - Unix Makefiles
› 7 (----> don't select a 64 bit version)
:: Please choose an IDE
   1 QtCreator
   2 Eclipse CDT
   3 Visual Studio
› 3
:: Do you want to use IncrediBuild ? (y/N)?
› n
Found a worktree in E:devworkspacesqibuild
:: Do you want to configure settings for this worktree (Y/n)?
› Y
:: Do you want to use a unique build dir (mand. when Eclipse) (y/N)?
› N
:: Do you want to use a unique SDK dir (y/N)?
› N

E:devworkspacesqibuild› dir
Directory of E:devworkspacesqibuild
26/03/2012  23:37    DIR          .
26/03/2012  23:37    DIR          ..
26/03/2012  23:37    DIR          .qi

› qitoolchain create win32-vs2010 E:devsdk
          naoqi-sdk-1.12.2.2-win32-vs2010toolchain.xml --default
Now using toolchain win32-vs2010 by default

Creating and initialising a project:

› qibuild create test_project
New project initialized in E:devworkspacesqibuildtest_project

› qibuild configure test_project
E:devworkspacesqibuild› qibuild configure test_project
Active configuration: win32-vs2010
Configuring test_project
-- Check for working C compiler using: Visual Studio 10 Win64
-- Check for working C compiler using: Visual Studio 10 Win64 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Visual Studio 10 Win64
-- Check for working CXX compiler using: Visual Studio 10 Win64 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- QI_SDK_DIR: E:/d...es/qibuild/test_project/build-win32-vs2010/sdk
-- Configuring done
-- Generating done
-- Build files have been written to: E:/dev/workspaces/qibuild
                   /test_project/build-win32-vs2010

The skeleton source file have been written into test_project and the target workspace projects files (VC10 in this case) in the sub-directory specified by the current toolchain.

Building the project:

E:devworkspacesqibuild› qibuild make test_project

Active configuration: win32-vs2010 (debug)
Building test_project in win32-vs2010 (debug)

Microsoft (R) Visual Studio Version 10.0.40219.1.
Copyright (C) Microsoft Corp. All rights reserved.
1›--- Build started: Project: ZERO_CHECK, Configuration: Debug x64 --
1›Build started 26/03/2012 23:44:41.
1›InitializeBuildStatus:
:
:
4›
4›Build succeeded.
4›
4›Time Elapsed 00:00:00.12
===== Build: 4 succeeded, 0 failed, 0 up-to-date, 0 skipped ====

The generated Visual Studio project can be opened by double-clicking on the project file:

E:devworkspacesqibuildtest_project
                           build-win32-vs2010test_project.vcxproj

To build via command line tool, the best is to enter into the project directory and build there:

E:devworkspacesqibuildtest_project› qibuild make

Generated executable is:

E:devworkspacesqibuildtest_projectbuild-win32-vs2010
                                    sdkbintest_test_project_d.exe

Once open in Visual Studio, right click on ‘test_project’ in the Solution ‘test-project’ tree and set as Start-up project. The click “run” and the project starts by default.Be sure that you select Win32 as target platform, otherwise the application will compile but not link despite of the fact that the NAO SDK libraries are specified in the linker input (project properties). The reason is that the NAO SDK libraries are 32 bit only and cannot be linked against a x64 object files.

You should also note that all modifications like adding source files and libraries have to be done in the project’s CMakeList.txt file, otherwise the next manual qibuild will remove them from your VS project file. The art is to keep the project able to build via manual make command.

To configure existing projects with qibuild, go into the project directory and execute to command below. The same you have to do if you change your environment. qibuild put the absolute library path in the build file and moving a project around requires a reconfiguration.

qibuild configure

6 thoughts on “NAO, qiBuild & Visual Studio 10

  1. Hi !

    It’ possible to have the link for qibuild please ? I’m trying with “git://github.com/aldebaran/qibuild.git” but I can’t find it.

    Thanks !

    Quentin

  2. I am finding error while running …
    qibuild make say helloworld

    I am getting pthread.h not found error

    C:naoqi-sdkdocexamplescoresayhelloworld>qibuild configure sayhelloworld
    Active configuration: mytoolchain
    Configuring sayhelloworld
    — QI_SDK_DIR: C:/naoqi-sdk/doc/examples/core/sayhelloworld/build-mytoolchain/sd
    k
    — Looking for include file pthread.h
    — Looking for include file pthread.h – not found
    — Configuring done
    — Generating done
    CMake Warning:
    Manually-specified variables were not used by the project:

    CMAKE_TOOLCHAIN_FILE

    — Build files have been written to: C:/naoqi-sdk/doc/examples/core/sayhelloworl
    d/build-mytoolchain

    1. AR is keeping this tool evolving a lot. The best is to ask on the mailing list “qibuild-dev< **ADD**>aldebaran-robotics.com”

Leave a Reply

Your email address will not be published. Required fields are marked *