MADDE/QtCreator integration for windows

(QtCreator Configuration)
(Deploy SSH key)
Line 249: Line 249:
Now click on "Apply" and your QtCreator installation is set up to connect to the device via SSH key.
Now click on "Apply" and your QtCreator installation is set up to connect to the device via SSH key.
-
 
-
 
-
 
-
 
-
 
-
 
-
'''Note''' that the N900 has to be connected and the password has to be valid. You can check that by clicking on the "Test" button.
 
== Use Maemo5 build settings ==
== Use Maemo5 build settings ==

Revision as of 08:11, 10 March 2010

Contents

QtCreator and MADDE on Windows

This is a guide on how to enable MADDE in QtCreator. This is part of the technology preview. After following this guidance you are able to build your sources within QtCreator for your device, and deploy, run and debug your applications with few mouse clicks from your Windows installation.

Requires:

  • MADDE installed on your Windows machine


General advice

As this is a technology preview, remember that bugs can occur. If some of the components don't work as expected, please add your question to the talk-thread and follow up the discussion.



Install latest QtCreator on your PC

You cannot use the latest official QtCreator for this. The version has to be >= 1.3.80! For these instructions the version of the 2010-02-24 is used! Find the latest build of QtCreator for windows here:

http://qt.nokia.com/developer/qt-snapshots

Please install besides the basic installation at least the components called "MinGW" and "Post mortem debugging" of QtCreator to be able to follow all the steps of the instructions. You should be able to select those, during the installation process in a dialog like this:



Add Qt for Maemo5

You can change the configuration of the Qt-version in your QtCreator installation by clicking:

Tools -> Options... -> Qt4 -> Qt Versions

The screen you see then should look like the screenshot below. By default the Qt-versions are shown, which are installed on your system.


Tip: If you do not see any Qt version by default here, you most likely haven't installed the needed Qt libraries to compile your Qt application for your Windows environment.


In the next step you have to add the Qt version for Maemo5 to the configuration of QtCreator. It is needed to compile your sources for your Maemo device. Click on the "+" in the upper-right corner. The configuration form will ask you to enter a "Version name" and to locate "qmake". You can find it in your MADDE installation folder under:

<MADDE_folder>/targets/<target_name>/bin

For the standard installation it would be for example:

Version name: Maemo Qt4.5
qmake Location: c:\madde\0.6.14\targets\fremantle-qt-0951\bin\qmake.exe

Now you will see Qt for Maemo as a new Qt Version in Qt Creator. But first you will see the red cross next to the Qt Version in the column "Debugging Helper". The last step you have to do now is clicking on "Rebuild" and after a while (you can follow the status in the QtCreator main window) it should look like this:



Configure device run-time in Qt Creator

After setting up the connection between your Windows PC and your device, you will be able to compile, deploy, test and debug your application with a single mouse-click. The description is divided into two parts and shows:

  • what to install on device, and
  • how to set-up your windows environment



Device configuration

Install the client

Please keep in mind that this is a TECHNOLOGY PREVIEW. The following steps should only be taken if you want to test software in an early stage of development. To test the preview, you have to activate the extras-devel repository on device.


1. Open the Application Manager.

2. Add the extras-devel repository.

3. Go to: Download -> Development -> mad-developer

4. Install the client


The following instructions show how to connect your device with your PC by using the USB connection.



Configure the client for USB

Please start the client on your device. As you want to use Windows as your development environment, you have to change the driver, which is loaded to instantiate the connection. You have to follow these steps:


1. After starting the client click on "Manage Usb"



2. Then choose "Load g_ether"

File:02 client props.png



3. If Module in use is "g_ether" click "close"



4. Now you can set up the USB settings. Please click on "edit", which shows you the USB-configuration settings. Then click on "configure". After that your client is set up for the connection with your PC.



TIP: There might be problems if you have a GPRS connection running on the device. Please shut that down while testing



Windows configuration

The easiest way to connect your device to the PC is to install PC-Connectivity. The install-file you find here:

PC Connectivity

Then follow the instruction and choose just the option USB-Networking, like in this screenshot:


