AkarinVS / L-SMASH-Works

Works based on L-SMASH project; This repo focuses on the common portion and the VapourSynth plugin. AviSynth users please use https://github.com/HomeOfAviSynthPlusEvolution/L-SMASH-Works. ffmpeg 5.0+ please use ffmpeg-4.5 branch.
47 stars 11 forks source link

Compiles, but doesn't run properly with glib2 .74.* #29

Closed Wisperer closed 1 year ago

Wisperer commented 1 year ago

As stated it will compile, but trying to run it results on in undefined symbol error. I've been able to replicate this on at least 3 systems.

OS: Arch Linux

Using Vapoursynth

the error is : libgobject-2.0.so.0: undefined symbol:atomic_rc_box_release_full I will note this occurs with both the ffmpeg 4.4 and 5 branches. Something in the underlying dependencies has changed.

AkarinVS commented 1 year ago

lsmas itself doesn't use glib, so it must be something else that depends on glib. AFAIK, ffmpeg itself also doesn't use glib either, so which library brings in the glib dependency?

you might want to first find out which library (indirectly used by libvslsmashsource.so) links with libgobject (and references the symbol atomic_rc_box_release_full) and then see if that library is out of date?

Message ID: @.***>

Wisperer commented 1 year ago

Well my error output directly states gobject. It may be an issue with my version python-gobject now that I think about it. But that's the error I get when the lib itself is called.

AkarinVS commented 1 year ago

The issue is that neither lsmas and its immediate dependency ffmpeg links to glib (which libgobject is a part of), so I'm not sure which library brings in the libgobject dependency. Are you sure the error is from lsmas and not from other plugins/packages used by the script?

Have you tried to use "vspipe -i test.vpy" to run the simplest vpy script that uses lsmas? e.g.: from vapoursynth import core core.lsmas.LWLibavSource("input.mkv").set_output()

If it also errors out, what is the exact error message? If it succeeds, then I'm afraid the gobject error is not caused by lsmas.

Wisperer commented 1 year ago

right. This is the full error. And I can confirm it's compiled against ffmpeg 4.4

Using Ldd I've found the Chain is LSmachsource > FFPMEG > libavcodec > glib2 > libgobject


Failed to evaluate the script:
Python exception: Failed to load /home/fletcher/.hybrid/vsplugins/libvslsmashsource.so. Error given: /usr/lib/libgobject-2.0.so.0: undefined symbol: g_atomic_rc_box_release_full

