Developer FAQ

(How can I package software for Maemo?: maemo packaging→packaging)
m (Enabling sudo for user installed scripts)
 
(26 intermediate revisions not shown)
Line 8: Line 8:
# If not post your question in the developer mailing list or in talk
# If not post your question in the developer mailing list or in talk
# If you find the answer and you think it could be interesting for others as well post it here, so that we just have to point on this page in the future if the question pops up again.
# If you find the answer and you think it could be interesting for others as well post it here, so that we just have to point on this page in the future if the question pops up again.
-
 
== Maemo SDK and Scratchbox ==
== Maemo SDK and Scratchbox ==
Line 34: Line 33:
Enter the following lines in the Scratchbox:
Enter the following lines in the Scratchbox:
-
  X86: ~] > eval $(dbus-launch --sh-syntax)
+
  eval $(dbus-launch --sh-syntax)
-
  X86: ~] > export DBUS_SESSION_BUS_ADDRESS
+
  export DBUS_SESSION_BUS_ADDRESS
-
  X86: ~] > export DBUS_SESSION_BUS_PID
+
  export DBUS_SESSION_BUS_PID
Then run the dbus-monitor command and it should work fine!
Then run the dbus-monitor command and it should work fine!
Line 43: Line 42:
'''Error messages'''
'''Error messages'''
-
[config/dbus] couldn't take over org.x.config: org.freedesktop.DBus.Error.AccessDenied (Connection ":1.310" is not allowed to own the service "org.x.config.display2" due to security policies in the configuration file)
+
[config/dbus] couldn't take over org.x.config: org.freedesktop.DBus.Error.AccessDenied (Connection ":1.310" is not allowed to own the service "org.x.config.display2" due to security policies in the configuration file)
'''Solution'''
'''Solution'''
Line 49: Line 48:
You need to edit the following file:
You need to edit the following file:
-
  /etc/dbus-1/system.d/xorg-server.conf
+
/etc/dbus-1/system.d/xorg-server.conf
-
Add the following three lines in the "<policy context="default"> group
+
Add the following three lines in the "<code><policy context="default"></code> group
-
  <allow own="org.x.config.display2"/>
+
<source lang="xml">
-
  <allow send_destination="org.x.config.display2"/>
+
<allow own="org.x.config.display2"/>
-
  <allow send_interface="org.x.config.display2"/>
+
<allow send_destination="org.x.config.display2"/>
 +
<allow send_interface="org.x.config.display2"/>
 +
</source>
-
Basically you should have one for each display you plan on using, by default display 0 and display 1 are in the file.   If you are planning on using a different display number for Xephyr than :2 make sure you use its number rather than "display2" when you add these lines.
+
Basically you should have one for each display you plan on using, by default display 0 and display 1 are in the file. If you are planning on using a different display number for Xephyr than :2 make sure you use its number rather than "display2" when you add these lines.
=== How can I avoid "qemu" error messages of "af-sb-init start" in ARMEL target? ===
=== How can I avoid "qemu" error messages of "af-sb-init start" in ARMEL target? ===
Line 78: Line 79:
The ARMEL target should not be used for application testing and just for cross compiling. The target is not meant to support this. Please use for any other use than cross-compiling the X86 target.
The ARMEL target should not be used for application testing and just for cross compiling. The target is not meant to support this. Please use for any other use than cross-compiling the X86 target.
-
 
-
 
-
 
=== Why do I get "command not found" even though I follow the instructions in the documentation? ===
=== Why do I get "command not found" even though I follow the instructions in the documentation? ===
-
 
'''Error messages'''
'''Error messages'''
Line 96: Line 93:
After running the installation script you have to install some closed-source packages to have a full installation of the SDK. Most likely these are not installed. Have a look [http://maemo.org/development/sdks/maemo_5_beta_2_sdk_installation/#32bitinstall here] - the last point under installation instructions - how to do that.
After running the installation script you have to install some closed-source packages to have a full installation of the SDK. Most likely these are not installed. Have a look [http://maemo.org/development/sdks/maemo_5_beta_2_sdk_installation/#32bitinstall here] - the last point under installation instructions - how to do that.
 +
=== How to resolve "Scratchbox devkit debian-etch not found" issue? ===
-
 
-
 
-
=== How to resolve "Scratchbox devkit debian-etch not found" issue? ===
 
Sometimes while running the install-script of the SDK this error occurs and produces a message like the following:
Sometimes while running the install-script of the SDK this error occurs and produces a message like the following:
-
 
'''Error messages'''
'''Error messages'''
Line 108: Line 102:
  E: Please complete scratchbox installation first.
  E: Please complete scratchbox installation first.
  E: Specify an alternative installation path using '-s PATH' option.
  E: Specify an alternative installation path using '-s PATH' option.
-
 
'''Solution'''
'''Solution'''
The problem can be resolved like this (with thanks to Frank Banul in the developer list):
The problem can be resolved like this (with thanks to Frank Banul in the developer list):
-
1) add "deb http://scratchbox.org/debian/ maemo5-sdk main" to /etc/apt/sources.list  
+
<ol>
-
+
<li>
-
2) run:
+
add <pre>deb http://scratchbox.org/debian/ maemo5-sdk main</pre> to <code>/etc/apt/sources.list</code>
-
sudo apt-get remove scratchbox-devkit-debian
+
</li>
-
sudo apt-get install scratchbox-devkit-debian
+
<li>
-
sudo apt-get remove scratchbox-devkit-perl
+
run:
-
sudo apt-get install scratchbox-devkit-perl
+
<pre>
 +