Connect your device with the PC. The client should be configured as described before. Choose "PC suite mode" as connection method. If not already automatically happened, enter these configuration details:

Image:02_pccon_config.jpg


After clicking on "apply", you should see in your network configuration, that the connection is established.



Tip: In some cases there might occur problems, if you have an active VPN connection.




QtCreator Configuration

After the connection between your PC and the device is set up, you can configure QtCreator to deploy and run the built applications on device. You can add your device in the configuration. You will find it in:

Tools -> Options... -> Qt4 -> Maemo Device Configurations


First get the password from the Mad Developer application. You get it by clicking on "Developer Password" in the main view. Be aware that each time you click on the button, a new password will be created and that the password is only valid for the time it is shown in the application.


Add the password and all the data you see in the screenshot below. Check the box, that you want to use the password as the authentication method. After that click on "test" and see if the connection can be set up.



Tip You can use your ssh key for the connection. Click on "Deploy Key ..." and select your key. If the other settings are correct the key will be automatically deployed on your device, so that you don't have to worry about the passwords anymore. To Deploy the SSH key, you first need to obtain it. Here are the steps :

  • Open up MADDE terminal in Windows. (In Start > Programs > MADDE > MADDE terminal)
  • type "cd /"
  • Type "ssh-keygen -t rsa"
  • Pick a name for your key (I just called mine rsa1)
  • Pick a password if you want one (I left it blank so no password)
  • In Qt click "deploy key" and browse to where the key is (MADDE\MADDE_VERSION\home\<username>\.ssh)
  • Select your_key_name.pub file
  • Qt should say key sucessfully deployed
  • Change "Authentication Type" option in Qt to "key"
  • In the Private Key file entry at the same window, browse for the 2nd file generated at step 3. "id_rsa"
  • Click "Test" in Qt to check it works properly


Deploy SSH key

If you have already created a key for other purposes you don't have to create a new one and you can ignore the description on how to create the key and just continue with the deployment of the key.

Create a key

To create a key please open the "MADDE Terminal" and run:

ssh-keygen.exe

Then please follow the instructions. In this example the name of the key is set to "maemo-test". The terminal should look like this:


Deploy the key from QtCreator

To be able to connect to your device by using the key, you have to:

  • deploy your public key on your device, and
  • specify in QtCreator, where to find the private key

You can configure these settings in the Maemo Device Configurations

Tools -> Options... -> Qt4 -> Maemo Device Configurations

Note: For these steps your device has to be connected to the PC and the password has to be valid. By clicking "Test" button, you can check if the set-up if that is the case.


Now you click on "Deploy..." and select the public key you have created before. If you have specified a file-name you will find it in:

C:\MADDE\<version>\home\<username>\<keyname>.pub


Once the key is deployed correctly you can set up your device-configuration to use the key to connect to the device. Change now the "Authentication type" from "Password" to "Key". Now it uses a standard location, for the private key, which should not exist. Change the location, with the one of your real key. Following this tutorial you will find it in:

C:\MADDE\<version>\home\<username>\<keyname>

Now click on "Apply" and your QtCreator installation is set up to connect to the device via SSH key.

Use Maemo5 build settings

Now all the configuration is done and you can select Maemo as a build configuration. If you have a project, which you want to compile for Maemo, then click on the project button in the menu of the left side. Now you should seen a screen, like in the screen shot below. If you have the Qt libraries installed, then you will have the "Desktop" as the default option selected.

Image:04_qtcreator_init.jpg



Now press the plus in the widget, which shows, that "Desktop" is selected as default. This should open a new dialog, where you select "Maemo Device":


Image:05_qtcreator_maemodev.jpg



After that you will find a new build-configuration.

Image:06_qtcreator_build.jpg



Now click there on "Run" and select your device, which you have configured before. In the example it was called Maemo5 Device.

Image:07_qtcreator_selectdev.jpg




Finally you can now set in the down left corner, which build configuration you want to use:

Image:08_qtcreator_final.jpg


Now you can click on the run button, and your application will be automatically compiled for the Maemo device, delpoyed, and started.