Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. [SOLVED] Single instance applications on N950
QtWS25 Last Chance

[SOLVED] Single instance applications on N950

Scheduled Pinned Locked Moved Mobile and Embedded
50 Posts 9 Posters 22.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • AlicemirrorA Offline
    AlicemirrorA Offline
    Alicemirror
    wrote on last edited by
    #17

    Matrixx, the fact is that the icon or none is uninfluent.

    If I put the changes manually, the icon is shown correctly in all cases. If I don't the icon is shown only in the multi-instance case.

    I think that we can consider this .desktop file problema as a minotr bug or an undocumentated detail of the packager. Nothing more than to know what should be done.

    Regardless of this question the program has the following behavior:

    • Without any change the application works starting from the main page but the icon launch the application in multi-instance.
    • With the changes to the rules file the program can be started only from the terminal or from the Qt-Creator environment. Ths means that with the single-instance correction (with of without the correction to the .desktop file) the program don't start from the graphic interface. The icon seems unreactive

    Investigating on this aspect I have another detail to add to this strange behavior:

    Compiling the application with the changes in the rules file so we expect that it runs in single-instance mode tapping on the icon with the icon nothing happens.
    But in the meantime it seems that some taks is started because trying to restart the application from the Qt-Creator (that launch a ssh call to the device) I receive the error that due to a locked file the application can't be uninstalled This happens when the application is running.

    At this point, if I stop the app as it was launched from the Qt-Creator environment the package can be uninstalled / reinstalled.

    This means that somewhere a piece of the program is running on the device. Analizing the .desktop file again you see that the command that should launch the application is the following line:
    @
    invoker --single-instance --type=d /opt/QtComplexHarmattan/bin/QtComplexHarmattan
    @

    If whe thought to what happens foucsing the attention on this aspect it seems the following:

    • When the program runs in multi-instance mode it is sure that for some reason the invoker is not called at all or is called in a manned different thant we se in the .desktop file and the application starts
    • When the program is package with the workaround the invoker is really called as we see in the line of the .desktop file and the application don't start in a visibile way for some reasons but a task is launched.

    Can be a problem of the invoker ?

    Enrico Miglino (aka Alicemirror)
    Balearic Dynamics
    Islas Baleares, Ibiza (Spain)
    www.balearicdynamics.com

    1 Reply Last reply
    0
    • AlicemirrorA Offline
      AlicemirrorA Offline
      Alicemirror
      wrote on last edited by
      #18

      SOLUTION

      The solution can be focused in a problem of the invoker command. Then remains the detail that for some reason not yet clear the icon is not shown correctly - as we expect to be precise - when the workaround is applied.

      The workaround suggested by matrixx is correct. The problem that the compilation won't work correctly when the program is package by Qt-Creator so the application runs in multi-instance mode on the device can be solved by the workaround of the double space in the rules file. See in the previous posts of this thread for details.

      Then as supposed in the previous post when all is sure is correct the application can't start from the icon. as the .desktop file is very short I have analized the only element that is related to the application launch: the invoker

      The sympthoms are the following: The desktop icon launch something but the application don't start.

      The application launch in the .desktop file is in the following line:
      @
      invoker --single-instance --type=d /opt/QtComplexHarmattan/bin/QtComplexHarmattan
      @

      As you can read in the Harmattan Meego 1.2 documentation pages the option --type=d means that the invoked application is a QtDeclarative program. But from the terminal of the device if you launch the command help $>invoker --help you can read that the parameter <d> means QtDeclarative application but the parameter <e> means any kind of application (including the QtDeclarative applications)

      Take in account that when the application runs in a multi-instance mode as a matter of fact this parameter is ignored as the --single-instance option so the application starts and run.

      At this point when the single-instance application that we suppose should run correctly but don't start tapping the corresponding icon on the device we try to launch the invoker command exactly as it appear in the .desktop file. The result is the following:
      @
      $ invoker --single-instance --type=d /opt/QtComplexHarmattan/bin/QtComplexHarmattan
      invoker: Invoking execution: '/opt/QtComplexHarmattan/bin/QtComplexHarmattan'
      Booster: Loading symbol 'main' failed: '/opt/QtComplexHarmattan/bin/QtComplexHarmattan: undefined symbol: main'
      @
      Instead if we try to launch manually the command with the <e> option we obtain the following result and the application start:
      @
      $ invoker --single-instance --type=e /opt/QtComplexHarmattan/bin/QtComplexHarmattan
      invoker: Invoking execution: '/opt/QtComplexHarmattan/bin/QtComplexHarmattan'
      Using the meego graphics system
      Successfully resolved MeeGo graphics system: /usr/lib/qt4/plugins/graphicssystems/libqmeegographicssystem.so

      Found SGX/MBX driver, enabling FullClearOnEveryFrame
      Found v1.4 driver, enabling brokenTexSubImage
      MeegoGraphics: found EGL_NOK_image_shared
      MeegoGraphics: found EGL_KHR_lock_surface2
      MeegoGraphics: found EGL_KHR_fence_sync
      hijackWindow() context created for QDeclarativeView(0xae8189d4) 1
      Found SGX/MBX driver, enabling FullClearOnEveryFrame
      Found v1.4 driver, enabling brokenTexSubImage
      QGLWindowSurface: Using plain widget as window surface QGLWindowSurface(0x1fb89b08)
      Found EGL_KHR_image_pixmap & GL_OES_EGL_image extensions (preferred method)!
      Found texture_from_pixmap EGL extension!
      Meego graphics system destroyed
      @

      Enrico Miglino (aka Alicemirror)
      Balearic Dynamics
      Islas Baleares, Ibiza (Spain)
      www.balearicdynamics.com

      1 Reply Last reply
      0
      • AlicemirrorA Offline
        AlicemirrorA Offline
        Alicemirror
        wrote on last edited by
        #19

        APPENDIX

        In the post "Someone tried to publish N9 applications?":http://developer.qt.nokia.com/forums/viewthread/8248 kkrzewniak experienced the same problem that is related to the workaround that should be done in the roles file due to the Qt-Creator packager bug.
        Respect to the Booster error matrixx suggested the following:

        bq. @kkrzewniak If you get the error Booster: Loading symbol ‘main’ failed: ‘/opt/CoolApp/bin/CoolApp undefined symbol: main’
        (read the full post in the link above)

        This is the last test that will be done to complete this solution.

        Enrico Miglino (aka Alicemirror)
        Balearic Dynamics
        Islas Baleares, Ibiza (Spain)
        www.balearicdynamics.com

        1 Reply Last reply
        0
        • AlicemirrorA Offline
          AlicemirrorA Offline
          Alicemirror
          wrote on last edited by
          #20

          BOOSTER ERROR - SOLVED
          @
          Q_DECL_EXPORT int main(int argc, char *argv[])
          @

          Declaring the main function in the main.cpp program of the application the .desktop file works fine also with the --type=d option. Remain unclear what we can do to have the icon shown correctly on the desktop.

          Enrico Miglino (aka Alicemirror)
          Balearic Dynamics
          Islas Baleares, Ibiza (Spain)
          www.balearicdynamics.com

          1 Reply Last reply
          0
          • AlicemirrorA Offline
            AlicemirrorA Offline
            Alicemirror
            wrote on last edited by
            #21

            DESKTOP ICON - SOLVED

            The problem of the lost desktop icon depends on a strange behavior, probably a bug in Qt-Creator. When the icon is selected in the project window of Qt-Creator the file is encoded and set at the bottom of the control file in the folder qtc_packaging/debian_harmattan
            Managing the packagin files for some reason - else if the icon remain the same and the file too - the value in the control file don't match resulting in the green icon on the device instead of the correct icon file.

            The workaround is simple: it is sufficient to follow the instructions of the Qt-Creator documentation explained in packaging your applications section regarding how-to change the icon file.

            Opening the project window the icon file should be reloaded and after repackaging the application the icon is shown correctly. And obviously the application runs in single-instance mode.

            Many thansk to matrixx !!! :)

            Enrico Miglino (aka Alicemirror)
            Balearic Dynamics
            Islas Baleares, Ibiza (Spain)
            www.balearicdynamics.com

            1 Reply Last reply
            0
            • M Offline
              M Offline
              matrixx
              wrote on last edited by
              #22

              I'm glad I could help. I stumbled on all of these same problems when I ported my first application on N950, so I also have to thank many of my friends who helped me with these issues, so I can now help others :)

              Nokia Certified Qt Specialist

              1 Reply Last reply
              0
              • AlicemirrorA Offline
                AlicemirrorA Offline
                Alicemirror
                wrote on last edited by
                #23

                Me too, this is the great of this tricks of Nokia :)

                Cheers

                Enrico Miglino (aka Alicemirror)
                Balearic Dynamics
                Islas Baleares, Ibiza (Spain)
                www.balearicdynamics.com

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  tomma
                  wrote on last edited by
                  #24

                  Invoker use requires that your application is relocatable, which can be done by adding @CONFIG+= declaratibe-boostable@ to .pro. This only works with harmattan-nokia-meego-api target. harmattan-platform-api target does not have requiret package installed and you have to set flags manualy eg something like:
                  @QMAKE_CXXFLAGS += -fPIC -fvisibility=hidden -fvisibility-inlines-hidden
                  QMAKE_LFLAGS += -pie -rdynamic@
                  I think the bug which removes invoker line from .desktop is caused by too smart buildsystem =)
                  You can try running your application from terminal with invoker and it should tell you why it fails.

                  edit:
                  Oh sorry there was multiple pages =) but still those two targets have some differences.

                  1 Reply Last reply
                  0
                  • AlicemirrorA Offline
                    AlicemirrorA Offline
                    Alicemirror
                    wrote on last edited by
                    #25

                    Thank you Tomma,

                    me too sometimes see too late that a thread is multipage ;)

                    At this point I have not clear what you means. The essential steps are the following:

                    Starting point

                    • The compiled/packaged applications for Qt-Meego are not single-instance
                    • Multi-instance is prohibitied
                    • This is a bug of Qt-Creator (or the SDK or both, not sure of the origin)

                    Workaround

                    • Open with a external editor the rules file in the qtc_packaging/debian_harmattan folder changing the following line
                      @
                      [TAB]$(MAKE)*[SPACE]*INSTALL_ROOT="$(CURDIR)"/debian/<application_name> install
                      @
                      to
                      @
                      [TAB]$(MAKE)[SPACE][SPACE]INSTALL_ROOT="$(CURDIR)"/debian/<application_name> install
                      @
                      as is add a second SPACE character after $(MAKE) leaving the initial TAB character
                      _This solve the problem of the multi-instance but at this point the .desktop file don'work correctly

                    • Edit in Qt-Creator the .desktop file setting the correct Icon pointer that should be
                      @
                      Icon=/usr/share/icons/hicolor/64x64/apps/<application_name>.png
                      @
                      At this point it is probable that the icon is now shown in the program. As a matter of fact the application icon (those shown on the device main page) depends from the encoded icon in the control file. To avoid this problem it is necessary to open the project section in Qt-Creator, open the run tab in the Harmattan target expanding the Create Package group. Select the icon again and confirm.

                    • The .desktop file at this point works correctly trying to launch the application using the invoker command in a line like the following:
                      @
                      Exec=invoker --single-instance --type=d /opt/<application_name>/bin/<application_name>
                      @
                      Tapping on the application icon the program don't start. Launching the invoker with the same command line from the device terminal this is the received error:
                      @
                      invoker: Invoking execution: '/opt/<application_name>/bin/<application_name>'
                      Booster: Loading symbol 'main'
                      failed: '/opt/<application_name>/bin/<application_name>:
                      undefined symbol: main'
                      @

                    • The QtDeclarative main() is not exported by default so - as explained by matrixx - it is necessary to change the main() function declaration in the main.cpp source as follows:
                      @
                      Q_DECL_EXPORT int main(int argc, char *argv[])
                      {
                      ...
                      }
                      @

                    At this point, recompiling, packaging and deploying to the device the application works fine.
                    Returning to the initial comment Tomma it is not clear how your suggestion can take place in this procedure. Please can you explain?

                    Many thanks.

                    Hopefyully this procedure may be good for other developers so I have added the how-to page in the wiki "How to create single-instance applications for N9 Harmattan Meego 1.2":http://developer.qt.nokia.com/wiki/Single_Instance_Harmattan_Applications
                    Due that it is originated by a bug I have no idea for how much time this problem will persist in the future versions/updates of the packages.

                    Enrico Miglino (aka Alicemirror)
                    Balearic Dynamics
                    Islas Baleares, Ibiza (Spain)
                    www.balearicdynamics.com

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      matrixx
                      wrote on last edited by
                      #26

                      @Alicemirror: If you are creating an application with the "Harmattan Application" template on QtCreator, you don't have to care about those lines Tomma mentioned, they are automatically added to your .pro file by QtCreator.

                      Instead, if you are porting an existing application and want to use your original .pro file, you need to add those lines manually to be able to use the single-instance invoker.

                      That might be a good addition to the wiki, if someone wants to port apps without creating a new project template and copying over existing files of the project.

                      Nokia Certified Qt Specialist

                      1 Reply Last reply
                      0
                      • AlicemirrorA Offline
                        AlicemirrorA Offline
                        Alicemirror
                        wrote on last edited by
                        #27

                        @matrixx: thank you for the precision. In effect the first application that I have created with the template had not this omission, but the problem of the export appeared only at the end of the solution of the qt-complex project ported from a first symbian version. I should add tnis to the wiki page.

                        I am also planning to write a page with the elemts that should change between a symbian and harmattan QML application using the two different imports of the new Qt Quick components for page navigation and page stack management.

                        Many thanks

                        Enrico Miglino (aka Alicemirror)
                        Balearic Dynamics
                        Islas Baleares, Ibiza (Spain)
                        www.balearicdynamics.com

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          senu188
                          wrote on last edited by
                          #28

                          Hi
                          Alicemirror I followed instrution from here -http://developer.qt.nokia.com/wiki/Single_Instance_Harmattan_Applications#57bd2611a5f660693bc0b0d96860058e
                          and changed my desktop entry as follows
                          @[Desktop Entry]
                          Encoding=UTF-8
                          Version=1.0
                          Type=Application
                          Terminal=false
                          Name=insulincal
                          Exec=Exec=invoker --single-instance --type=e /opt/insulincal/bin/insulincal
                          Icon=/usr/share/icons/hicolor/64x64/apps/insulincal.png
                          X-Window-Icon=
                          X-HildonDesk-ShowInToolbar=true
                          X-Osso-Type=application/x-executable
                          @
                          insulincal is my app name.
                          I still get multiple app launches in N950 [on remote data access - I am still waiting for my device]
                          Can you pl check what is wrong above ?Thanks

                          http://qt-apps.org/usermanager/search.php?username=senu&action=contents

                          1 Reply Last reply
                          0
                          • M Offline
                            M Offline
                            matrixx
                            wrote on last edited by
                            #29

                            @senu188
                            For some people mere recompiling fixes the issue, but at least I needed to do also this following workaround step:

                            Edit rules debian packaging file adding a space after MAKE, but remember to preserve tabs in the file, otherwise it will break.

                            Nokia Certified Qt Specialist

                            1 Reply Last reply
                            0
                            • S Offline
                              S Offline
                              senu188
                              wrote on last edited by
                              #30

                              Thanks I will try that and report if [hopefully not!] there is a problem

                              http://qt-apps.org/usermanager/search.php?username=senu&action=contents

                              1 Reply Last reply
                              0
                              • AlicemirrorA Offline
                                AlicemirrorA Offline
                                Alicemirror
                                wrote on last edited by
                                #31

                                hi senu188,

                                following the wiki page the described method includes also the suggestion of matrixx.
                                What I see in your code is that in line 7 of the post above there is the repetition of Exec= that is an error. Please try again correcting this bug and let me know if it works.

                                Cheers.

                                Enrico Miglino (aka Alicemirror)
                                Balearic Dynamics
                                Islas Baleares, Ibiza (Spain)
                                www.balearicdynamics.com

                                1 Reply Last reply
                                0
                                • M Offline
                                  M Offline
                                  matrixx
                                  wrote on last edited by
                                  #32

                                  @Alicemirror
                                  I believe someone has been modifying the wiki page, cause the "rules hack" is not there.

                                  Nokia Certified Qt Specialist

                                  1 Reply Last reply
                                  0
                                  • S Offline
                                    S Offline
                                    senu188
                                    wrote on last edited by
                                    #33

                                    [quote author="Alicemirror" date="1313055734"]hi senu188,

                                    following the wiki page the described method includes also the suggestion of matrixx.
                                    What I see in your code is that in line 7 of the post above there is the repetition of Exec= that is an error. Please try again correcting this bug and let me know if it works.

                                    Cheers.[/quote]
                                    I immediately removed one 'Exec' as mentioned in my similar post posted separately[http://developer.qt.nokia.com/forums/viewthread/8687 ]. I am now trying to change the 'rule' file but I seem to have broken the build. I am trying again. The wiki page doesn't have anything about 'rule' I guess someone edited it off. Thanks will try and report

                                    http://qt-apps.org/usermanager/search.php?username=senu&action=contents

                                    1 Reply Last reply
                                    0
                                    • AlicemirrorA Offline
                                      AlicemirrorA Offline
                                      Alicemirror
                                      wrote on last edited by
                                      #34

                                      @senu188
                                      @matrixx

                                      Mistery solved !!!

                                      Please take a look to this post: "Wiki pages edited without control":http://developer.qt.nokia.com/forums/viewthread/8699/

                                      Now the page is complete again. Please senu188, check if it works fine.

                                      Thank you.

                                      Enrico Miglino (aka Alicemirror)
                                      Balearic Dynamics
                                      Islas Baleares, Ibiza (Spain)
                                      www.balearicdynamics.com

                                      1 Reply Last reply
                                      0
                                      • S Offline
                                        S Offline
                                        senu188
                                        wrote on last edited by
                                        #35

                                        I did the following in 'insulincal.desktop' - insulincal is my app name
                                        @[Desktop Entry]
                                        Encoding=UTF-8
                                        Version=1.0
                                        Type=Application
                                        Terminal=false
                                        Name=insulincal
                                        Exec=invoker --single-instance --type=e /opt/usr/bin/insulincal
                                        Icon=/usr/share/icons/hicolor/64x64/apps/insulincal.png
                                        X-Window-Icon=
                                        X-HildonDesk-ShowInToolbar=true
                                        X-Osso-Type=application/x-executable@

                                        The deb is built but still multi-instance so

                                        I added a space after $(MAKE) in 'rules' file
                                        @
                                        $(MAKE) INSTALL_ROOT="$(CURDIR)"/debian/insulincal install

                                        I get packaging error
                                        Packaging Error: Command 'c:/qtsdk/madde/bin/mad dpkg-buildpackage -nc -uc -us' failed.Exit code: 2
                                        @
                                        I tried in 2 ways to add space-

                                        1. I just add a space using spacebar in rules file inside Qt creator
                                        2. I copy the rules file and paste it in Notepad, add a space and again paste that in Qt creator and rebuild
                                          In both cases I get error. Is there any other way to add space so build will be proper. Thanks for help

                                        http://qt-apps.org/usermanager/search.php?username=senu&action=contents

                                        1 Reply Last reply
                                        0
                                        • AlicemirrorA Offline
                                          AlicemirrorA Offline
                                          Alicemirror
                                          wrote on last edited by
                                          #36

                                          Sure you get error.

                                          The problem is just there: the rules file includes special characters i.e. tabs starting on every line and - I think - linefeeds instead of cr/lf at the end of line. The fact is that you should edit anyway this file with a binary editor else when you save it some essential character is lost.

                                          I use Mac with a binary editor, but I am sure that you can find some opensource editor in windows. Wincommander for example has a hex editor and binary editor and other files too. you can try to send me this file (those original working) and I edit it for you. When we are sure that this is the only problem, you search for an adequate program.

                                          Enrico Miglino (aka Alicemirror)
                                          Balearic Dynamics
                                          Islas Baleares, Ibiza (Spain)
                                          www.balearicdynamics.com

                                          1 Reply Last reply
                                          0

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved