Subject: Running Mir apps on latest Snappy

From: Darren Landoll <[email-masked]>
Date: Mon, 12 Oct 2015 09:51:41 -0400

I posted this message on a different list, but after tracking down the
exception in the Mir code, it may apply more here.

I am building the amd64 oem and mir snaps and then running
ubuntu-device-flash to create either a stable or edge based image for 15.04
(in developer mode).

For initial testing I am using deb2snap to build a snap for the qt5
declarative clocks example, based on this guide:
https://docs.google.com/document/d/14msTXe_cFulk9z4jFptEjFJzZx58b1mWU_r4VivLkfA/edit?pli=1

The target device is a x86_64 based touchscreen and I am currently booting
my test images from a USB stick. The machine boots up successfully and
displays the empty/default mir server (w/ mouse cursor). When I install and
try to run the QML clocks example, I get the error shown below.

$ qtdeclarative5-examples-amd64.clocks
Loading module: 'libubuntu_application_api_desktop_mirclient.so.2.9.0'
[1444485571.860493] Loader: Loading modules from:
/apps/mir/current/debs/usr/lib/x86_64-linux-gnu/mir/client-platform
[1444485571.861038] Loader: Loading module:
/apps/mir/current/debs/usr/lib/x86_64-linux-gnu/mir/client-platform/mesa.so.2
Fontconfig error: Cannot load default config file
UbuntuWindow - regular geometry
terminate called after throwing an instance of
'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<std::runtime_error>
>'
  what():  Unexpectedly received fds
Aborted

I also tried with one of the mir client demos and get the same error...

(PC) $ ./deb2snap -d 15.04 --mir mir_demo_client_display_config

(Snappy) $ mir-demos.mir-demo-client-display-config
[1444582703.475395] Loader: Loading modules from:
/apps/mir/current/debs/usr/lib/x86_64-linux-gnu/mir/client-platform
[1444582703.480291] Loader: Loading module:
/apps/mir/current/debs/usr/lib/x86_64-linux-gnu/mir/client-platform/mesa.so.2
Current active output is 1024x768 +0+0
Server supports 2 of 6 surface pixel formats. Using format: 4

terminate called after throwing an instance of
'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<std::runtime_error>
>'
  what():  Unexpectedly received fds
Aborted

---

From: Kevin Gunn <[email-masked]>
Date: Mon, 12 Oct 2015 11:25:29 -0500

Hey Darren - give me a chance to replicate what you're doing so i can
compare results.
One question, were you able to run the gui example per the original
instructions in a vm ??

br,kg

On Mon, Oct 12, 2015 at 8:51 AM, Darren Landoll <[email-masked]>
wrote:

> --
> Mir-devel mailing list
> [email-masked]
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/mir-devel
>
>

---

From: Kevin Gunn <[email-masked]>
Date: Mon, 12 Oct 2015 16:52:17 -0500

Hey Darren -
so I was able to run the Qt clock demo on top of the mir snap. Here's a
quick list of what I did, so maybe we can figure out a possible difference
in what you and I both attempted.

The image...
for the Ubuntu Core image I followed the instructions at
https://developer.ubuntu.com/en/snappy/start/ under the heading "Getting
started with an x86 device". iiuc, you actually created an image from the
ubuntu-device-flash tool ? this might be one difference.

Mir snap...
i installed the mir snap from the store, snappy install mir.mvp-demo
which auto launched mir server just fine.
It was built a few months ago using the exact same instructions in the post
you were trying to follow.

Qt clock snap...
I actually scp'd an old Qt snap i had lying around, again, it had been
built using the exact same instructions in the post.
$ scp *.snap [email-masked]:/home/ubuntu
$ sudo snappy install --allow-unauthenticated qtdec*.snap
$ export LC_ALL=C.UTF-8
$ sudo qtdeclarative5-examples-amd64.clocks

Note, don't forget to set the LC_ALL, that'll result in an error.

br,kg

On Mon, Oct 12, 2015 at 12:01 PM, Darren Landoll <[email-masked]>
wrote:

