Development with Eclipse
From Openmoko
GreyCardinal (Talk | contribs) |
(→On the 8 of november it seems that its not working) |
||
(28 intermediate revisions by 7 users not shown) | |||
Line 2: | Line 2: | ||
A graphical Openmoko application is a gnome-based X application. Hence it is usually easy to build, run and debug it as program for the desktop computer, uploading to the mobile phone only for the final stage of debugging. Even from the mobile phone, it is possible execute the program on the phone and still use the screen, mouse and keyboard of the desktop computer to observe its work. This article describes instructions for Debian, but they will likely work with any non broken Linux distribution. | A graphical Openmoko application is a gnome-based X application. Hence it is usually easy to build, run and debug it as program for the desktop computer, uploading to the mobile phone only for the final stage of debugging. Even from the mobile phone, it is possible execute the program on the phone and still use the screen, mouse and keyboard of the desktop computer to observe its work. This article describes instructions for Debian, but they will likely work with any non broken Linux distribution. | ||
− | Eclipse recently has the C/C++ development plug-in. You will need the recent Eclipse, this plug-in and you may need to upgrade the GTK development packages. The easiest way to get the simple application running is to create the managed C project and add `pkg-config --cflags --libs gtk+-2.0` both to the compiler options and to linker flags. After that, go to [http://library.gnome.org/devel/gtk-tutorial/stable/ GTK tutorial] and try, using it, to compose a simple application. | + | Eclipse recently has the C/C++ development plug-in. You will need the recent Eclipse, this plug-in and you may need to upgrade the GTK development packages. The easiest way to get the simple application running is to create the managed C project and add `pkg-config --cflags --libs gtk+-2.0` both to the compiler options and to linker flags. After that, go to [http://library.gnome.org/devel/gtk-tutorial/stable/ GTK tutorial] and try, using it, to compose a simple application. |
− | This approach not only shortens development cycle from minutes to seconds, but also allows to use the Eclipse debugger for C development, stepping through the code and watching variables. | + | This approach not only shortens development cycle from minutes to seconds, but also allows to use the Eclipse debugger for C development, stepping through the code and watching variables. |
− | The executable for the mobile phone can usually be produced from the same source files using the Openmoko toolchain. As all surroundings of these files for Eclipse and Openmoko project are not the same, the most straightforward approach is just to set two development environments and put the symbolic links of the source files into the Openmoko project directory. | + | The executable for the mobile phone can usually be produced from the same source files using the Openmoko toolchain. As all surroundings of these files for Eclipse and Openmoko project are not the same, the most straightforward approach is just to set two development environments and put the symbolic links of the source files into the Openmoko project directory. |
After producing the Openmoko executable, it may be reasonable to try it via X, using the keyboard, mouse and screen of the desktop computer. All you need is to use the -X option in the ssh command when you log in into the connected mobile phone. After that, you should be able to run the application inside the phone but have its X window on a screen of the desktop machine. This way you can check the actual execution speed and have access to the mobile phone devices that are not present on PC. | After producing the Openmoko executable, it may be reasonable to try it via X, using the keyboard, mouse and screen of the desktop computer. All you need is to use the -X option in the ssh command when you log in into the connected mobile phone. After that, you should be able to run the application inside the phone but have its X window on a screen of the desktop machine. This way you can check the actual execution speed and have access to the mobile phone devices that are not present on PC. | ||
Line 12: | Line 12: | ||
Eclipse allows to add the custom builder to the project. These builders can be either Ant scripts or the executable shell scripts. These possibilities can be used to force the Openmoko toolchain to produce the phone executable without leaving the Eclipse IDE. | Eclipse allows to add the custom builder to the project. These builders can be either Ant scripts or the executable shell scripts. These possibilities can be used to force the Openmoko toolchain to produce the phone executable without leaving the Eclipse IDE. | ||
− | == Set up Freerunner build Config == | + | == Set up Freerunner build Config == |
# install [[Toolchain]] | # install [[Toolchain]] | ||
Line 23: | Line 23: | ||
# click Ok and select 'Freerunner' in 'Active Build Configuration' for your Project | # click Ok and select 'Freerunner' in 'Active Build Configuration' for your Project | ||
− | |||
− | + | ---- | |
+ | Notes about Eclipse Ganymed (3.4) | ||
− | + | There are three places where you have to change settings as above in Project Properties -> C/C++ Build -> Settings -> Tool Settings | |
+ | #GCC C Compiler -> Command: /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/gcc | ||
+ | #GCC C Linker -> Command: /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/gcc | ||
+ | #GCC Assembler -> Command: /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/gcc||g++||as | ||
− | + | --[[User:Perty|Perty]] 20:22, 18 September 2008 (UTC) | |
− | + | ---- | |
+ | |||
+ | |||
+ | You can copy your binary to Freerunner by adding Post-Build command in 'Build Steps' eg. | ||
+ | |||
+ | scp ${project_name} root@neo:/home/root/dev_app/ | ||
+ | |||
+ | or you can Run you application on Freerunner by adding Run configuration | ||
+ | |||
+ | ---- | ||
+ | |||
+ | C/C++ Application: /usr/bin/ssh | ||
+ | Arguments: root@neo "cd dev_app && DISPLAY=:0 ./${project_name}" | ||
--[[User:PipBoy2000|PipBoy2000]] 22:30, 9 September 2008 (UTC) | --[[User:PipBoy2000|PipBoy2000]] 22:30, 9 September 2008 (UTC) | ||
+ | |||
+ | ==Set up Eclipse for development with Qt4== | ||
+ | |||
+ | === On the 8 of November it seems that its not working === | ||
+ | |||
+ | This method has been tried on various distributions and it didn't worked, if you get it working please tell how you've done it and remove this message ... | ||
+ | If you have others method to cross compile for the 2008.x in Qt4/c++ let us know ! | ||
+ | |||
+ | I realized this with Xubuntu Hardy in an VirtualBox and using it to compile binaries for [[FSO]] and now [[SHR]]. | ||
+ | |||
+ | So it's possible to upload it somewhere for everyone. Do somebody know where?? | ||
+ | Havn't tried to compile ipk-packages with this method, just binaries. | ||
+ | What exactly didn't work? If somebody has questions just ask on the Community Mailing list, I'll try to help. | ||
+ | |||
+ | yes, it should be great if you share you virtual machine ... we have to find a place ! | ||
+ | I'm now developing under [[debian]] (who has every development libraries ), waiting a way to compile for [[FSO]] | ||
+ | |||
+ | ===Set up Environment with Libraries=== | ||
+ | |||
+ | *install [[Toolchain]] | ||
+ | |||
+ | *install Eclipse with C/C++ development plug-in | ||
+ | |||
+ | *add the Anstrom Repository to the '''Host'''-toolchain and also to the '''FreeRunner''' | ||
+ | **add Anstrom Repository to '''Host'''-toolchain: | ||
+ | <pre>echo arch base 50 >> /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/etc/opkg.conf | ||
+ | echo src/gz base http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base >> /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/etc/opkg.conf</pre> | ||
+ | then.. | ||
+ | <pre>opkg-target update | ||
+ | opkg-target install libgcc1 libglib-2.0-0 libgmodule-2.0-0 libgobject-2.0-0 libgthread-2.0-0 libpng12-0 libqt3support4 libqtassistantclient4 libqtclucene4 libqtcore4 libqtdbus4 libqtdesigner4 libqtdesignercomponents4 libqtgui4 libqthelp4 libqtnetwork4 libqtscript4 libqtsql4 libqtsvg4 libqttest4 libqtxml4 libstdc++6 qt4-assistant qt4-common qt4-dbus qt4-demos qt4-designer qt4-fonts qt4-linguist qt4-pixeltool</pre> | ||
+ | |||
+ | opkg-target install qt4-x11-free-dev qt4-designer qt4-assistant // doesn't work there are some depency problems with x11-free packages so all the libs must be installed seperately (next line) | ||
+ | |||
+ | <pre>opkg-target install libqt3support-dev libqtassistantclient-dev libqtclucene-dev libqtcore-dev libqtdbus-dev libqtdesigner-dev libqtdesignercomponents-dev libqtgui-dev libqthelp-dev libqtnetwork-dev libqtscript-dev libqtsql-dev libqtsvg-dev libqttest-dev libqtuitools4-dev libqtxml-dev libglib-2.0-dev</pre> | ||
+ | :*Add Qtlibs also to the '''FreeRunner''' : | ||
+ | <pre>opkg update | ||
+ | opkg -force-depends install http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqtgui4_4.4.3-r4.1_armv4t.ipk | ||
+ | opkg -force-depends install http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqtcore4_4.4.3-r4.1_armv4t.ipk | ||
+ | opkg -force-depends install http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqtdbus4_4.4.3-r4.1_armv4t.ipk | ||
+ | opkg -force-depends install http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqtxml4_4.4.3-r4.1_armv4t.ipk</pre> | ||
+ | |||
+ | ===Configure Eclipse Project=== | ||
+ | Project - right click - Properties --> C/C++ Build -- Tab "Tool Settings" | ||
+ | |||
+ | ====Configuration: Debug==== | ||
+ | |||
+ | *GCC c++ compiler -> Directories --- add | ||
+ | /usr/include/qt4 | ||
+ | /usr/include/qt4/QtGui | ||
+ | /usr/include/qt4/QtDBus | ||
+ | /usr/include/qt4/QtCore | ||
+ | |||
+ | *GCC C++ Linker -> Libraries ---add | ||
+ | **Libraries (-l): | ||
+ | QtCore | ||
+ | QtGui | ||
+ | QtDBus | ||
+ | **Library search path (-L): | ||
+ | /usr/lib | ||
+ | ** On Gentoo: /usr/lib/qt4 | ||
+ | |||
+ | ====Configuration: Freerunner==== | ||
+ | |||
+ | Project - right click - Properties --> C/C++ Build -- Tab "Tool Settings" | ||
+ | |||
+ | create Configuration "Freerunner": | ||
+ | click on 'Configuration'->'Manage' and create new configuration eg. Freerunner (copy settings from 'Relase' configuration) | ||
+ | |||
+ | *GCC C++ Compiler | ||
+ | **Command: /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/g++ | ||
+ | *GCC C++ Compiler -> Directories | ||
+ | <pre>/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/include/qt4/QtCore | ||
+ | /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/include/qt4/QtGui | ||
+ | /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/include/qt4/QtDBus | ||
+ | /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/include/qt4 | ||
+ | /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/include/c++/4.1.2/arm-angstrom-linux-gnueabi | ||
+ | /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/include/c++/4.1.2 | ||
+ | /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/include/c++/4.1.2/backward</pre> | ||
+ | |||
+ | *GCC C++ Linker | ||
+ | **Command: /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/g++ | ||
+ | |||
+ | *GCC C++ Linker -> Libraries --- add | ||
+ | **Libraries (-l): | ||
+ | <pre>QtCore | ||
+ | QtGui | ||
+ | QtDBus</pre> | ||
+ | **Library search path (-L): | ||
+ | /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/lib | ||
+ | |||
+ | * GCC Assembler | ||
+ | **Command: /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/as | ||
+ | |||
+ | go to Tab 'Build Steps' and add ". /usr/local/openmoko/arm/setup-env" to 'Pre-build step' | ||
+ | |||
+ | ====workaround to deal with .ui files from Qt-Designer==== | ||
+ | |||
+ | mayby somody has a better solution please correct!! | ||
+ | |||
+ | Create a project with properties as mentioned above. | ||
+ | To Compile your project create a bash-file in your Project-Folder (sed commands are necessary if you're using QtDbus libraries): | ||
+ | |||
+ | #!/bin/bash | ||
+ | make clean | ||
+ | rm Makefile.sed* | ||
+ | qmake-qt4 -project | ||
+ | qmake-qt4 | ||
+ | sed 's/INCPATH =/INCPATH = -I\/usr\/include\/qt4\/QtDBus/g' Makefile > Makefile.sed1 | ||
+ | sed 's/LIBS = $(SUBLIBS)/LIBS = $(SUBLIBS) -lQtDBus/g' Makefile.sed1 > Makefile.sed2 | ||
+ | cp Makefile.sed2 Makefile | ||
+ | make | ||
+ | |||
+ | Run it...then compile your project with Eclipse Configuration "Freerunner" | ||
[[Category:Application Developer]] | [[Category:Application Developer]] | ||
− |
Latest revision as of 13:07, 16 November 2009
![]() |
Languages: |
English • العربية • Български • Česky • Dansk • Deutsch • Esperanto • Eesti • Español • فارسی • Suomi • Français • עברית • Magyar • Italiano • 한국어 • Nederlands • Norsk (bokmål) • Polski • Português • Română • Русский • Svenska • Slovenčina • Українська • 中文(中国大陆) • 中文(台灣) • Euskara • Català |
A graphical Openmoko application is a gnome-based X application. Hence it is usually easy to build, run and debug it as program for the desktop computer, uploading to the mobile phone only for the final stage of debugging. Even from the mobile phone, it is possible execute the program on the phone and still use the screen, mouse and keyboard of the desktop computer to observe its work. This article describes instructions for Debian, but they will likely work with any non broken Linux distribution.
Eclipse recently has the C/C++ development plug-in. You will need the recent Eclipse, this plug-in and you may need to upgrade the GTK development packages. The easiest way to get the simple application running is to create the managed C project and add `pkg-config --cflags --libs gtk+-2.0` both to the compiler options and to linker flags. After that, go to GTK tutorial and try, using it, to compose a simple application.
This approach not only shortens development cycle from minutes to seconds, but also allows to use the Eclipse debugger for C development, stepping through the code and watching variables.
The executable for the mobile phone can usually be produced from the same source files using the Openmoko toolchain. As all surroundings of these files for Eclipse and Openmoko project are not the same, the most straightforward approach is just to set two development environments and put the symbolic links of the source files into the Openmoko project directory.
After producing the Openmoko executable, it may be reasonable to try it via X, using the keyboard, mouse and screen of the desktop computer. All you need is to use the -X option in the ssh command when you log in into the connected mobile phone. After that, you should be able to run the application inside the phone but have its X window on a screen of the desktop machine. This way you can check the actual execution speed and have access to the mobile phone devices that are not present on PC.
Eclipse allows to add the custom builder to the project. These builders can be either Ant scripts or the executable shell scripts. These possibilities can be used to force the Openmoko toolchain to produce the phone executable without leaving the Eclipse IDE.
Contents |
[edit] Set up Freerunner build Config
- install Toolchain
- open 'Properties' for your C or C++ Project
- select 'C/C++ Build'->'Tool Settings'
- click on 'Configuration'->'Manage' and create new configuration eg. Freerunner (copy settings from 'Relase' configuration)
- change GCC C||C++||Assembler Compiler command to /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/gcc||g++||as
- change GCC Linker Command to /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/gcc (g++ for C++ project)
- go to 'Build Steps' and add ". /usr/local/openmoko/arm/setup-env" to 'Pre-build step'
- click Ok and select 'Freerunner' in 'Active Build Configuration' for your Project
Notes about Eclipse Ganymed (3.4)
There are three places where you have to change settings as above in Project Properties -> C/C++ Build -> Settings -> Tool Settings
- GCC C Compiler -> Command: /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/gcc
- GCC C Linker -> Command: /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/gcc
- GCC Assembler -> Command: /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/gcc||g++||as
--Perty 20:22, 18 September 2008 (UTC)
You can copy your binary to Freerunner by adding Post-Build command in 'Build Steps' eg.
scp ${project_name} root@neo:/home/root/dev_app/
or you can Run you application on Freerunner by adding Run configuration
C/C++ Application: /usr/bin/ssh Arguments: root@neo "cd dev_app && DISPLAY=:0 ./${project_name}"
--PipBoy2000 22:30, 9 September 2008 (UTC)
[edit] Set up Eclipse for development with Qt4
[edit] On the 8 of November it seems that its not working
This method has been tried on various distributions and it didn't worked, if you get it working please tell how you've done it and remove this message ... If you have others method to cross compile for the 2008.x in Qt4/c++ let us know !
I realized this with Xubuntu Hardy in an VirtualBox and using it to compile binaries for FSO and now SHR.
So it's possible to upload it somewhere for everyone. Do somebody know where?? Havn't tried to compile ipk-packages with this method, just binaries. What exactly didn't work? If somebody has questions just ask on the Community Mailing list, I'll try to help.
yes, it should be great if you share you virtual machine ... we have to find a place ! I'm now developing under debian (who has every development libraries ), waiting a way to compile for FSO
[edit] Set up Environment with Libraries
- install Toolchain
- install Eclipse with C/C++ development plug-in
- add the Anstrom Repository to the Host-toolchain and also to the FreeRunner
- add Anstrom Repository to Host-toolchain:
echo arch base 50 >> /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/etc/opkg.conf echo src/gz base http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base >> /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/etc/opkg.conf
then..
opkg-target update opkg-target install libgcc1 libglib-2.0-0 libgmodule-2.0-0 libgobject-2.0-0 libgthread-2.0-0 libpng12-0 libqt3support4 libqtassistantclient4 libqtclucene4 libqtcore4 libqtdbus4 libqtdesigner4 libqtdesignercomponents4 libqtgui4 libqthelp4 libqtnetwork4 libqtscript4 libqtsql4 libqtsvg4 libqttest4 libqtxml4 libstdc++6 qt4-assistant qt4-common qt4-dbus qt4-demos qt4-designer qt4-fonts qt4-linguist qt4-pixeltool
opkg-target install qt4-x11-free-dev qt4-designer qt4-assistant // doesn't work there are some depency problems with x11-free packages so all the libs must be installed seperately (next line)
opkg-target install libqt3support-dev libqtassistantclient-dev libqtclucene-dev libqtcore-dev libqtdbus-dev libqtdesigner-dev libqtdesignercomponents-dev libqtgui-dev libqthelp-dev libqtnetwork-dev libqtscript-dev libqtsql-dev libqtsvg-dev libqttest-dev libqtuitools4-dev libqtxml-dev libglib-2.0-dev
- Add Qtlibs also to the FreeRunner :
opkg update opkg -force-depends install http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqtgui4_4.4.3-r4.1_armv4t.ipk opkg -force-depends install http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqtcore4_4.4.3-r4.1_armv4t.ipk opkg -force-depends install http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqtdbus4_4.4.3-r4.1_armv4t.ipk opkg -force-depends install http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqtxml4_4.4.3-r4.1_armv4t.ipk
[edit] Configure Eclipse Project
Project - right click - Properties --> C/C++ Build -- Tab "Tool Settings"
[edit] Configuration: Debug
- GCC c++ compiler -> Directories --- add
/usr/include/qt4 /usr/include/qt4/QtGui /usr/include/qt4/QtDBus /usr/include/qt4/QtCore
- GCC C++ Linker -> Libraries ---add
- Libraries (-l):
QtCore QtGui QtDBus
- Library search path (-L):
/usr/lib
- On Gentoo: /usr/lib/qt4
[edit] Configuration: Freerunner
Project - right click - Properties --> C/C++ Build -- Tab "Tool Settings"
create Configuration "Freerunner": click on 'Configuration'->'Manage' and create new configuration eg. Freerunner (copy settings from 'Relase' configuration)
- GCC C++ Compiler
- Command: /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/g++
- GCC C++ Compiler -> Directories
/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/include/qt4/QtCore /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/include/qt4/QtGui /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/include/qt4/QtDBus /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/include/qt4 /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/include/c++/4.1.2/arm-angstrom-linux-gnueabi /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/include/c++/4.1.2 /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/include/c++/4.1.2/backward
- GCC C++ Linker
- Command: /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/g++
- GCC C++ Linker -> Libraries --- add
- Libraries (-l):
QtCore QtGui QtDBus
- Library search path (-L):
/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/lib
- GCC Assembler
- Command: /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/as
go to Tab 'Build Steps' and add ". /usr/local/openmoko/arm/setup-env" to 'Pre-build step'
[edit] workaround to deal with .ui files from Qt-Designer
mayby somody has a better solution please correct!!
Create a project with properties as mentioned above. To Compile your project create a bash-file in your Project-Folder (sed commands are necessary if you're using QtDbus libraries):
#!/bin/bash make clean rm Makefile.sed* qmake-qt4 -project qmake-qt4 sed 's/INCPATH =/INCPATH = -I\/usr\/include\/qt4\/QtDBus/g' Makefile > Makefile.sed1 sed 's/LIBS = $(SUBLIBS)/LIBS = $(SUBLIBS) -lQtDBus/g' Makefile.sed1 > Makefile.sed2 cp Makefile.sed2 Makefile make
Run it...then compile your project with Eclipse Configuration "Freerunner"