Building native apps
Sergio Schvezov
sergio.schvezov at canonical.com
Tue Feb 17 11:53:54 UTC 2015
On martes 17 de febrero de 2015 08h'49:34 BRST, Gábor Paller wrote:
> The launcher you are referring is under $HOME/snappy-bin, right?
>
> I successfully compiled the popular fswebcam application and it
> works but I can't get it to work with the launcher.
> ($HOME/snappy-bin/fswebcam.fswebcam).
> All the commands below are issued as root.
Take a look at https://github.com/sergiusens/camlistore.snap
in there the references point to the wrapper scripts; the wrapper scripts
take care of launching for the right architecture by setting up the paths
(bin and ld) correctly.
I did not upload the binaries to github, but you can maybe infer that
bin/$arch/$real_arch_binary
is where the binaries live. I don't have libs in this package, but it gets
setup to look at
lib/$arch/$arch_library
> If I launch it directly from under the /apps tree, it works
> nicely (after having set the LD_LIBRARY_PATH to the lib
> directory of my snap).
>
> root at localhost:/apps/fswebcam/20140113/bin# ./fswebcam
> /home/ubuntu/1.jpg
> --- Opening /dev/video0...
>
> Trying source module v4l2...
>
> /dev/video0 opened.
>
> ...
>
> I hacked into the $HOME/snappy-bin/fswebcam.fswebcam file that
> was created automatically during package installation and added
> the LD_LIBRARY_PATH.
>
> ...
> export SNAPP_LIB="$SNAPP_APP_PATH/lib"
> export LD_LIBRARY_PATH=$SNAPP_LIB:$LD_LIBRARY_PATH
> ...
>
> Then executed the resulting fswebcam.fswebcam.
>
> root at localhost:~/snappy-bin# ./fswebcam.fswebcam
>
> --- Opening /dev/video0...
>
> Trying source module v4l2...
>
> Error opening device: /dev/video0
>
> open: Permission denied
>
> Clearly, somehow I lose access rights to /dev/video0. How can it be?
Because even if it's running as root; it's not the root you are used to
(it's kind like the Solaris 10 root role).
root runs without priviledges to anything as it's gated by apparmor's
confinement rules; to overcome this for now, do something like shown here
https://github.com/sergiusens/camlistore.snap/blob/master/meta/camlistored.apparmor
but replace the read_path and write_path with /dev/video0
This is temporary and you can refer to Jamie's email to the list (the devel
one IIRC) for details on how this is going to be solved at the general
level.
Keep in mind that using read and write paths triggers a manual review on
the store.
Cheers
Sergio
More information about the snappy-app-devel
mailing list