Next Previous Contents

7. Using Kdevelop 2.1 with integrated crosscompiling

This chapter describes how to use kdevelop 2.1 with integrated cross compiling features. The first version is already available on http://www.kdevelop.org. Follow the instructions at the download page.

Attention !!!
The CVS-Server is not any more cvs.kde.org. I used cvsup.kde.org, since a few days the server is documented as anoncvs.kde.org.

!!! Hint !!!
Since ipaqhelp 0.2.5 kdevelop is handled different. I had many problems to get kdevelop to crosscompile correctly. So I decided to go a more manual way. I changed the /etc/ld.so.conf (removed all cross related entries) and all .goqtxxrc files (see above). Since then I start kdevelop from the shell switching to e.g. qtopie before. This allows me to use e.g. $EXTRALIB entries in the kdevelop configuration and add remove special libs via this way.

7.1 Setup for X-embedded

Just switch to qtemb environment and start kdevelop from the shell.

The menu options->kdevelop-setup->Compiler allows the user to define the cross compililation tools. Assuming you have a i386, you can choose the build system as i386, linux and the target compile system as an arm, linux. Fill in the fields you have your cross-gcc installed.

attention
Dont use special characters to name your target system (e.g. blanks, ... ), because kdevelop works, but destroys the *.kdevses file. I did not do this my own, but got an email from a user who went into this trap. I will inform ralf nolden about that to get it fixed.

Now create your first example program. Name it e.g. kdev21test and choose the qt2 SDI template.

To prepare for emb crosscompiling, follow the steps below.

  1. Enter the menu project->options and choose compiler setup.
  2. Overwrite the Text (Standard) in the "Configuration" combo box and e.g. write emb instead. Press the Add button right of that. This will enable the build-dir field. You can chage it or let as it is. Kdevelop chooses the dir ../emb to store the result.
  3. Choose the tab page Flags and Warnings. Choose Wall as compiler warnings and enter $OPTIONS $EXTRA_INC_PATH into the CPPFLAGS field.
  4. Choose the tab page Linker Flags. Enter $EXTRA_LIB_PATH Additional Flags field.
  5. Choose the tab page Configure. Enter /usr/lib/qt2emb into the --with-qt-dir field, --enable-embedded --enable-qtopia into the Additional Options field.
  6. Choose the menu entry options/linker-options. Enter $(LIB_QPE) -lyourExtra additional library field, where yourExtra is an extra lib (e.g. -luvqtutil). Multiple libraries have to use the same syntax (-la, -lb, lc, ...).
    Hint : Make sure, that e.g. -lopie is not included. The opie compilation requires that extra lib. As kdevelop does not support Environment variables here, we have to add that lib manually when using opie environment.
  7. Pressing the OK-button will start the configure script and cause an error. Dont be frustrated, everything is OK so far.
  8. KDevelop has a new combobox (second ToolBar line, very left). Here you can choose, which target you want to compile. Choose standard first, and start make distclean;make autoconf;./configure
  9. To get another target compiled, you have to start make distclean in the standard configuration. Change to emb and do a make autoconf;./configure.
  10. Compile your test program now for embedded use. It will compile, but not be helpfull, as it creates a qapplication instead of an qpeapplication.
  11. To change that, enter main.cpp and fill in the qpeapplication as described above in the examples. The start of the application has to be done manually, because the integrated kdevelop application starter looks in $QTDIR/lib/fonts for QPE fonts. Enter the dir project/kdev21test/emb/kdev21test, enter export QTDIR=/usr/lib/qt2e and start your qfvb. After that is done a simple ./kdev21test should launch your application.

7.2 Setup form arm

To go to arm from here is easy.

  1. Enter the menu project->options and choose compiler setup.
  2. Overwrite the Text (Standard) in the "Configuration" combo box and e.g. write arm instead. Press the Add button right of that. This will enable the build-dir field. You can chage it or let as it is. Kdevelop chooses the dir ../arm to store the result.
  3. Choose arm as the architecture to work for by selecting from the CompilerSettings tab page.
  4. Choose the tab page Flags and Warnings. Choose Wall as compiler warnings and enter $OPTIONS $EXTRA_INC_PATH into the CPPFLAGS field.
  5. Choose the tab page Linker Flags. Enter $EXTRA_LIB_PATH Additional Flags field.
  6. Choose the tab page Configure. Enter /usr/lib/qt2arm into the --with-qt-dir field, --enable-embedded --enable-qtopia into the Additional Options field.
  7. Choose the menu entry options/linker-options. Enter $(LIB_QPE) -lyourExtra additional library field, where yourExtra is an extra lib (e.g. -luvqtutil). Multiple libraries have to use the same syntax (-la, -lb, lc, ...).
    Hint : Make sure, that e.g. -lopie is not included. The opie compilation requires that extra lib. As kdevelop does not support Environment variables here, we have to add that lib manually when using opie environment.
  8. Pressing the OK-button will start the configure script. If you go there from emb, everthing should be OK, if not, you may have to distclean with standard settings.
  9. Change to arm configuration and do a make autoconf;./configure.
  10. Compile your test program now for arm use.
  11. Transfer it to your ipaq. It should run out of the box.