> On Mon, Oct 12, 2015 at 12:25 PM, Kevin Gunn <[email-masked]>
> wrote:
>
> I briefly tried setting up and running it within a VM (on my Ubuntu 12.04
> machine), but was having trouble getting the Mir server to even run on the
> VM. I can try again with a newer desktop release that I've been setting up
> on a different PC.
>
>

---

From: Kevin Gunn <[email-masked]>
Date: Mon, 12 Oct 2015 17:00:17 -0500

Hey Darren - it just dawned on me, what's your host development machine on
? 15.04 or 15.10 ? There is a c++ abi break between 15.04 and 15.10, so you
wouldn't be able to use mir or qt components built on 15.10 on these 15.04
core images.
br,kg

On Mon, Oct 12, 2015 at 4:52 PM, Kevin Gunn <[email-masked]>
wrote:

> It was built a few months ago using the exact same instructions in the
> post you were trying to follow.
>
> Qt clock snap...
> On Mon, Oct 12, 2015 at 12:01 PM, Darren Landoll <[email-masked]
> > wrote:
>

---

From: Darren Landoll <[email-masked]>
Date: Mon, 12 Oct 2015 21:36:10 -0400

> wouldn't be able to use mir or qt components built on 15.10 on these 15.04

The host machine I build all the snaps and create system images on is 15.04.

>> ubuntu-device-flash tool ? this might be one difference.

Yes, I've been creating my own images using the ubuntu-device-flash tool...
but I've also tried using the official, stable 15.04 image referenced at
https://developer.ubuntu.com/en/snappy/start/ with no luck.

>> Note, don't forget to set the LC_ALL, that'll result in an error.

I've been using a mir snap that is built on my host machine (15.04 with all
the latest updates) and then automatically installed in the Snappy OS image
I build. I did forget to mention that I had this working at some point back
in the mid-August timeframe (for initial proof of concept), but after a
combination of updating my host machine and using the latest Snappy/Mir
versions it no longer worked.

My environment is also different in that I'm building the Qt clock snap
against the latest version of 15.04, which is what I would need to do for
my own custom application that will eventually be installed on Snappy.

For a test, I tried removing my custom mir snap and installed the
mir.mvp-demo snap from the store. When I try to run my custom snaps (built
against the latest 15.04 mir client libs) with the older server
(mir.mvp-demo), I get the following error instead...

$ sudo qtdeclarative5-examples-amd64.clocks
Bad system call
Loading module: 'libubuntu_application_api_desktop_mirclient.so.2.9.0'
[1444693723.318984] Loader: Loading modules from:
/apps/mir/snap1.1/debs/usr/lib/x86_64-linux-gnu/mir/client-platform
[1444693723.320623] Loader: Loading module:
/apps/mir/snap1.1/debs/usr/lib/x86_64-linux-gnu/mir/client-platform/mesa.so.2
[1444693723.326652] <WARNING> Loader: Failed to load module:
/apps/mir/snap1.1/debs/usr/lib/x86_64-linux-gnu/mir/client-platform/mesa.so.2
(error was:libmircommon.so.4: cannot open shared object file: No such file
or directory)
UbuntuClientIntegration: connection to Mir server failed. Check that a Mir
server is
running, and the correct socket is being used and is accessible. The shell
may have
rejected the incoming connection, so check its log file
Aborted

$ sudo mir-demos.mir-demo-client-display-config
Bad system call
[1444693756.375331] Loader: Loading modules from:
/apps/mir/snap1.1/debs/usr/lib/x86_64-linux-gnu/mir/client-platform
[1444693756.376586] Loader: Loading module:
/apps/mir/snap1.1/debs/usr/lib/x86_64-linux-gnu/mir/client-platform/mesa.so.2
[1444693756.377364] <WARNING> Loader: Failed to load module:
/apps/mir/snap1.1/debs/usr/lib/x86_64-linux-gnu/mir/client-platform/mesa.so.2
(error was:libmircommon.so.4: cannot open shared object file: No such file
or directory)
Can't get connection
A demo client that allows changing the display configuration. While the
client
has the focus, use the following keys to change and get information about
the
display configuration:
 c: clone outputs
 h: arrange outputs horizontally in the virtual space
 v: arrange outputs vertically in the virtual space
 1-9: enable only the Nth connected output (in the order returned by the
hardware)
 p: print current display configuration

