dlopen cannot load shared library

Roberto Mier Escandón  roberto.escandon at canonical.com
Thu Feb 9 10:38:58 UTC 2017


Thanks,

The problem was, indeed, a fail in the path to a library. Your answers
were key to solve it. The dlopen() now works ok.


On 03/02/17 13:59, Mark Shuttleworth wrote:
> On 03/02/17 12:41, Loïc Minier wrote:
>> In classic mode, you see libraries from your classic Ubuntu system
>> including X11; in devmode/confined mode, you only see system libraries
>> from the core snap which doesn't contain X11.
> 
> One more point. If you try this command you will be running a shell
> "inside the snap", in other words, you will be experiencing the
> filesystem exactly as your snap sees it.
> 
>   $ snap run --shell <snap>
> 
> Now you are living inside the container that is setup just for that
> snap. It's using the same sorts of mechanisms as LXD and Docker to keep
> processes apart, but it is also setup in such a way that files can be
> shared across snaps. You can see the environment variables that snapd
> has setup so snap processes can find out where they can write data etc:
> 
>   $ set | grep SNAP
>   SNAP=/snap/etcd/x5
>   SNAP_ARCH=amd64
>   SNAP_COMMON=/var/snap/etcd/common
>   SNAP_DATA=/var/snap/etcd/x5
>   SNAP_LIBRARY_PATH=/var/lib/snapd/lib/gl:
>   SNAP_NAME=etcd
>   SNAP_REEXEC=
>   SNAP_REVISION=x5
>   SNAP_USER_COMMON=/home/mark/snap/etcd/common
>   SNAP_USER_DATA=/home/mark/snap/etcd/x5
>   SNAP_VERSION=2.3.7
> 
> And if you start using 'ls' to poke around the filesystem, you quickly
> see that you are in your own special world:
> 
>   $ ls /
>   ls: cannot open directory '/': Permission denied
> 
>   $ sudo ls /
>   bash: /usr/bin/sudo: Permission denied
> 
>   $ ls -l /lib/
>   total 74
>   drwxr-xr-x  2 root root    52 Jan 13 20:41 apparmor
>   drwxr-xr-x  2 root root    57 Jan 13 20:41 bridge-utils
>   drwxr-xr-x  2 root root    40 Jan 13 20:41 cgmanager
>   drwxr-xr-x  3 root root    89 Jan 13 20:41 crda
>   drwxr-xr-x  2 root root     3 Jan 13 20:40 firmware
>   drwxr-xr-x  2 root root  1032 Jan 13 20:41 i386-linux-gnu
>   drwxr-xr-x  2 root root    59 Jan 13 20:41 ifupdown
>   drwxr-xr-x  2 root root    51 Jan 13 20:41 init
>   -rwxr-xr-x  1 root root 70952 Sep 22 18:34
> klibc-k3La8MUnuzHQ0_kG8hokcGAC0PA.so
>   lrwxrwxrwx  1 root root    25 Nov 16 22:51 ld-linux.so.2 ->
> i386-linux-gnu/ld-2.23.so
>   drwxr-xr-x  3 root root    61 Jan 13 20:41 lsb
>   drwxr-xr-x  2 root root    35 Jan 13 20:41 modprobe.d
>   drwxr-xr-x  6 root root  4096 Jan 26 10:15 modules
>   drwxr-xr-x  2 root root    31 Jan 13 20:41 netplan
>   drwxr-xr-x  2 root root    35 Jan 13 20:41 resolvconf
>   drwxr-xr-x  8 root root  1057 Jan 13 20:41 systemd
>   drwxr-xr-x 15 root root   132 Jan 13 20:41 terminfo
>   drwxr-xr-x  4 root root   298 Jan 13 20:41 udev
>   drwxr-xr-x  3 root root  4281 Jan 13 20:41 x86_64-linux-gnu
>   drwxr-xr-x  2 root root  2531 Jan 13 20:41 xtables
> 
> So you see, this is a super-minimal "core" with just a few libraries.
> 
> You can find your snap at $SNAP:
> 
>   $ echo $SNAP
>   /snap/foo/7
>   $ ls -lR $SNAP
>   /snap/foo/x5:
>   ... <your snap tree here>
> 
> Hope that's a useful introduction. It's a lot of fun once you realise
> that you have TOTAL control over your snap, but everything else is very
> structured for you.
> 
> Mark
> 
> 
> 




More information about the Snapcraft mailing list