sudo apt-get remove scratchbox-devkit-debian
 +
sudo apt-get install scratchbox-devkit-debian
 +
sudo apt-get remove scratchbox-devkit-perl
 +
sudo apt-get install scratchbox-devkit-perl
 +
</pre>
 +
</li>
 +
</ol>
 +
=== Why can I reach an IP-address but no domain inside Scratchbox? ===
-
 
-
 
-
=== Why can I reach an IP-address but no domain inside Scratchbox? ===
 
In some cases this happens because of the following reasons:
In some cases this happens because of the following reasons:
# Network configuration changed on the host-system, after Scratchbox was installed
# Network configuration changed on the host-system, after Scratchbox was installed
Line 130: Line 128:
#* Manual installation of SDK was not complete
#* Manual installation of SDK was not complete
#* The target was reset
#* The target was reset
-
 
-
 
'''Error messages'''
'''Error messages'''
Depends on the program, which is used. But here a small test client in python:
Depends on the program, which is used. But here a small test client in python:
-
 
+
<source lang="python">
-
import urllib2
+
import urllib2
-
print urllib2.urlopen("http://google.com").read()
+
print urllib2.urlopen("http://google.com").read()
 +
</source>
Then the following error message will be returned:
Then the following error message will be returned:
  urllib2.URLError: <urlopen error (-3, 'Temporary failure in name resolution')>
  urllib2.URLError: <urlopen error (-3, 'Temporary failure in name resolution')>
-
 
-
 
'''Solution'''
'''Solution'''
Line 159: Line 154:
  SBOX> sb-conf in -edFL
  SBOX> sb-conf in -edFL
-
This sets the /scratchbox/etc/resolv.conf as default and ignores the one of the scratchbox. Info about the command you'll find [http://maemo.org/development/sdks/maemo_5_beta_2_sdk_installation/#manualinstall here].
+
This sets the <code>/scratchbox/etc/resolv.conf</code> as default and ignores the one of the scratchbox. Info about the command you'll find [http://maemo.org/development/sdks/maemo_5_beta_2_sdk_installation/#manualinstall here].
These steps should solve the problem. If it still does not work, you could try to replace the entries of the resolv.conf '''within''' the scratchbox with the same entries of the resolv.conf of the '''host''' system by hand.
These steps should solve the problem. If it still does not work, you could try to replace the entries of the resolv.conf '''within''' the scratchbox with the same entries of the resolv.conf of the '''host''' system by hand.
=== Script "af-sb-init.sh start" aborting ===
=== Script "af-sb-init.sh start" aborting ===
 +
Sometimes it happens, that the script aborts just after starting. A problem might be, that old processes are still active, and cause the error. Indicator that this might be the reason are the following lines after the startup:
Sometimes it happens, that the script aborts just after starting. A problem might be, that old processes are still active, and cause the error. Indicator that this might be the reason are the following lines after the startup:
Line 176: Line 172:
  ...
  ...
  aborting...
  aborting...
-
 
This shows, that old processes are still running, which might cause problems in starting up the framework again.  
This shows, that old processes are still running, which might cause problems in starting up the framework again.  
-
 
''' Solution '''
''' Solution '''
Line 185: Line 179:
To solve this stop the framework, kill all old processes and start it again. This can be done by:
To solve this stop the framework, kill all old processes and start it again. This can be done by:
-
* stop the framework:
+
# stop the framework:<pre>af-sb-init.sh stop</pre>
-
~] > af-sb-init.sh stop
+
# kill old processes:<pre>sb-conf killall</pre>
 +
# restart:<pre>af-sb-init.sh start</pre>
-
* kill old processes:
+
=== How to install the SDK+ on a Linux AMD64 platform? ===
-
~] > sb-conf killall
+
-
* restart:
 