---

From: Christopher James Halse Rogers <[email-masked]>
Date: Tue, 13 Oct 2015 12:46:11 +1100

On Tue, Oct 13, 2015 at 12:36 PM, Darren Landoll 
<[email-masked]> wrote:
> …
> (error was:libmircommon.so.4: cannot open shared object file: No such 
> file or directory)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> UbuntuClientIntegration: connection to Mir server failed. Check that 
> a Mir server is
> running, and the correct socket is being used and is accessible. The 
> shell may have

Looks like you're missing one of the dependencies of the client 
platform; this will prevent any client from working.

Once you work out why libmircommon.so.4 isn't available you should be 
able to get things working again. Or, at least, hit the next problem :)

---

From: "Stephen M. Webb" <[email-masked]>
Date: Tue, 13 Oct 2015 07:49:35 -0400

On 15-10-12 09:46 PM, Christopher James Halse Rogers wrote:
> 
> 
> On Tue, Oct 13, 2015 at 12:36 PM, Darren Landoll <[email-masked]> wrote:
>>
>> …
>> [1444693723.318984] Loader: Loading modules from: /apps/mir/snap1.1/debs/usr/lib/x86_64-linux-gnu/mir/client-platform
>> [1444693723.320623] Loader: Loading module: /apps/mir/snap1.1/debs/usr/lib/x86_64-linux-gnu/mir/client-platform/mesa.so.2
>> /apps/mir/snap1.1/debs/usr/lib/x86_64-linux-gnu/mir/client-platform/mesa.so.2 (error was:libmircommon.so.4: cannot
>> open shared object file: No such file or directory)
>> UbuntuClientIntegration: connection to Mir server failed. Check that a Mir server is
>> running, and the correct socket is being used and is accessible. The shell may have
> Looks like you're missing one of the dependencies of the client platform; this will prevent any client from working.
> 
> Once you work out why libmircommon.so.4 isn't available you should be able to get things working again. Or, at least,
> hit the next problem :)

Is this the classic problem caused by removing the runtime dependencies from the Mir packaging and requiring them to be
pre-seeded in the system images?

Darren, if you add the mir-graphics-drivers-desktop package (eg. to your oem snap) does it work?

-- 
Stephen M. Webb  <[email-masked]>

---

From: Darren Landoll <[email-masked]>
Date: Fri, 16 Oct 2015 07:21:42 -0400

>
> Is this the classic problem caused by removing the runtime dependencies
> from the Mir packaging and requiring them to be

 It doesn't look like there is a way to add mir-graphics-drivers-desktop to
the oem snap, but it is already included in the mir server snap.

---

From: Darren Landoll <[email-masked]>
Date: Sun, 18 Oct 2015 21:56:12 -0400

On Fri, Oct 16, 2015 at 7:21 AM, Darren Landoll
<[email-masked]> wrote:
>  It doesn't look like there is a way to add mir-graphics-drivers-desktop to the oem snap, but it is already included in the mir server snap.

I finally found a way to get a working combination using the existing
mir.mvp-demo snap available in the store. When I build a mir client
*.snap (still using deb2snap for now) it includes all of the mir
client libraries needed at runtime. However, the
/apps/mir/*/bin/mir-run script results in the mir client running
against the client lib included in the mir server application
(/apps/mir/*/debs/usr/lib/*/mir/client-platform).

This appears to not be compatible with snaps created against the
latest versions of 15.04 packages. If I make the following change to
/apps/mir/*/bin/mir-run I can successfully run the Qt example
application.

- export MIR_CLIENT_PLATFORM_PATH="$(ls -d
/apps/mir/snap1.1/debs/usr/lib/*/mir/client-platform)"
+ export MIR_CLIENT_PLATFORM_PATH="$(ls -d
$SNAP_APP_PATH/debs/usr/lib/*/mir/client-platform)"

If I create a custom mir server snap (including the change above)
instead of using the older mir-mvp-demo snap, I still get the original
error I ran into so it's looking like there might be an issue in the
latest mir client and/or server.

Here's the original error for reference: