Termux-packages: mpv cannot link executable: cannot locate symbol "XzUnpacker_Construct" referenced by "/system/lib64/libunwind.so"

Created on 30 Jul 2019  路  26Comments  路  Source: termux/termux-packages

Problem description
May be related to #4041

mpv dies when attempting to play audio files inside termux. pkg reinstall mpv did not improve the situation.

Steps to reproduce

$ mpv file.mp3
CANNOT LINK EXECUTABLE "/data/data/com.termux/files/usr/libexec/mpv": cannot locate symbol "XzUnpacker_Construct" referenced by "/system/lib64/libunwind.so"...
Aborted
$

Expected behavior

Expected behavior: mpv plays audio files in termux without X11. This has worked previously.

Observed behavior: mpv prints an error and exits nonzero.

Additional information

$ termux-info
/data/data/com.termux/files/usr/bin/termux-info: 23: /data/data/com.termux/files/usr/bin/termux-info: awk: not found
Updatable packages:
All packages up to date
Subscribed repositories:
System information:
Linux localhost 3.18.31-Sultan #1 SMP PREEMPT Thu Feb 21 21:13:51 MSK 2019 aarch64 Android
Termux-packages arch:
aarch64
Android version:
7.1.2
Device manufacturer:
OnePlus
Device model:
ONEPLUS A3000
$ logcat -d "*:W"
--------- beginning of crash
07-29 17:24:30.494 18722 18722 F libc    : CANNOT LINK EXECUTABLE "/data/data/com.termux/files/usr/libexec/mpv": cannot locate symbol "XzUnpacker_Construct" referenced by "/system/lib64/libunwind.so"...
07-29 17:24:30.494 18722 18722 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 18722 (mpv)
07-29 17:51:39.862 23667 23667 F libc    : CANNOT LINK EXECUTABLE "/data/data/com.termux/files/usr/libexec/mpv": cannot locate symbol "XzUnpacker_Construct" referenced by "/system/lib64/libunwind.so"...
07-29 17:51:39.862 23667 23667 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 23667 (mpv)
07-29 17:59:45.077 25478 25478 F libc    : CANNOT LINK EXECUTABLE "/data/data/com.termux/files/usr/libexec/mpv": cannot locate symbol "XzUnpacker_Construct" referenced by "/system/lib64/libunwind.so"...
07-29 17:59:45.077 25478 25478 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 25478 (mpv)
07-29 18:01:51.222 26831 26831 F libc    : CANNOT LINK EXECUTABLE "/data/data/com.termux/files/usr/libexec/mpv": cannot locate symbol "XzUnpacker_Construct" referenced by "/system/lib64/libunwind.so"...
07-29 18:01:51.225 26831 26831 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 26831 (mpv)
--------- beginning of main
07-29 18:03:46.832  4105  4105 W IInputConnectionWrapper: finishComposingText on inactive InputConnection
07-29 18:03:49.112  4105  4105 W IInputConnectionWrapper: finishComposingText on inactive InputConnection
07-29 18:03:49.164  4105  4105 W IInputConnectionWrapper: reportFullscreenMode on inexistent InputConnection
07-29 18:03:49.164  4105  4105 W IInputConnectionWrapper: finishComposingText on inactive InputConnection
$ strace -fv -s 2048 -o strace.log mpv | curl -F 'f:1=<-' ix.io
http://ix.io/1Q0S
android-5.x android-6.x bug report

All 26 comments

It's probably because of https://github.com/termux/termux-packages/commit/378661c70391ef554bfef6ec029b50798180c9c9 and the fact that liblzma in the android-5 repo is not versioned. (The OP appears to have installed some custom-built liblzma.) While it would probably be fixed if we version the android-5 liblzma, I have no idea why @xeffyr make the mpv script preload it. (The android-5 mpv is neither built with liblzma or libarchive support.)

Btw users of Android 7+ should really switch to the master repo. Save you the day.

I have no idea why @xeffyr make the mpv script preload it.

glib preload for => https://github.com/termux/termux-packages/issues/4041
lzma preload for => https://imgur.com/a/FKZZnBS (https://www.reddit.com/r/termux/comments/cfvd62/mpv_is_not_working/)

Not sure since when our mpv got (indirectly) linked to libxml2. Anyway, instead of preloading our liblzma, versioning it should be the solution, as the former basically just cancels out the effect of having /system/lib[64] and so in the LD_LIBRARY_PATH of the mpv script.

(The OP appears to have installed some custom-built liblzma.

@tomty89 Any guess how that happened and how I can undo it? I certainly did not do so with knowledge or intent.

@rpdelaney Oh sorry, by OP I meant https://github.com/termux/termux-packages/issues/4041. I was merely explaining why your problem didn't occur there.

On my Android 5 device, the mpv works without any problem (everything stock 5.1 AOSP).

OP in https://github.com/termux/termux-packages/issues/4041 has even glib in /system/lib.

@xeffyr You made sure your current liblzma doesn't for some reason have a versioned SONAME though? (And your current mpv script isn't for some reason not preloading liblzma)

And your current mpv script isn't for some reason not preloading liblzma

Just did fresh installation:

asciicast

Ah, I don't have liblzma.so in /system at all...

Yes, with liblzma.so in /system it doesn't work:

$ mpv
CANNOT LINK EXECUTABLE "/data/data/com.termux/files/usr/libexec/mpv": cannot locate symbol "XzUnpacker_Construct" referenced by "/system/lib64/libunwind.so"...