Traceback (most recent call last):
File "src/cython/vapoursynth.pyx", line 2866, in vapoursynth._vpy_evaluate
File "src/cython/vapoursynth.pyx", line 2867, in vapoursynth._vpy_evaluate
File "/tmp/tempPreviewVapoursynthFile20_07_44_252.vpy", line 7, in 
core.std.LoadPlugin(path="/home/fletche
r/.hybrid/vsplugins/libvslsmashsource.so")
File "src/cython/vapoursynth.pyx", line 2612, in vapoursynth.Function.__call__
vapoursynth.Error: Failed to load /home/fletcher/.hybrid/vsplugins/libvslsmashsource.so. Error given: /usr/lib/libgobject-2.0.so.0: undefined symbol: g_atomic_rc_box_release_full```

Further poking indicated the Crash only happens in VS viewer. the encode actually renders now. 
AkarinVS commented 1 year ago

Then it's an issue of broken ffmpeg build. Perhaps you updated glib but didn't recompile ffmpeg.

Wisperer commented 1 year ago

I'll investigate that and get back to you then.

That said it shouldn't be an issue. I'm using the Distro packages provided by arch linux. So they'd have to have a bad biuld sent to everyone, but I haven't been able to find anything recent about a broken ffmpeg/glib biuld.

On Wed, Jan 18, 2023, 7:35 AM AkarinVS @.***> wrote:

Then it's an issue of broken ffmpeg build. Perhaps you updated glib but didn't recompile ffmpeg.

On Tue, Jan 17, 2023 at 8:41 PM Wisperer @.***> wrote:

right. This is the full error. And I can confirm it's compiled against ffmpeg 4.4

Using Ldd I've found the Chain is LSmachsource > FFPMEG > libavcodec > glib2 > libgobject

Failed to evaluate the script: Python exception: Failed to load /home/fletcher/.hybrid/vsplugins/libvslsmashsource.so. Error given: /usr/lib/libgobject-2.0.so.0: undefined symbol: g_atomic_rc_box_release_full

Traceback (most recent call last): File "src/cython/vapoursynth.pyx", line 2866, in vapoursynth._vpy_evaluate File "src/cython/vapoursynth.pyx", line 2867, in vapoursynth._vpy_evaluate File "/tmp/tempPreviewVapoursynthFile20_07_44_252.vpy", line 7, in core.std.LoadPlugin(path="/home/fletche r/.hybrid/vsplugins/libvslsmashsource.so") File "src/cython/vapoursynth.pyx", line 2612, in vapoursynth.Function.call vapoursynth.Error: Failed to load /home/fletcher/.hybrid/vsplugins/libvslsmashsource.so. Error given: /usr/lib/libgobject-2.0.so.0: undefined symbol: g_atomic_rc_box_release_full```

— Reply to this email directly, view it on GitHub < https://github.com/AkarinVS/L-SMASH-Works/issues/29#issuecomment-1386344093 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/ATAG4YFPFY6EZBVM47LSYXDWS5C53ANCNFSM6AAAAAAT5GS2XI

. You are receiving this because you commented.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/AkarinVS/L-SMASH-Works/issues/29#issuecomment-1386984527, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF54KZ3FWWHBJRXFE2OGP3DWS7PSVANCNFSM6AAAAAAT5GS2XI . You are receiving this because you authored the thread.Message ID: @.***>

Wisperer commented 1 year ago

It isn't a bad ffmpeg compile. Recompiled it Against the new glib and recompiled lsmash source Against it. Same error.

AkarinVS commented 1 year ago

But lsmas doesn't use glib at all, so it really isn't a lsmas bug either.

Please try setting LD_VERBOSE=1 and LD_TRACE_LOADED_OBJECTS=1 and then rerun the vspipe command and look at the log to see what's happening. If libgobject is not required by libvslsmashsource.so, then I'm afraid there isn't anything that can be done from the lsmas side to fix this problem.

Another way to see if this is caused by libavcodec.so or libgobject.so themselves is to use core.std.LoadPlugin on them. e.g. try core.std.LoadPlugin("/usr/lib/libgobject-2.0.so.0") what error does it produce? Is it complaining about "No entry point found" (which is expected) or "Failed to load" (which means the library is somehow broken)?

Wisperer commented 1 year ago

so lsmashsource is linking glib2.

second to last lib listed

[fletcher@fletcher-standardpci440fxpiix1996 vsplugins]$ ldd libvslsmashsource.so
        linux-vdso.so.1 (0x00007ffdef79e000)
        liblsmash.so.2 => /usr/lib/liblsmash.so.2 (0x00007f985a77c000)
        libavcodec.so.59 => /usr/lib/libavcodec.so.59 (0x00007f9859200000)
        libavformat.so.59 => /usr/lib/libavformat.so.59 (0x00007f9858e00000)
        libavutil.so.57 => /usr/lib/libavutil.so.57 (0x00007f9858a00000)
        libswscale.so.6 => /usr/lib/libswscale.so.6 (0x00007f985a6da000)
        libc.so.6 => /usr/lib/libc.so.6 (0x00007f9858c19000)
        libswresample.so.4 => /usr/lib/libswresample.so.4 (0x00007f985a6b8000)
        libvpx.so.7 => /usr/lib/libvpx.so.7 (0x00007f9858600000)
        libm.so.6 => /usr/lib/libm.so.6 (0x00007f985a5d0000)
        libwebpmux.so.3 => /usr/lib/libwebpmux.so.3 (0x00007f985a5c3000)
        libwebp.so.7 => /usr/lib/libwebp.so.7 (0x00007f9859193000)
        liblzma.so.5 => /usr/lib/liblzma.so.5 (0x00007f9859160000)
        libdav1d.so.6 => /usr/lib/libdav1d.so.6 (0x00007f9858437000)
        libopencore-amrwb.so.0 => /usr/lib/libopencore-amrwb.so.0 (0x00007f985914a000)
        libaom.so.3 => /usr/lib/libaom.so.3 (0x00007f9857a00000)
        libgsm.so.1 => /usr/lib/libgsm.so.1 (0x00007f985a5b2000)
        libmp3lame.so.0 => /usr/lib/libmp3lame.so.0 (0x00007f98590d2000)
        libopencore-amrnb.so.0 => /usr/lib/libopencore-amrnb.so.0 (0x00007f98590a9000)
        libopenjp2.so.7 => /usr/lib/libopenjp2.so.7 (0x00007f9858994000)
        libopus.so.0 => /usr/lib/libopus.so.0 (0x00007f985893a000)
        librav1e.so.0 => /usr/lib/librav1e.so.0 (0x00007f9857600000)
        libspeex.so.1 => /usr/lib/libspeex.so.1 (0x00007f985891d000)
        libtheoraenc.so.1 => /usr/lib/libtheoraenc.so.1 (0x00007f98588e4000)
        libtheoradec.so.1 => /usr/lib/libtheoradec.so.1 (0x00007f9858c00000)
        libvorbis.so.0 => /usr/lib/libvorbis.so.0 (0x00007f9858409000)
        libvorbisenc.so.2 => /usr/lib/libvorbisenc.so.2 (0x00007f985835e000)
        libx264.so.164 => /usr/lib/libx264.so.164 (0x00007f9857200000)
        libx265.so.199 => /usr/lib/libx265.so.199 (0x00007f9855e00000)
        libxvidcore.so.4 => /usr/lib/libxvidcore.so.4 (0x00007f98578f1000)
        libz.so.1 => /usr/lib/libz.so.1 (0x00007f98588ca000)
        libva.so.2 => /usr/lib/libva.so.2 (0x00007f985832e000)
        libmfx.so.1 => /usr/lib/libmfx.so.1 (0x00007f9859099000)
        libxml2.so.2 => /usr/lib/libxml2.so.2 (0x00007f9855c98000)
        libbz2.so.1.0 => /usr/lib/libbz2.so.1.0 (0x00007f985831b000)
        libmodplug.so.1 => /usr/lib/libmodplug.so.1 (0x00007f9855b0a000)
        libbluray.so.2 => /usr/lib/libbluray.so.2 (0x00007f98582be000)
        libgmp.so.10 => /usr/lib/libgmp.so.10 (0x00007f985755d000)
        libgnutls.so.30 => /usr/lib/libgnutls.so.30 (0x00007f9855800000)
        libsrt.so.1.5 => /usr/lib/libsrt.so.1.5 (0x00007f9857138000)
        libssh.so.4 => /usr/lib/libssh.so.4 (0x00007f98574f1000)
        libva-drm.so.2 => /usr/lib/libva-drm.so.2 (0x00007f98588c5000)
        libva-x11.so.2 => /usr/lib/libva-x11.so.2 (0x00007f98578ea000)
        libvdpau.so.1 => /usr/lib/libvdpau.so.1 (0x00007f98578e5000)
        libX11.so.6 => /usr/lib/libX11.so.6 (0x00007f98556bd000)
        libdrm.so.2 => /usr/lib/libdrm.so.2 (0x00007f98578cf000)
        /usr/lib64/ld-linux-x86-64.so.2 (0x00007f985a87e000)
        libsoxr.so.0 => /usr/lib/libsoxr.so.0 (0x00007f98570d5000)
        libsharpyuv.so.0 => /usr/lib/libsharpyuv.so.0 (0x00007f98578c7000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f98574d1000)
        libogg.so.0 => /usr/lib/libogg.so.0 (0x00007f9855aff000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f9855400000)
        libmvec.so.1 => /usr/lib/libmvec.so.1 (0x00007f9855a05000)
        libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f98574cc000)
        libicuuc.so.72 => /usr/lib/libicuuc.so.72 (0x00007f9855000000)
        libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x00007f985566f000)
        libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00007f9855331000)
        libp11-kit.so.0 => /usr/lib/libp11-kit.so.0 (0x00007f9854ecd000)
        libbrotlienc.so.1 => /usr/lib/libbrotlienc.so.1 (0x00007f985528d000)
        libbrotlidec.so.1 => /usr/lib/libbrotlidec.so.1 (0x00007f9855661000)
        libzstd.so.1 => /usr/lib/libzstd.so.1 (0x00007f9854e24000)
        libidn2.so.0 => /usr/lib/libidn2.so.0 (0x00007f985563f000)
        libunistring.so.5 => /usr/lib/libunistring.so.5 (0x00007f9854c6a000)
        libtasn1.so.6 => /usr/lib/libtasn1.so.6 (0x00007f9855276000)
        libnettle.so.8 => /usr/lib/libnettle.so.8 (0x00007f9855222000)
        libhogweed.so.6 => /usr/lib/libhogweed.so.6 (0x00007f9854c21000)
        libcrypto.so.3 => /usr/lib/libcrypto.so.3 (0x00007f9854600000)
        libXext.so.6 => /usr/lib/libXext.so.6 (0x00007f985520d000)
        libXfixes.so.3 => /usr/lib/libXfixes.so.3 (0x00007f9855205000)
        libX11-xcb.so.1 => /usr/lib/libX11-xcb.so.1 (0x00007f985563a000)
        libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007f9854bf6000)
        libxcb-dri3.so.0 => /usr/lib/libxcb-dri3.so.0 (0x00007f9854bef000)
        libgomp.so.1 => /usr/lib/libgomp.so.1 (0x00007f9854ba6000)
        libicudata.so.72 => /usr/lib/libicudata.so.72 (0x00007f9852800000)
        libexpat.so.1 => /usr/lib/libexpat.so.1 (0x00007f9854b7b000)
        libpng16.so.16 => /usr/lib/libpng16.so.16 (0x00007f9854b42000)
        libharfbuzz.so.0 => /usr/lib/libharfbuzz.so.0 (0x00007f9854a59000)
        libffi.so.8 => /usr/lib/libffi.so.8 (0x00007f9854a4e000)
        libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f98545fb000)
        libbrotlicommon.so.1 => /usr/lib/libbrotlicommon.so.1 (0x00007f98545d8000)
        libXau.so.6 => /usr/lib/libXau.so.6 (0x00007f98545d3000)
        libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007f98527f8000)
        libgraphite2.so.3 => /usr/lib/libgraphite2.so.3 (0x00007f98527d6000)
        libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x00007f9852697000)
        libpcre2-8.so.0 => /usr/lib/libpcre2-8.so.0 (0x00007f98525fc000)