-
~] > af-sb-init.sh start
 
-
 
-
 
-
=== How to install the SDK+ on a Linux AMD64 platform? ===
 
The Maemo SDK+ package includes scratchbox 2 and Qt, but it will only install on 32-bit platforms. If you're running Debian with a 64-bit kernel, Maemo SDK+ can be installed into a chrooted 32-bit environment that sits on top of your 64-bit platform.  
The Maemo SDK+ package includes scratchbox 2 and Qt, but it will only install on 32-bit platforms. If you're running Debian with a 64-bit kernel, Maemo SDK+ can be installed into a chrooted 32-bit environment that sits on top of your 64-bit platform.  
Line 201: Line 190:
[[Maemo_SDK%2B_installation_on_Debian_(AMD64)|This guide]] takes you through all the steps to the point of compilation and running the test.
[[Maemo_SDK%2B_installation_on_Debian_(AMD64)|This guide]] takes you through all the steps to the point of compilation and running the test.
-
 
-
 
=== QEMU error running cmake in ARMEL target in Fremantle? ===
=== QEMU error running cmake in ARMEL target in Fremantle? ===
Line 209: Line 196:
  qemu: uncaught target signal 11 (Segmentation fault) - core dumped
  qemu: uncaught target signal 11 (Segmentation fault) - core dumped
  make: *** [cmake_check_build_system] Error 126
  make: *** [cmake_check_build_system] Error 126
-
 
''' Solution '''
''' Solution '''
Check the version of cmake. Using version 2.6.3-2maemo4+0m5 should solve the problem.
Check the version of cmake. Using version 2.6.3-2maemo4+0m5 should solve the problem.
-
 
=== Git error when trying to clone/pull from https repositories ===
=== Git error when trying to clone/pull from https repositories ===
Line 234: Line 219:
== Porting to Fremantle ==
== Porting to Fremantle ==
 +
{{main|Documentation/Maemo 5 Developer Guide/Porting Software}}
-
This section is intended to consolidate the common errors that occur while trying to port Diablo applications to Fremantle. Feel free to improve this page and/or add additional information.
+
This section is intended to consolidate the common errors that occur while trying to port [[Open development/Maemo roadmap/Diablo|Diablo]] applications to [[Open development/Maemo roadmap/Fremantle|Fremantle]]. Feel free to improve this page and/or add additional information.
===maemo-select-menu-location: command not found===
===maemo-select-menu-location: command not found===
Line 246: Line 232:
  dpkg: error processing leafpad (--configure): subprocess post-installation script returned error exit  status 127
  dpkg: error processing leafpad (--configure): subprocess post-installation script returned error exit  status 127
-
'''Reason'''  
+
'''Reason'''
-
 
+
:maemo-select-menu-location is obsolete. In Fremantle, there is no submenu like, "Utility", "Extra", "Settings" etc. All installed 3rd party software will be visible under "Applications" by default.   
-
maemo-select-menu-location is obsolete.
+
-
In Fremantle, there is no submenu like, "Utility", "Extra", "Settings" etc. All installed 3rd party software will be visible under "Applications" by default.   
+
'''Action'''
'''Action'''
-
Remove the instance from the post installation script. It is not needed.
+
:Remove the instance from the post installation script. It is not needed.
 +
===Missing dependency: maemo-installer-utils===
-
===Missing dependency: maemo-installer-utils===
 
'''Reason'''
'''Reason'''
-
 
+
:The package <code>hildon-application-manager</code> no longer provides <code>maemo-installer-utils</code>. The commands <code>maemo-confirm-text</code>, <code>maemo-application-running</code>, <code>maemo-list-user-packages</code> are  still available.  
-
The package hildon-application-manager no longer "provides" ''maemo-installer-utils''. The commands ''maemo-confirm-text'', ''maemo-application-running'', ''maemo-list-user-packages'' are  still available.  
+
'''Action'''
'''Action'''
 +
:Replace the dependency with <code>hildon-application-manager</code>.
-
Replace the dependency with hildon-application-manager.
+
===Missing dependency: libhildonhelp0===
-
 
-
===Missing dependency: libhildonhelp0===
 
'''Reason'''
'''Reason'''
-
 
+
:libhildonhelp does not exist in Fremantle.
-
libhildonhelp is dropped.
+
'''Action'''
'''Action'''
 +
:Remove the dependency and calls to the help APIs.
-
Remove the dependency and calls to the help APIs.
+
===Limitation of Home Area applets===
-
 