But it can be added to preload too:

#!/data/data/com.termux/files/usr/bin/sh
export LD_PRELOAD=/system/lib64/liblzma.so:/data/data/com.termux/files/usr/lib/liblzma.so:/data/data/com.termux/files/usr/lib/libglib-2.0.so:/data/data/com.termux/files/usr/lib/libavcodec.so:/data/data/com.termux/files/usr/lib/libavfilter.so:/data/data/com.termux/files/usr/lib/libavformat.so:/data/data/com.termux/files/usr/lib/libavutil.so:/data/data/com.termux/files/usr/lib/libpostproc.so:/data/data/com.termux/files/usr/lib/libswresample.so:/data/data/com.termux/files/usr/lib/libswscale.so
LD_LIBRARY_PATH=/system/lib64:/system/vendor/lib64:/data/data/com.termux/files/usr/lib exec /data/data/com.termux/files/usr/libexec/mpv "$@"

mpv working:

$ mpv --version
mpv 0.29.1 Copyright 漏 2000-2018 mpv/MPlayer/mplayer2 projects
 built on Sun Jul 21 21:38:47 UTC 2019
ffmpeg library versions:
   libavutil       56.22.100
   libavcodec      58.35.100
   libavformat     58.20.100
   libswscale      5.3.100
   libavfilter     7.40.101
   libswresample   3.3.100
ffmpeg version: 4.1.4

I'm not sure what you mean. What's the content of the first mpv your were running? The problem should only occur when you are preloading liblzma.so. (How were you testing anyway? Were you simulating the case with some quirky way)

Oh never mind. You mean preloading both of them. Well, maybe. I am not sure how safe it is though. (IIRC that equals to replacing symbols that the both liblzma have with the latter liblzma)

I am not sure how safe it is though.

It should be safe. They are completely different despite their name, you can compare their symbol table.

We can try versioned liblzma, but I'm not sure if it will work properly on Android 5 devices (as I know, versioning 100% works from Android 6).

To me, it's either backporting https://github.com/termux/termux-packages/pull/3747 or reverting https://github.com/termux/termux-packages/pull/3998. Mixing symbols from both liblzma under the same SONAME feels dangerous to me at the very least. (But it's your call, I don't exactly care what happens to the android-5 branch, heh)

Btw users of Android 7+ should really switch to the master repo. Save you the day.

How do I switch to the master repo? Are there documented instructions on the wiki?

Directions at https://wiki.termux.com/wiki/Bintray_package_hosting and https://wiki.termux.com/wiki/New_package_repository . Why does only the latter link mention termux-upgrade-repo?

Why does only the latter link mention termux-upgrade-repo?

Because https://wiki.termux.com/wiki/Bintray_package_hosting was written at time when android-7 repo was created. This page should be rewritten from scratch because too much outdated information on it.

Fixed in latest mpv version.

This issue still occurs on my device

$ termux-info
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://termux.org/packages/ stable main
# game-repo (sources.list.d/game.list)
deb https://dl.bintray.com/grimler/game-packages-24 games stable
# science-repo (sources.list.d/science.list)
deb https://dl.bintray.com/grimler/science-packages-24 science stable
Updatable packages:
All packages up to date                                                
Android version:
9                                                                      
Kernel build information:
Linux localhost 4.14.83-perf+ #2 SMP PREEMPT Tue Oct 29 05:24:34 CST 20
19 aarch64 Android
Device manufacturer:
blackshark
Device model:
DLT-A0
$ mpv
CANNOT LINK EXECUTABLE "mpv": cannot locate symbol "XzUnpacker_Construc
t" referenced by "/system/lib64/libunwind.so"...
$

@rendiix you are subscribed to the repositories for android 5 and android 6. Please run termux-upgrade-repo to switch to the new repositories (this will reinstall all packages so will take some time and download quite a lot of data). Switching will fix this, and other, issues

@Grimler91 termux.org is Android 7+ (it was termux.net for Android 5/6).

My bad, too early in the morning

@rendiix printenv?

@tomty89

$ printenv
SHELL=/data/data/com.termux/files/home/.termux/shell
PREFIX=/data/data/com.termux/files/usr
GPG_TTY=/dev/pts/0
PWD=/data/data/com.termux/files/home
EXTERNAL_STORAGE=/sdcard
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
HOME=/data/data/com.termux/files/home
LANG=en_US.UTF-8
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear
=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*
.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
TMPDIR=/data/data/com.termux/files/usr/tmp
ANDROID_DATA=/data
TERM=xterm-256color
SHLVL=1
ANDROID_ROOT=/system
LD_LIBRARY_PATH=/data/data/com.termux/files/usr/lib
GCC_COLORS=error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01
PATH=/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets
_=/data/data/com.termux/files/usr/bin/printenv
$

LD_LIBRARY_PATH=/data/data/com.termux/files/usr/lib

unset LD_LIBRARY_PATH
It should not be set if using Termux on Android 7+.

LD_LIBRARY_PATH=/data/data/com.termux/files/usr/lib

unset LD_LIBRARY_PATH
It should not be set if using Termux on Android 7+.

thank you, you saved my life

Was this page helpful?
0 / 5 - 0 ratings

Related issues

am11 picture am11  路  3Comments

Zuccace picture Zuccace  路  3Comments

ILadis picture ILadis  路  3Comments

bbtdev picture bbtdev  路  3Comments

neitsab picture neitsab  路  3Comments