Develop


Version 12 (modified by falkon, 2 years ago) (diff)

--

Developer Setup for Windows with MinGW32 and Eclipse

Configuring your Windows machine to compile XCSoar using the MinGW compiler and the Eclipse development environment

Note: This creates just the PC/Windows version of XCSoar, not the versions that run on a PDA, PNA or Altair.

Another Note: You don't need Eclipse to compile XCSoar under Windows. Eclipse is a development tool, that some users like for editing and debugging the project. This tutorial for setting up Eclipse is actually based on the non-Eclipse tutorial.
(Goto Advanced/Development/Setup/WindowsBasic for non-Eclipse windows setup)

1) Follow steps 1, 2 and 3 in XCSoar's instructions for the "Basic Windows Developer Setup"

  • Step 1 downloads the "Full Git" package which includes Git, MinGW Compiler, gdb debugger and many other tools we might need
  • Step 2 installs and compiles the package you just downloaded
  • Step 3 downloads the XCSoar source code.

You do not need to follow steps 4 and beyond which cover command-prompt compiling, although those steps are good to know.

If you compiled XCSoar already, please call "make clean" from the mSys console for cleaning up the compiled files.

2) Download and Install Java for Windows

If you have Java installed already skip this step.

3) Download and Install Eclipse IDE for Windows

The Eclipse IDE is an integrated development environment similar to the Microsoft Visual Studio environment, but it is open source and it runs the MinGW compiler.

I have noticed that prior versions have slightly different configuration screens, so later versions may also have differences in the configurations. The instructions below apply to the "galileo" version of Eclipse:

  • Download the current version of Eclipse (eclipse-cpp-galileo-SR1-win32.zip) from:

http://www.eclipse.org/downloads/

Attention: Make sure you downloaded the version for C/C++ Developers

  • Extract the .zip file to your C: drive. You should get a folder called "C:eclipse" containing the executable.
  • Run the "eclipse.exe" executable to start Eclipse. You don't have to install anything here, Eclipse runs just like that.
  • When asked for a workspace, just confirm the dialog or choose a different folder where you want your workspace to be stored.

    Important: Do NOT choose the XCSoar folder here! The workspace folder contains lots of data that is personal to your PC and should not be mixed with the XCSoar files managed by git.

4) Import the XCSoar project into Eclipse

  • After starting Eclipse, close the Welcome Screen if necessary
  • Click File > Import in the menu
  • Select General > Existing Projects into Workspace and click [Next]
  • Select the XCSoar folder (e.g. C:xcsoar) as the root directory. Click [Finish]
  • You should now see the XCSoar source files in the project explorer

Eclipse: XCSoar project loaded in the Project Explorer

5) Adding the "Path"

To let Eclipse know where we installed the mSys/MinGW environment, we need to add it to the "path".

  • Right-click on the XCSoar project in the project explorer
  • Choose Properties from the context menu
  • Goto C/C++ Build > Environment
  • Choose "[ All configurations ]" from the drop down box in the top
  • Check whether the PATH variable already exists, if so skip this step and continue with step 6.
  • If no PATH variable is set yet, click on Add...

Eclipse: Adding the PATH variable

  • Fill the Form with these:

    Name: PATH
    Value: C:msysgitmingwin;C:msysgitin
    • Please note: At least in the "Eclipse Helios Service Release 2" holds, that if you add variable "PATH", the value from system's Path variable will be used! Be careful when you are using Windows 7 x64, because incorrect system Path value can results in various "magic" errors. Please see the section "Troubleshooting" at the bottom of this page for detailed information...
  • Click OK, and close all dialogs

6) Compile/Build? XCSoar

  • Click on the "hammer icon" (Build) in the toolbar and choose one of the configurations, for compilation and linking of the appropriate files to generate the executables.

Eclipse: Build icon

  • Click Run > Run As to launch XCSoar. (Choose XCSoar-ns.exe)

If you are asked for a debugger, choose the MinGW gdb Debugger




7. Troubleshooting


Window 7 x64 - system's Path settings


If you are developing on Windows 7 x64, you need to be careful about your system's Path setting. The reason is that on Windows 7 x64 you can have "Program Files (x86)" included in the system's Path variable. The problem is with the parenthesis in the name of that folder, because in the Un*x-like systems parenthesis are treated as special characters. Therefore the msys tools (MinGW) could have difficulties with parsing the whole Path - it happens often, that the Path is parsed until the first parenthesis is found. Therefore you need to have directories c:msysgitmingwin;c:msysgitin; BEFORE any Program Files (x86) occurence. I suggest you to have Path like this:

%SystemRoot%system32;%SystemRoot%;c:msysgitmingwin;c:msysgitin; ...


A) I'm getting "*** multiple target patterns" error when trying to incrementally build the project in Eclipse, but I'm able to build it from command-line


Symptoms:

  • you are able to build project from command-line after make clean
  • and you are able to build it after "Cleaning" project from Eclipse environment
  • you are unable to incrementally build the project from Eclipse IDE


Solution:

  • modify your system Path variable according to "Window 7 x64 - system's Path settings" section. You need to have c:msysgitmingwin and c:msysgitin before any directory, that contain parenthesis or any other "strange" character (like "Program Files (x86)").


Next steps

Attachments