AkarinVS commented 1 year ago

But it is brought in by libavcodec.

Sorry but I don't know how to remotely debug issues like this.

One thing is certain: lsmas does not use glib or gobject and only uses ffmpeg APIs. Your ffmpeg libraries link to libgobject somehow and it's causing load time issues with lsmas. I don't know why it's not causing issues for other ffmpeg clients. You will have to debug this yourself.

Wisperer commented 1 year ago

it just occurred to me you and I are actually in a discord together. Perhaps you could help me there?

sl1pkn07 commented 1 year ago

from pactree (pacman-contrib)

├─harfbuzz
│ │ │ ├─freetype2
│ │ │ ├─glib2
│ │ │ │ ├─libffi
│ │ │ │ │ └─glibc
│ │ │ │ ├─libsysprof-capture
│ │ │ │ ├─pcre2
│ │ │ │ │ ├─gcc-libs
│ │ │ │ │ ├─readline
│ │ │ │ │ ├─zlib
│ │ │ │ │ ├─bzip2
│ │ │ │ │ └─bash
│ │ │ │ ├─util-linux-libs
│ │ │ │ ├─zlib
│ │ │ │ ├─libffi provides libffi.so=8-64
│ │ │ │ └─util-linux-libs provides libmount.so=1-64
│ │ │ ├─graphite
│ │ │ │ └─gcc-libs
│ │ │ ├─freetype2 provides libfreetype.so=6-64
│ │ │ ├─glib2 provides libglib-2.0.so=0-64
│ │ │ └─glib2 provides libgobject-2.0.so=0-64
│ │ ├─vulkan-icd-loader
│ │ │ ├─glibc
│ │ │ └─nvidia-utils provides vulkan-driver
│ │ │   ├─xorg-server
---cut---
│ │ │   │ ├─xf86-input-libinput
│ │ │   │ │ └─libinput
---cut---
│ │ │   │ │   └─libwacom
│ │ │   │ │     ├─glib2
│ │ │   │ │     ├─systemd
│ │ │   │ │     └─libgudev
│ │ │   │ │       ├─systemd
│ │ │   │ │       ├─glib2
│ │ │   │ │       ├─glib2 provides libglib-2.0.so=0-64
│ │ │   │ │       ├─glib2 provides libgobject-2.0.so=0-64
│ │ │   │ │       └─systemd-libs provides libudev.so=1-64
─librsvg provides librsvg-2.so=2-64
│ ├─cairo
│ │ ├─lzo
│ │ │ └─glibc
│ │ ├─zlib
│ │ ├─libpng
│ │ ├─fontconfig
│ │ ├─freetype2
│ │ ├─libx11
│ │ ├─libxext
│ │ ├─libxrender
│ │ ├─libxcb
│ │ ├─glib2
│ │ └─pixman
│ ├─freetype2
│ ├─gdk-pixbuf2
│ │ ├─glib2
│ │ ├─libpng
│ │ ├─libtiff
│ │ │ ├─glibc
│ │ │ ├─libjpeg-turbo
│ │ │ │ └─glibc
│ │ │ ├─libjpeg-turbo provides libjpeg.so=8-64
│ │ │ ├─zlib
│ │ │ ├─xz
│ │ │ └─zstd
│ │ ├─libjpeg-turbo provides libjpeg
│ │ └─shared-mime-info
│ │   ├─libxml2
│ │   └─glib2
│ ├─glib2
│ ├─harfbuzz
│ ├─libxml2
│ └─pango
│   ├─libthai
│   │ └─libdatrie
│   │   └─glibc
│   ├─cairo
│   ├─libxft
│   │ ├─fontconfig
│   │ └─libxrender
│   ├─harfbuzz
│   └─fribidi