+
Unlike Diablo, in Fremantle these applets do not support text input, pannable areas, resizing nor scrolling.
-
===Limitation of Home Area applets===
+
-
Unlike Diablo in Fremantle these applets don't support text input, pannable areas, resizing nor scrolling.
+
'''Reason'''
'''Reason'''
-
 
+
:Framework limitations.
-
Framework limitations.
+
'''Action'''
'''Action'''
 +
:Replace text input fields with dialogs. Use buttons for scrolling. Add resizing options in the settings dialog or adapt the UI of the applet regarding to that. For further information on how to develop those applets, please check the [[Documentation/Maemo_5_Developer_Guide/Application_Development/Writing_Desktop_Widgets|documentation]].
-
Replace text input fields with dialogs. Use buttons for scrolling. Add resizing options in the settings dialog or adapt the UI of the applet regarding to that. For further information on how to develop those applets, please check the [http://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide/Application_Development/Writing_Desktop_Widgets documentation].
+
===What icon size should be used?===
-
 
-
===What icon size should be used?===
 
With Fremantle the size specifications of the icons are different from Diablo:
With Fremantle the size specifications of the icons are different from Diablo:
'''Application Manager'''
'''Application Manager'''
-
* Icon size: HILDON_ICON_SIZE_FINGER.
+
* Icon size: <code>HILDON_ICON_SIZE_FINGER</code>
* In Gimp or Photoshop: 48x48 pixels
* In Gimp or Photoshop: 48x48 pixels
'''Task Launcher'''
'''Task Launcher'''
-
* Icon size: HILDON_ICON_SIZE_THUMB.
+
* Icon size: <code>HILDON_ICON_SIZE_THUMB</code>
* In Gimp or Photoshop: 64x64 pixels
* In Gimp or Photoshop: 64x64 pixels
-
 
Using icons for the task launcher, please remember to run the following in your postinst file:
Using icons for the task launcher, please remember to run the following in your postinst file:
Line 306: Line 283:
'''Problem'''
'''Problem'''
-
 
+
:The text in dialog boxes is not formatted correctly (truncated on the right size), when a icon is in place.
-
The text in dialog boxes is not formatted correctly (truncated on the right size), when a icon is in place.
+
'''Action'''
'''Action'''
-
 
+
:In general icons should not be used in dialogs in Fremantle. Remove the icon and the text will be formatted correctly.
-
In general icons should not be used in dialogs in Fremantle. Remove the icon and the text will be formatted correctly.
+
===Initialisation scripts===
===Initialisation scripts===
'''Problem'''
'''Problem'''
-
 
+
:Initialisation scripts don't work any more.
-
Initialisation scripts don't work any more.
+
'''Reason'''
'''Reason'''
-
 
+
:Fremantle has switched to using '''upstart''' for system initialisation.
-
Fremantle has switched to using '''upstart''' for system initialisation.
+
'''Action'''
'''Action'''
 +
:Create '''upstart''' job definitions instead of init scripts.  Information on writing these can be found on http://upstart.ubuntu.com/getting-started.html. However, be aware that the directory used on Maemo 5 is <code>/etc/event.d</code>.
 +
:The job script should be placed in <code>/etc/event.d/''package''</code>.  And the package postinst, prerm and postrm should use the ''start --quiet'' and ''stop --quiet'' commands to start and stop the service.  Unfortunately there is no debhelper tool to assist with this.
-
Create '''upstart''' job definitions instead of init scripts.  Information on writing these can be found on http://upstart.ubuntu.com/getting-started.html.  However, be aware that the directory used on Maemo 5 is ''/etc/event.d''.
 
-
The job script should be placed in /etc/event,d/''package''.  And the package postinst, prerm and postrm should use the ''start --quiet'' and ''stop --quiet'' commands to start and stop the service.  Unfortunately there is no debhelper tool to assist with this.
+
=== Enabling sudo for user installed scripts ===
 +
'''Problem'''
 +
:Users tend to want to edit /etc/sudoers to allow a command provided by a script they created to run with raised privileges. This is highly likely to result in a bricked device forcing you to re-flash to make it work again from scratch.
 +
 +
'''Reason'''
 +
:The <code>/etc/sudoers</code> file seems deceivingly straight forward to edit. It's not:
 +
  <code>
 +
    17:27 < MohammadAG51> listen to that advice<BR>
 +
    17:27 < MohammadAG51> don't be a smartass like I did once
 +
  </code>
 +
 +
'''Action'''
 +
:Add your specific sudo configuration to "<code>/etc/sudoers.d/*</code>" as a new file (courtuesy to the reader, you are advised to read [http://www.sudo.ws/sudo/sudoers.man.html this] to understand how to create sudoers.d/ snippets appropriate for your application or script.
 +
:Run update-sudoers and profit.
== Qt ==
== Qt ==
=== Where to find a Maemo Qt API Reference? ===
=== Where to find a Maemo Qt API Reference? ===
-
There is [[Qt4Hildon | Qt wikipage]], done by the community, where you find an [[Qt4Hildon#FREMANTLE | API reference]] besides other information.
+
There is a [[Qt4 Hildon|Qt page on the wiki]] with some useful information, and [http://qt.nokia.com/doc/qt-maemo-4.6/index.html official Qt for Maemo documentation].
 +
=== How to create "[[Documentation/Maemo_5_Developer_Guide/Human_Interface_Guidelines/Windows#Window_Views|HildonStackableWindows]]"?===
-
 
+
This is done by setting a special attribute on the window, as shown in the [http://doc.qt.nokia.com/qt-maemo-4.6/maemo5-stackedwindows.html Qt Maemo 5 stacked window example].
-
=== How to create "[[Documentation/Maemo_5_Developer_Guide/Human_Interface_Guidelines/Windows#Window_Views | HildonStackableWindows]]"?===
+
-
 
+
-
This is done by creating a [http://doc.trolltech.com/4.5/qmainwindow.html QMainWindow], with another QMainWindow as parent in the constructor.
+
-
 
+
-
'''Example'''
+
-
+
-
// created by [http://talk.maemo.org/member.php?u=25407 hopbeat]
+
-
+
-
QApplication app(argc, argv);
+
-
QMainWindow* window=new QMainWindow();
+
-
window->setCentralWidget(someWidget);
+
-
           
+
-
window->show();
+
-
+
-
QMainWindow* window2=new QMainWindow(window);
+
-
window2->show();
+
== Autobuilder ==
== Autobuilder ==
Line 358: Line 330:
=== Localization isn't working ===
=== Localization isn't working ===
-
You are probably using the followin line in configure.ac:
+
You are probably using the following line in <code>configure.ac</code>:
  localedir=`$PKG_CONFIG osso-af-settings --variable=localedir`
  localedir=`$PKG_CONFIG osso-af-settings --variable=localedir`
-
This means that you need to add osso-af-settings to your Build-Depends.
+
This means that you need to add <code>osso-af-settings</code> to your Build-Depends.
=== Package gets rejected: REJECTED: The same or newer version is already in extras-devel ===
=== Package gets rejected: REJECTED: The same or newer version is already in extras-devel ===
Line 370: Line 342:
=== Build failed: No such file or directory in log file ===
=== Build failed: No such file or directory in log file ===
-
You probably forgot to specify the correct Build-Depends in debian/control. The autobuilder starts every build with a clean SDK image. If you need any application during building which is not available in the default SDK image, you need to specify it specifically.
+
You probably forgot to specify the correct Build-Depends in <code>debian/control</code>. The autobuilder starts every build with a clean SDK image. If you need any application during building which is not available in the default SDK image, you need to specify it specifically.
You may verify that your Build-Depends field in debian/control is complete by running
You may verify that your Build-Depends field in debian/control is complete by running
Line 376: Line 348:
  dpkg-depcheck -m dpkg-buildpackage -rfakeroot -b
  dpkg-depcheck -m dpkg-buildpackage -rfakeroot -b
-
in the source tree.  (You'll need to <code>fakeroot apt-get install devscripts</code> for this to work).
+
in the source tree.  (You'll need to "<code>fakeroot apt-get install devscripts</code>" for this to work).
=== Build failed, works in my own scratchbox ===
=== Build failed, works in my own scratchbox ===
Line 386: Line 358:
=== How can I package software for Maemo? ===
=== How can I package software for Maemo? ===
-
{{main|Packaging}}
+
{{main|Documentation/Maemo 5 Developer Guide/Packaging, Deploying and Distributing}}
 +
 
 +
As Maemo is based on the Debian operating system, creating packages for Maemo borrows a lot of tools and techniques from Debian, however there are [[Packaging#Maemo-specific packaging information|some Maemo-specific differences]].
 +
 
 +
A [[Packaging|simple guide to get started]] is available.
=== How do I request upload rights for Extras ===
=== How do I request upload rights for Extras ===
Line 394: Line 370:
=== How do I enable extras, extras-testing, and extras-devel in Scratchbox ===
=== How do I enable extras, extras-testing, and extras-devel in Scratchbox ===
-
Add the following lines to /etc/apt/sources.list from within scratchbox:
+
Add the following lines to <code>/etc/apt/sources.list</code> from within scratchbox:
  deb http://repository.maemo.org/extras/ fremantle free non-free
  deb http://repository.maemo.org/extras/ fremantle free non-free
  deb-src http://repository.maemo.org/extras/ fremantle free
  deb-src http://repository.maemo.org/extras/ fremantle free

Latest revision as of 05:04, 4 June 2012

This is a list of frequently asked questions related to developing applications for the Maemo platform or working on the platform itself. This is in constant evolution, and new questions and answers are welcome.

For user topics, please see the User FAQ.

Contents

[edit] What can I do if my question is not mentioned here?

  1. Look if it is discussed already in one of the mailing lists or in talk.maemo.org
  2. If not post your question in the developer mailing list or in talk
  3. If you find the answer and you think it could be interesting for others as well post it here, so that we just have to point on this page in the future if the question pops up again.

[edit] Maemo SDK and Scratchbox

[edit] "dbus-monitor" does not work in Scratchbox. What can I do?

Error messages

Typical error messages in this case are:

X86: ~] > dbus-monitor --system
Failed to open connection to system message bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory

or for the session bus:

X86: ~] > dbus-monitor          
Failed to open connection to session message bus: (null)

or when starting a python app:

arguments to dbus_connection_get_data() were incorrect, assertion "connection != NULL" failed in file dbus-connection.c
GLIB ERROR ** default - Not enough memory to set up DBusConnection for use with GLib

Solution

  • Tested in Fremantle Beta, Beta_2

Enter the following lines in the Scratchbox:

eval $(dbus-launch --sh-syntax)
export DBUS_SESSION_BUS_ADDRESS
export DBUS_SESSION_BUS_PID

Then run the dbus-monitor command and it should work fine!

[edit] "xephyr" fails to start in the host with a dbus security error

Error messages

[config/dbus] couldn't take over org.x.config: org.freedesktop.DBus.Error.AccessDenied (Connection ":1.310" is not allowed to own the service "org.x.config.display2" due to security policies in the configuration file)

Solution The display you plan on using for Xephyr (typically :2) just needs to be added to the dbus security file.

You need to edit the following file:

/etc/dbus-1/system.d/xorg-server.conf

Add the following three lines in the "<policy context="default"> group

<allow own="org.x.config.display2"/>
<allow send_destination="org.x.config.display2"/>
<allow send_interface="org.x.config.display2"/>

Basically you should have one for each display you plan on using, by default display 0 and display 1 are in the file. If you are planning on using a different display number for Xephyr than :2 make sure you use its number rather than "display2" when you add these lines.

[edit] How can I avoid "qemu" error messages of "af-sb-init start" in ARMEL target?

Error messages

Usually the attempt ends up with something like this:

The error was 'BadWindow (invalid Window parameter)'.
(Details: serial 207 error_code 3 request_code 2 minor_code 0)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the --sync command line
option to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)
aborting...
qemu: uncaught target signal 6 (Aborted) - core dumped

Solution

  • all SDK's

The ARMEL target should not be used for application testing and just for cross compiling. The target is not meant to support this. Please use for any other use than cross-compiling the X86 target.

[edit] Why do I get "command not found" even though I follow the instructions in the documentation?

Error messages

As an example:

X86: ~] > af-sb-init.sh start
bash: af-sb-init.sh: command not found


Solution After running the installation script you have to install some closed-source packages to have a full installation of the SDK. Most likely these are not installed. Have a look here - the last point under installation instructions - how to do that.

[edit] How to resolve "Scratchbox devkit debian-etch not found" issue?

Sometimes while running the install-script of the SDK this error occurs and produces a message like the following:

Error messages

E: Scratchbox devkit debian-etch not found.
E: Please complete scratchbox installation first.
E: Specify an alternative installation path using '-s PATH' option.

Solution The problem can be resolved like this (with thanks to Frank Banul in the developer list):

  1. add
    deb http://scratchbox.org/debian/ maemo5-sdk main
    to /etc/apt/sources.list
  2. run:
    sudo apt-get remove scratchbox-devkit-debian
    sudo apt-get install scratchbox-devkit-debian
    sudo apt-get remove scratchbox-devkit-perl
    sudo apt-get install scratchbox-devkit-perl
    

[edit] Why can I reach an IP-address but no domain inside Scratchbox?

In some cases this happens because of the following reasons:

  1. Network configuration changed on the host-system, after Scratchbox was installed
  2. Scratchbox not configured correctly:
    • Manual installation of SDK was not complete
    • The target was reset

Error messages Depends on the program, which is used. But here a small test client in python:

import urllib2
print urllib2.urlopen("http://google.com").read()

Then the following error message will be returned:

urllib2.URLError: <urlopen error (-3, 'Temporary failure in name resolution')>

Solution

  • Fremantle X86(!), Diablo X86(!)

In any cases it is most likely that the resolv.conf of the Scratchbox is not set up correctly. The following solutions for this issue can solve the problem:

  1. Network configuration change: Copy the resolv.conf from the host system into the scratchbox/etc folder:
sudo cp /etc/resolv.conf /scratchbox/etc/resolv.conf

If the problem is still the same try 2.:

  1. Scratchbox configuration: This might be the case, if the target was reset or manual installed, without using the script. In this case run:
SBOX> sb-conf in -edFL

This sets the /scratchbox/etc/resolv.conf as default and ignores the one of the scratchbox. Info about the command you'll find here.

These steps should solve the problem. If it still does not work, you could try to replace the entries of the resolv.conf within the scratchbox with the same entries of the resolv.conf of the host system by hand.

[edit] Script "af-sb-init.sh start" aborting

Sometimes it happens, that the script aborts just after starting. A problem might be, that old processes are still active, and cause the error. Indicator that this might be the reason are the following lines after the startup:

Indicator

_X86: ~] > af-sb-init.sh start
...
DBUS system bus is already running, doing nothing
D-BUS session bus daemon is already running, doing nothing
Starting Maemo Launcher: maemo-launcher start failed.
Sapwood image server is already running, doing nothing
...
aborting...

This shows, that old processes are still running, which might cause problems in starting up the framework again.

Solution

To solve this stop the framework, kill all old processes and start it again. This can be done by:

  1. stop the framework:
    af-sb-init.sh stop
  2. kill old processes:
    sb-conf killall
  3. restart:
    af-sb-init.sh start

[edit] How to install the SDK+ on a Linux AMD64 platform?

The Maemo SDK+ package includes scratchbox 2 and Qt, but it will only install on 32-bit platforms. If you're running Debian with a 64-bit kernel, Maemo SDK+ can be installed into a chrooted 32-bit environment that sits on top of your 64-bit platform.

Solution

This guide takes you through all the steps to the point of compilation and running the test.

[edit] QEMU error running cmake in ARMEL target in Fremantle?

Indicator

qemu: uncaught target signal 11 (Segmentation fault) - core dumped
make: *** [cmake_check_build_system] Error 126

Solution Check the version of cmake. Using version 2.6.3-2maemo4+0m5 should solve the problem.

[edit] Git error when trying to clone/pull from https repositories

Indicator

 error: error setting certificate verify locations:
   CAfile: /usr/share/curl/curl-ca-bundle.crt
   CApath: none
 
 warning: remote HEAD refers to nonexistent ref, unable to checkout.

Solution

Place the CA bundle where curl can find it:

 ~] > mkdir /usr/share/curl
 ~] > ln -s /scratchbox/devkits/git/share/curl/curl-ca-bundle.crt /usr/share/curl/

See also bug 4953.

[edit] Porting to Fremantle

Main article: Documentation/Maemo 5 Developer Guide/Porting Software


This section is intended to consolidate the common errors that occur while trying to port Diablo applications to Fremantle. Feel free to improve this page and/or add additional information.

[edit] maemo-select-menu-location: command not found

Typical error message

scratchbox/tools/bin/sh: line 1: /usr/sbin/dpkg-preconfigure: No such file or directory
Setting up leafpad (0.8.16le-0maemo2) ...
gtk-update-icon-cache: Cache file created successfully.
/var/lib/dpkg/info/leafpad.postinst: line 7: maemo-select-menu-location: command not found
dpkg: error processing leafpad (--configure): subprocess post-installation script returned error exit  status 127

Reason

maemo-select-menu-location is obsolete. In Fremantle, there is no submenu like, "Utility", "Extra", "Settings" etc. All installed 3rd party software will be visible under "Applications" by default.

Action

Remove the instance from the post installation script. It is not needed.

[edit] Missing dependency: maemo-installer-utils

Reason

The package hildon-application-manager no longer provides maemo-installer-utils. The commands maemo-confirm-text, maemo-application-running, maemo-list-user-packages are still available.

Action

Replace the dependency with hildon-application-manager.

[edit] Missing dependency: libhildonhelp0

Reason

libhildonhelp does not exist in Fremantle.

Action

Remove the dependency and calls to the help APIs.

[edit] Limitation of Home Area applets

Unlike Diablo, in Fremantle these applets do not support text input, pannable areas, resizing nor scrolling.

Reason

Framework limitations.

Action

Replace text input fields with dialogs. Use buttons for scrolling. Add resizing options in the settings dialog or adapt the UI of the applet regarding to that. For further information on how to develop those applets, please check the documentation.

[edit] What icon size should be used?

With Fremantle the size specifications of the icons are different from Diablo:

Application Manager

  • Icon size: HILDON_ICON_SIZE_FINGER
  • In Gimp or Photoshop: 48x48 pixels

Task Launcher

  • Icon size: HILDON_ICON_SIZE_THUMB
  • In Gimp or Photoshop: 64x64 pixels

Using icons for the task launcher, please remember to run the following in your postinst file:

gtk-update-icon-cache -f /usr/share/icons/hicolor

[edit] Text and icons in dialogs

Problem

The text in dialog boxes is not formatted correctly (truncated on the right size), when a icon is in place.

Action

In general icons should not be used in dialogs in Fremantle. Remove the icon and the text will be formatted correctly.

[edit] Initialisation scripts

Problem

Initialisation scripts don't work any more.

Reason

Fremantle has switched to using upstart for system initialisation.

Action

Create upstart job definitions instead of init scripts. Information on writing these can be found on http://upstart.ubuntu.com/getting-started.html. However, be aware that the directory used on Maemo 5 is /etc/event.d.
The job script should be placed in /etc/event.d/package. And the package postinst, prerm and postrm should use the start --quiet and stop --quiet commands to start and stop the service. Unfortunately there is no debhelper tool to assist with this.


[edit] Enabling sudo for user installed scripts

Problem

Users tend to want to edit /etc/sudoers to allow a command provided by a script they created to run with raised privileges. This is highly likely to result in a bricked device forcing you to re-flash to make it work again from scratch.

Reason

The /etc/sudoers file seems deceivingly straight forward to edit. It's not:
  
   17:27 < MohammadAG51> listen to that advice
17:27 < MohammadAG51> don't be a smartass like I did once

Action

Add your specific sudo configuration to "/etc/sudoers.d/*" as a new file (courtuesy to the reader, you are advised to read this to understand how to create sudoers.d/ snippets appropriate for your application or script.
Run update-sudoers and profit.

[edit] Qt

[edit] Where to find a Maemo Qt API Reference?

There is a Qt page on the wiki with some useful information, and official Qt for Maemo documentation.

[edit] How to create "HildonStackableWindows"?

This is done by setting a special attribute on the window, as shown in the Qt Maemo 5 stacked window example.

[edit] Autobuilder

[edit] Localization isn't working

You are probably using the following line in configure.ac:

localedir=`$PKG_CONFIG osso-af-settings --variable=localedir`

This means that you need to add osso-af-settings to your Build-Depends.

[edit] Package gets rejected: REJECTED: The same or newer version is already in extras-devel

You can't upload the same version to the repository twice. If you have changed anything in your package, you should increase your version number or package revision.

[edit] Build failed: No such file or directory in log file

You probably forgot to specify the correct Build-Depends in debian/control. The autobuilder starts every build with a clean SDK image. If you need any application during building which is not available in the default SDK image, you need to specify it specifically.

You may verify that your Build-Depends field in debian/control is complete by running

dpkg-depcheck -m dpkg-buildpackage -rfakeroot -b

in the source tree. (You'll need to "fakeroot apt-get install devscripts" for this to work).

[edit] Build failed, works in my own scratchbox

See the answer above.

[edit] Extras

[edit] How can I package software for Maemo?

Main article: Documentation/Maemo 5 Developer Guide/Packaging, Deploying and Distributing


As Maemo is based on the Debian operating system, creating packages for Maemo borrows a lot of tools and techniques from Debian, however there are some Maemo-specific differences.

A simple guide to get started is available.

[edit] How do I request upload rights for Extras

You can request an invitation via the Extras Assistant.

[edit] How do I enable extras, extras-testing, and extras-devel in Scratchbox

Add the following lines to /etc/apt/sources.list from within scratchbox:

deb http://repository.maemo.org/extras/ fremantle free non-free
deb-src http://repository.maemo.org/extras/ fremantle free

deb http://repository.maemo.org/extras-testing/ fremantle free non-free
deb-src http://repository.maemo.org/extras-testing/ fremantle free

deb http://repository.maemo.org/extras-devel/ fremantle free non-free
deb-src http://repository.maemo.org/extras-devel/ fremantle free


Then run the following commands from within scratchbox:

cd /tmp
wget http://repository.maemo.org/extras-devel/dists/fremantle/fremantle-extras-pubkey.asc
apt-key add fremantle-extras-pubkey.asc
apt-get update
apt-get update

Yes, running apt-get update twice is sometimes needed.

If you get errors where apt cannot find the keyring, then the above commands should fix that.