The additional libraries have to be cleared, if you want to go back to X11 mode. This is a kdevelop bug. Also you should start kdevelop from qtarm environment from the terminal entering

qtarm && kdevelop &

to compile for arm.

7.3 Setup form opie

To go to opie from here is easy.

  1. Enter the menu project->options and choose compiler setup.
  2. Overwrite the Text (Standard) in the "Configuration" combo box and e.g. write opie instead. Press the Add button right of that. This will enable the build-dir field. You can chage it or let as it is. Kdevelop chooses the dir ../opie to store the result.
  3. Choose arm as the architecture to work for by selecting from the CompilerSettings tab page.
  4. Choose the tab page Flags and Warnings. Choose Wall as compiler warnings and enter $OPTIONS -I$EXTRA_INC_PATH into the CPPFLAGS field.
  5. Choose the tab page Linker Flags. Enter -I$EXTRA_LIB_PATH Additional Flags field.
  6. Choose the tab page Configure. Enter /usr/lib/qt2opie into the --with-qt-dir field, --enable-embedded --enable-qtopia into the Additional Options field.
  7. Choose the menu entry options/linker-options. Enter $(LIB_QPE) -lyourExtra -lopie additional library field, where yourExtra is an extra lib (e.g. -luvqtutil). Multiple libraries have to use the same syntax (-la, -lb, lc, ...).
    Hint : Make sure, that e.g. -lopie is included. The opie compilation requires that extra lib. As kdevelop does not support Environment variables here, we have to add that lib manually when using opie environment.
  8. Pressing the OK-button will start the configure script. If you go there from emb, everthing should be OK, if not, you may have to distclean with standard settings.
  9. Change to opie configuration and do a make autoconf;./configure.
  10. Compile your test program now for arm use.
  11. Transfer it to your ipaq. It should run out of the box.

The additional libraries have to be cleared, if you want to go back to X11 mode. This is a kdevelop bug. Also you should start kdevelop from qtopie environment from the terminal entering

qtopie;kdevelop &

to compile for arm/opie.

7.4 Automated ipkg creation

This section describes the tools I prepared to create automated ipkgs out of kdevelop arm projects.

Some shell- and perlscripts copied into the admin dir of your project and adopted to you needs will allow you to create an ipkg mostly automated.

The following scriptfiles are used

Preparation

qpe_ipk_xxx.pl (xxx is either qtopia or opie) is a helpfull script to automize the ipkbuild process and all related stuff using kdevelop. Grab the download archiv scripts.tgz ( see download section), unpack it and copy the resulted content of subdir ipkg_kdev into your project directory (cd ipkg_dev;cp -r * /where/your/project/is). The result are the scripts located into the ipkg dir and the two scripts _xtrarc and _postinst in your project dir. Edit that both files to your needs.

The non project specific files require some special data structure and files.

Doit

To build the ipkg just cd to your project dir and enter the following line (assuming that the kdevelop arm build process is finished).

qtarm;ipkg/qpe_ipk.pl ipaq arm YourProjectName $PWD

This will create everything you need assuming, that ipaq is the destination dir and arm the kdevelop build dir. The result can be found in $PWD/ipaq.

The perl script of me also copies the result to my local ipk-dir, which at the moment is /home/sc1/project/scipkgs. The path to there is actually defined in the script qpe_ipk.pl ( variable is $ipk_destipk ). It also manipulates the Package file there to be able to install the ipk via ipkg install qtravel on the handheld.

WhatIsdone

This section prints the perl scripts main calls to show how it works.

        getArgs();              # get the program arguments and check whether OK
        startPrepScript();      # starts prepipk.rc with appropriate parameters
        startCpScript();        # starts cpipk.rc with appropriate parameters
        grabPrjFile();          # grabs all necessary information from the project file
        createControlFile();    # creates the ipk CONTROL file
        createPackageFile();    # creates the package file
        prepQpeApp();           # creates the QTopia desktop file
        startBuildScript();     # starts the ipk build strip buildipk.rc
        copyToDest();           # copies the result into the local ipkgs dir
                                # and manipulates the Packages file.
        

7.5 Known bugs

This chapter describes the known bugs in relation to the crosscompiling feature. The version is kdevelop 2.1beta2 (kdevelop 2.2.2).


Next Previous Contents