choose you figther

Wisperer commented 1 year ago

Seems the Dev can't fix this issue as it's a downstream problem. no point in keeping this open.

Wisperer commented 1 year ago

I recompiled everything from glib up based on the last glib version i know worked. That was glib 2.73.3. still getting the same error.

fletcher@fletcher: ~ $ readelf -sW /usr/lib/libglib-2.0.so.0 | grep atomic_rc
   330: 0000000000021cd0   152 FUNC    GLOBAL DEFAULT   10 g_atomic_rc_box_release_full
   582: 0000000000021d70    12 FUNC    GLOBAL DEFAULT   10 g_atomic_rc_box_release
   908: 0000000000021bd0   111 FUNC    GLOBAL DEFAULT   10 g_atomic_rc_box_acquire
  1132: 000000000001df70    63 FUNC    GLOBAL DEFAULT   10 g_atomic_rc_box_alloc0
  1142: 000000000001df30    60 FUNC    GLOBAL DEFAULT   10 g_atomic_rc_box_alloc
  1670: 000000000001e050   109 FUNC    GLOBAL DEFAULT   10 g_atomic_rc_box_get_size
  1771: 000000000001dfb0   151 FUNC    GLOBAL DEFAULT   10 g_atomic_rc_box_dup
fletcher@fletcher: ~ $ ldd /usr/lib/libavcodec.so.59 | grep glib
        libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x00007fbee0c17000)
fletcher@fletcher: ~ $ ldd /home/fletcher/.hybrid/vsplugins/libvslsmashsource.so | grep libav
        libavcodec.so.59 => /usr/lib/libavcodec.so.59 (0x00007fdfe9800000)
        libavformat.so.59 => /usr/lib/libavformat.so.59 (0x00007fdfe9400000)
        libavutil.so.57 => /usr/lib/libavutil.so.57 (0x00007fdfe9000000)

So I worked out what happened. Glib2.73.3 is the last release that this plus FFMpeg will work with ATM. I had to use the ffmpeg 4.5 barnch to make it work after compiling FFMPEG 5.1.2 against the new GLib biuld.