Works fine outside of snap when I installed all the dependencies on the host. Then I turned to look at the binary itself and ld.so output. running the binary directly (while inside the snap shell): LD_DEBUG=all LD_LIBRARY_PATH=$SNAP_LIBRARY_PATH /snap/mame/168/mame 2>$SNAP_USER_DATA/mame.ld.log-2 echo $SNAP_LIBRARY_PATH /var/lib/snapd/lib/gl:/var/lib/snapd/lib/gl32:/var/lib/snapd/void ld.so log (notice that the paths in SNAP_LIBRARY_PATH are missing): ``` 5217: file=libGL.so.1 [0]; needed by /snap/mame/168/mame [0] 5217: find library=libGL.so.1 [0]; searching 5217: search path=/snap/mame/168/usr/lib/x86_64-linux-gnu: /snap/mame/168/lib/x86_64-linux-gnu: /snap/mame/168/usr/lib/x86_64-linux-gnu/pulseaudio/tls/x86_64: /snap/mame/168/usr/lib/x86_64-linux-gnu/pulseaudio/tls: /snap/mame/168/usr/lib/x86_64-linux-gnu/pulseaudio/x86_64: /snap/mame/168/usr/lib/x86_64-linux-gnu/pulseaudio: /snap/mame/168/usr/lib/x86_64-linux-gnu/mesa/tls/x86_64: /snap/mame/168/usr/lib/x86_64-linux-gnu/mesa/tls: /snap/mame/168/usr/lib/x86_64-linux-gnu/mesa/x86_64: /snap/mame/168/usr/lib/x86_64-linux-gnu/mesa: /snap/mame/168/usr/lib/tls/x86_64: /snap/mame/168/usr/lib/tls:/snap/mame/168/usr/lib/x86_64: /snap/mame/168/usr/lib: /snap/core/current/lib/x86_64-linux-gnu/tls/x86_64: /snap/core/current/lib/x86_64-linux-gnu/tls: /snap/core/current/lib/x86_64-linux-gnu/x86_64: /snap/core/current/lib/x86_64-linux-gnu (RPATH from file /snap/mame/168/mame) <------ 5217: trying file=/snap/mame/168/usr/lib/x86_64-linux-gnu/libGL.so.1 5217: trying file=/snap/mame/168/lib/x86_64-linux-gnu/libGL.so.1 5217: trying file=/snap/mame/168/usr/lib/x86_64-linux-gnu/pulseaudio/tls/x86_64/libGL.so.1 5217: trying file=/snap/mame/168/usr/lib/x86_64-linux-gnu/pulseaudio/tls/libGL.so.1 5217: trying file=/snap/mame/168/usr/lib/x86_64-linux-gnu/pulseaudio/x86_64/libGL.so.1 5217: trying file=/snap/mame/168/usr/lib/x86_64-linux-gnu/pulseaudio/libGL.so.1 5217: trying file=/snap/mame/168/usr/lib/x86_64-linux-gnu/mesa/tls/x86_64/libGL.so.1 5217: trying file=/snap/mame/168/usr/lib/x86_64-linux-gnu/mesa/tls/libGL.so.1 5217: trying file=/snap/mame/168/usr/lib/x86_64-linux-gnu/mesa/x86_64/libGL.so.1 5217: trying file=/snap/mame/168/usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 5217: 5217: file=libGL.so.1 [0]; generating link map 5217: dynamic: 0x00007f8240fa7c60 base: 0x00007f8240d37000 size: 0x0000000000272478 5217: entry: 0x00007f8240d4fe80 phdr: 0x00007f8240d37040 phnum: 8 5217: 5217: ``` More detailed log: https://paste.ubuntu.com/p/Zm57vmQCwR/ notice how it uses LD_LIBRARY_PATH for some of the libraries. RPATH is embedded in the binary itself: ``` 0x000000000000000f (RPATH) Library rpath: [ $ORIGIN/usr/lib/x86_64-linux-gnu: $ORIGIN/lib/x86_64-linux-gnu: $ORIGIN/usr/lib/x86_64-linux-gnu/pulseaudio: $ORIGIN/usr/lib/x86_64-linux-gnu/mesa: $ORIGIN/usr/lib: /snap/core/current/lib/x86_64-linux-gnu ] ``` readelf -a /snap/mame/168/mame ``` LF Header: Magic: 7f 45 4c 46 02 01 01 03 00 00 00 00 00 00 00 00 Class: ELF64 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - GNU ABI Version: 0 Type: EXEC (Executable file) Machine: Advanced Micro Devices X86-64 Version: 0x1 Entry point address: 0x1e74f80 Start of program headers: 64 (bytes into file) Start of section headers: 245838392 (bytes into file) Flags: 0x0 Size of this header: 64 (bytes) Size of program headers: 56 (bytes) Number of program headers: 11 Size of section headers: 64 (bytes) Number of section headers: 40 Section header string table index: 39 Section Headers: [Nr] Name Type Address Offset Size EntSize Flags Link Info Align [ 0] NULL 0000000000000000 00000000 0000000000000000 0000000000000000 0 0 0 [ 1] .dynamic DYNAMIC 00000000003ff2a8 000002a8 00000000000002e0 0000000000000010 WA 2 0 8 [ 2] .dynstr STRTAB 00000000003ff588 00000588 000000000000ad9c 0000000000000000 A 0 0 8 [ 3] .dynsym DYNSYM 000000000040a328 0000b328 00000000000092b8 0000000000000018 A 2 1 8 [ 4] .gnu.hash GNU_HASH 00000000004135e0 000145e0 0000000000001304 0000000000000000 A 3 0 8 [ 5] .interp PROGBITS 00000000004148e8 000158e8 0000000000000033 0000000000000000 A 0 0 8 [ 6] .note.ABI-tag NOTE 0000000000414920 00015920 0000000000000020 0000000000000000 A 0 0 8 [ 7] .note.gnu.build-i NOTE 0000000000414940 00015940 0000000000000024 0000000000000000 A 0 0 8 [ 8] .gnu.version VERSYM 0000000000415564 00016564 0000000000000c3a 0000000000000002 A 3 0 2 [ 9] .gnu.version_r VERNEED 00000000004161a0 000171a0 00000000000002f0 0000000000000000 A 2 9 8 [10] .rela.dyn RELA 0000000000416490 00017490 0000000000004890 0000000000000018 A 3 0 8 [11] .rela.plt RELA 000000000041ad20 0001bd20 0000000000005f40 0000000000000018 AI 3 27 8 [12] .init PROGBITS 0000000000420c60 00021c60 000000000000001a 0000000000000000 AX 0 0 4 [13] .plt PROGBITS 0000000000420c80 00021c80 0000000000003f90 0000000000000010 AX 0 0 16 [14] .plt.got PROGBITS 0000000000424c10 00025c10 0000000000000008 0000000000000000 AX 0 0 8 [15] .text PROGBITS 0000000000424c20 00025c20 00000000065d4650 0000000000000000 AX 0 0 16 [16] .fini PROGBITS 00000000069f9270 065fa270 0000000000000009 0000000000000000 AX 0 0 4 [17] .rodata PROGBITS 00000000069f9280 065fa280 000000000353c460 0000000000000000 A 0 0 32 [18] .eh_frame_hdr PROGBITS 0000000009f356e0 09b366e0 00000000002c5e44 0000000000000000 A 0 0 4 [19] .eh_frame PROGBITS 000000000a1fb528 09dfc528 0000000000d115dc 0000000000000000 A 0 0 8 [20] .gcc_except_table PROGBITS 000000000af0cb04 0ab0db04 00000000002d9ac9 0000000000000000 A 0 0 4 [21] .tbss NOBITS 000000000b3e7420 0ade8420 0000000000000014 0000000000000000 WAT 0 0 8 [22] .init_array INIT_ARRAY 000000000b3e7420 0ade8420 000000000000b610 0000000000000000 WA 0 0 8 [23] .fini_array FINI_ARRAY 000000000b3f2a30 0adf3a30 0000000000000008 0000000000000000 WA 0 0 8 [24] .jcr PROGBITS 000000000b3f2a38 0adf3a38 0000000000000008 0000000000000000 WA 0 0 8 [25] .data.rel.ro PROGBITS 000000000b3f2a40 0adf3a40 00000000000021f0 0000000000000000 WA 0 0 32 [26] .got PROGBITS 000000000b3f4f00 0adf5f00 0000000000000100 0000000000000008 WA 0 0 8 [27] .got.plt PROGBITS 000000000b3f5000 0adf6000 0000000000001fd8 0000000000000008 WA 0 0 8 [28] .data PROGBITS 000000000b3f6fe0 0adf7fe0 000000000045810c 0000000000000000 WA 0 0 32 [29] .comment PROGBITS 0000000000000000 0b2500ec 0000000000000034 0000000000000001 MS 0 0 1 [30] .bss NOBITS 000000000b84f100 0b2500ec 0000000000c46220 0000000000000000 WA 0 0 32 [31] .debug_aranges PROGBITS 0000000000000000 0b250120 0000000000000090 0000000000000000 0 0 1 [32] .debug_info PROGBITS 0000000000000000 0b2501b0 0000000000119f84 0000000000000000 0 0 1 [33] .debug_abbrev PROGBITS 0000000000000000 0b36a134 00000000000020d7 0000000000000000 0 0 1 [34] .debug_line PROGBITS 0000000000000000 0b36c20b 00000000000011cf 0000000000000000 0 0 1 [35] .debug_str PROGBITS 0000000000000000 0b36d3da 00000000001662ab 0000000000000001 MS 0 0 1 [36] .debug_ranges PROGBITS 0000000000000000 0b4d3685 00000000000000b0 0000000000000000 0 0 1 [37] .symtab SYMTAB 0000000000000000 0b4d3738 0000000001256e38 0000000000000018 38 354220 8 [38] .strtab STRTAB 0000000000000000 0c72a570 0000000002348b46 0000000000000000 0 0 1 [39] .shstrtab STRTAB 0000000000000000 0ea730b6 000000000000017f 0000000000000000 0 0 1 Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings), I (info), L (link order), O (extra OS processing required), G (group), T (TLS), C (compressed), x (unknown), o (OS specific), E (exclude), l (large), p (processor specific) There are no section groups in this file. Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flags Align PHDR 0x0000000000000040 0x00000000003ff040 0x00000000003ff040 0x0000000000000268 0x0000000000000268 R E 0x8 GNU_STACK 0x0000000000001000 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000 RW 0x10 LOAD 0x0000000000000000 0x00000000003ff000 0x00000000003ff000 0x0000000000001000 0x0000000000001000 RW 0x1000 DYNAMIC 0x00000000000002a8 0x00000000003ff2a8 0x00000000003ff2a8 0x00000000000002e0 0x00000000000002e0 RW 0x8 LOAD 0x0000000000001000 0x0000000000400000 0x0000000000400000 0x000000000ade65cd 0x000000000ade65cd R E 0x1000 NOTE 0x000000000000128c 0x000000000040028c 0x000000000040028c 0x0000000000000044 0x0000000000000044 R 0x4 INTERP 0x00000000000158e8 0x00000000004148e8 0x00000000004148e8 0x0000000000000033 0x0000000000000033 R 0x1 [Requesting program interpreter: /snap/mame/current/lib/x86_64-linux-gnu/ld-2.23.so] GNU_EH_FRAME 0x0000000009b366e0 0x0000000009f356e0 0x0000000009f356e0 0x00000000002c5e44 0x00000000002c5e44 R 0x4 LOAD 0x000000000ade8420 0x000000000b3e7420 0x000000000b3e7420 0x0000000000467ccc 0x00000000010adf00 RW 0x1000 TLS 0x000000000ade8420 0x000000000b3e7420 0x000000000b3e7420 0x0000000000000000 0x0000000000000014 R 0x8 GNU_RELRO 0x000000000ade8420 0x000000000b3e7420 0x000000000b3e7420 0x000000000000dbe0 0x000000000000dbe0 R 0x1 Section to Segment mapping: Segment Sections... 00 01 02 .dynamic 03 .dynamic 04 .dynsym .gnu.hash .interp .note.ABI-tag .note.gnu.build-id .gnu.version .gnu.version_r .rela.dyn .rela.plt .init .plt .plt.got .text .fini .rodata .eh_frame_hdr .eh_frame .gcc_except_table 05 06 .interp 07 .eh_frame_hdr 08 .init_array .fini_array .jcr .data.rel.ro .got .got.plt .data .bss 09 .tbss 10 .init_array .fini_array .jcr .data.rel.ro .got Dynamic section at offset 0x2a8 contains 41 entries: Tag Type Name/Value 0x000000000000000f (RPATH) Library rpath: [$ORIGIN/usr/lib/x86_64-linux-gnu:$ORIGIN/lib/x86_64-linux-gnu:$ORIGIN/usr/lib/x86_64-linux-gnu/pulseaudio:$ORIGIN/usr/lib/x86_64-linux-gnu/mesa:$ORIGIN/usr/lib:/snap/core/current/lib/x86_64-linux-gnu] 0x0000000000000001 (NEEDED) Shared library: [libdl.so.2] 0x0000000000000001 (NEEDED) Shared library: [librt.so.1] 0x0000000000000001 (NEEDED) Shared library: [libSDL2-2.0.so.0] 0x0000000000000001 (NEEDED) Shared library: [libpthread.so.0] 0x0000000000000001 (NEEDED) Shared library: [libutil.so.1] 0x0000000000000001 (NEEDED) Shared library: [libGL.so.1] 0x0000000000000001 (NEEDED) Shared library: [libasound.so.2] 0x0000000000000001 (NEEDED) Shared library: [libQt5Widgets.so.5] 0x0000000000000001 (NEEDED) Shared library: [libQt5Gui.so.5] 0x0000000000000001 (NEEDED) Shared library: [libQt5Core.so.5] 0x0000000000000001 (NEEDED) Shared library: [libX11.so.6] 0x0000000000000001 (NEEDED) Shared library: [libSDL2_ttf-2.0.so.0] 0x0000000000000001 (NEEDED) Shared library: [libfontconfig.so.1] 0x0000000000000001 (NEEDED) Shared library: [libstdc++.so.6] 0x0000000000000001 (NEEDED) Shared library: [libm.so.6] 0x0000000000000001 (NEEDED) Shared library: [libgcc_s.so.1] 0x0000000000000001 (NEEDED) Shared library: [libc.so.6] 0x000000000000000c (INIT) 0x420c60 0x000000000000000d (FINI) 0x69f9270 0x0000000000000019 (INIT_ARRAY) 0xb3e7420 0x000000000000001b (INIT_ARRAYSZ) 46608 (bytes) 0x000000000000001a (FINI_ARRAY) 0xb3f2a30 0x000000000000001c (FINI_ARRAYSZ) 8 (bytes) 0x000000006ffffef5 (GNU_HASH) 0x4135e0 0x0000000000000005 (STRTAB) 0x3ff588 0x0000000000000006 (SYMTAB) 0x40a328 0x000000000000000a (STRSZ) 44444 (bytes) 0x000000000000000b (SYMENT) 24 (bytes) 0x0000000000000015 (DEBUG) 0x0 0x0000000000000003 (PLTGOT) 0xb3f5000 0x0000000000000002 (PLTRELSZ) 24384 (bytes) 0x0000000000000014 (PLTREL) RELA 0x0000000000000017 (JMPREL) 0x41ad20 0x0000000000000007 (RELA) 0x416490 0x0000000000000008 (RELASZ) 18576 (bytes) 0x0000000000000009 (RELAENT) 24 (bytes) 0x000000006ffffffe (VERNEED) 0x4161a0 0x000000006fffffff (VERNEEDNUM) 9 0x000000006ffffff0 (VERSYM) 0x415564 0x0000000000000000 (NULL) 0x0 Displaying notes found in: .note.ABI-tag Owner Data size Description GNU 0x00000010 NT_GNU_ABI_TAG (ABI version tag) OS: Linux, ABI: 2.6.32 Displaying notes found in: .note.gnu.build-id Owner Data size Description ```