xbmc / inputstream.ffmpegdirect

Supports streams opened by FFmpeg's libavformat or Kodi's cURL such as plain TS, HLS and DASH (non-DRM) as well as many others. There is support for Archive/Catchup services where there is a replay window and can timeshift across that span. Also provides timeshift for live streams where rewind/pause and fast-forward would not have been available.
GNU General Public License v2.0
57 stars 40 forks source link

[Archlinux aarch64] - Building fails in step ffmpeg - undefined reference to `nettle_sha3_256_shake' #299

Open coffeinflash opened 1 month ago

coffeinflash commented 1 month ago

Building on an up2date archlinux aarch64 fails in building/configuring ffmpeg:

test_ld cc -I/home/mediapc/source/git/inputstream.ffmpegdirect/build/build/depends/include -L/home/mediapc/source/git/inputstream.ffmpegdirect/build/build/depends/lib -lgnutls -lgmp -latomic -ldl -lnettle -L/home/mediapc/source/git/inputstream.ffmpegdirect/build/build/depends/lib -lhogweed -lgmp -lgmp -lz -lbrotlienc -lbrotlidec -lbrotlicommon -lzstd
test_cc -I/home/mediapc/source/git/inputstream.ffmpegdirect/build/build/depends/include -L/home/mediapc/source/git/inputstream.ffmpegdirect/build/build/depends/lib -L/home/mediapc/source/git/inputstream.ffmpegdirect/build/build/depends/lib
BEGIN /tmp/ffconf.23ZB6xlv/test.c
    1   #include <gnutls/gnutls.h>
    2   #include <stdint.h>
    3   long check_gnutls_global_init(void) { return (long) gnutls_global_init; }
    4   int main(void) { int ret = 0;
    5    ret |= ((intptr_t)check_gnutls_global_init) & 0xFFFF;
    6   return ret; }
END /tmp/ffconf.23ZB6xlv/test.c
/usr/bin/cc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DPIC -mcpu=cortex-a53 -march=armv8-a+crypto+crc -mtune=cortex-a53 -fPIC -pthread -flto -mcpu=cortex-a53 -march=armv8-a+crypto+crc -mtune=cortex-a53 -fPIC -pthread -flto -DTARGET_POSIX -DTARGET_LINUX -fPIC -std=c11 -fomit-frame-pointer -fPIC -pthread -I/home/mediapc/source/git/inputstream.ffmpegdirect/build/build/depends/include -I/home/mediapc/source/git/inputstream.ffmpegdirect/build/build/depends/include -L/home/mediapc/source/git/inputstream.ffmpegdirect/build/build/depends/lib -L/home/mediapc/source/git/inputstream.ffmpegdirect/build/build/depends/lib -c -o /tmp/ffconf.23ZB6xlv/test.o /tmp/ffconf.23ZB6xlv/test.c
cc1: warning: switch '-mcpu=cortex-a53' conflicts with '-march=armv8-a+crypto+crc' switch and resulted in options '+crc+crypto' being added
/usr/bin/cc -L/home/mediapc/source/git/inputstream.ffmpegdirect/build/build/depends/lib -Wl,--as-needed -Wl,-z,noexecstack -I/home/mediapc/source/git/inputstream.ffmpegdirect/build/build/depends/include -L/home/mediapc/source/git/inputstream.ffmpegdirect/build/build/depends/lib -L/home/mediapc/source/git/inputstream.ffmpegdirect/build/build/depends/lib -o /tmp/ffconf.23ZB6xlv/test /tmp/ffconf.23ZB6xlv/test.o -lgnutls -lgmp -latomic -ldl -lnettle -lhogweed -lgmp -lgmp -lz -lbrotlienc -lbrotlidec -lbrotlicommon -lzstd
**/usr/bin/ld: /tmp/ccOKp5ud.ltrans0.ltrans.o:(.data.rel.ro+0x8): undefined reference to `nettle_sha3_256_shake'**
collect2: error: ld returned 1 exit status

I am building with the default instructions:

cmake -DADDONS_TO_BUILD=inputstream.ffmpegdirect -DADDON_SRC_PREFIX=../.. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../../xbmc/build/addons -DPACKAGE_ZIP=1 ../../xbmc/cmake/addons
make

I know there are several messages about building issues with attached PKGBUILDs but none of them are working. I also tried with and without LTO but this makes no difference.

phunkyfish commented 1 month ago

Nettle and gnutls versions are very specific and need to be compatible. I don’t know much about arch but this is definitely something that would need to be solved in pkgbuild

coffeinflash commented 1 month ago

...but nettle and gnutls are downloaded during building and I guess these versions are compatible...

phunkyfish commented 1 month ago

On Linux they should use the system libs and not the downloaded versions

hbiyik commented 1 week ago
BEGIN /tmp/ffconf.cZkDVWPv/test.c
    1   #include <gnutls/gnutls.h>
    2   #include <stdint.h>
    3   long check_gnutls_global_init(void) { return (long) gnutls_global_init; }
    4   int main(void) { int ret = 0;
    5    ret |= ((intptr_t)check_gnutls_global_init) & 0xFFFF;
    6   return ret; }
END /tmp/ffconf.cZkDVWPv/test.c
/usr/bin/cc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DPIC -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g -ffile-prefix-map=/home/boogie/src/agrrepo/kodi/kodi-binary-addons-git/src=/usr/src/debug/kodi-binary-addons-git -flto=auto -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g -ffile-prefix-map=/home/boogie/src/agrrepo/kodi/kodi-binary-addons-git/src=/usr/src/debug/kodi-binary-addons-git -flto=auto -DTARGET_POSIX -DTARGET_LINUX -fPIC -std=c11 -fomit-frame-pointer -fPIC -pthread -I/home/boogie/src/agrrepo/kodi/kodi-binary-addons-git/src/addon-build/inputstream.ffmpegdirect/build/depends/include -I/home/boogie/src/agrrepo/kodi/kodi-binary-addons-git/src/addon-build/inputstream.ffmpegdirect/build/depends/include -L/home/boogie/src/agrrepo/kodi/kodi-binary-addons-git/src/addon-build/inputstream.ffmpegdirect/build/depends/lib -L/home/boogie/src/agrrepo/kodi/kodi-binary-addons-git/src/addon-build/inputstream.ffmpegdirect/build/depends/lib -c -o /tmp/ffconf.cZkDVWPv/test.o /tmp/ffconf.cZkDVWPv/test.c
/usr/bin/cc -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,-z,pack-relative-relocs -flto=auto -L/home/boogie/src/agrrepo/kodi/kodi-binary-addons-git/src/addon-build/inputstream.ffmpegdirect/build/depends/lib -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,-z,pack-relative-relocs -flto=auto -Wl,--as-needed -Wl,-z,noexecstack -I/home/boogie/src/agrrepo/kodi/kodi-binary-addons-git/src/addon-build/inputstream.ffmpegdirect/build/depends/include -L/home/boogie/src/agrrepo/kodi/kodi-binary-addons-git/src/addon-build/inputstream.ffmpegdirect/build/depends/lib -L/home/boogie/src/agrrepo/kodi/kodi-binary-addons-git/src/addon-build/inputstream.ffmpegdirect/build/depends/lib -o /tmp/ffconf.cZkDVWPv/test /tmp/ffconf.cZkDVWPv/test.o -lgnutls -lgmp -latomic -ldl -lnettle -lhogweed -lgmp -lgmp -lz -lbrotlienc -lbrotlidec -lbrotlicommon -lzstd
/usr/bin/ld: /tmp/ccRpGSEQ.ltrans4.ltrans.o:(.data.rel.ro+0x8): undefined reference to `nettle_sha3_256_shake'
collect2: error: ld returned 1 exit status
ERROR: gnutls not found using pkg-config

since arch has moved to ffmpeg 7.0 internal deps need to be used to build the addon, i have reproduced the same issue with x86_64 pc.

at least i found what causing the issue.

-lgnutls -lgmp -latomic -ldl -lnettle -lhogweed -lgmp -lgmp -lz -lbrotlienc -lbrotlidec -lbrotlicommon -lzstd

in the linked archives list above, hogweed must come before nettle ie:

-lgnutls -lgmp -latomic -ldl -lhogweed -lnettle -lgmp -lgmp -lz -lbrotlienc -lbrotlidec -lbrotlicommon -lzstd

with the above order, linker links succesfully. I dont know which make file generates this list though, sotmething in some pkgconfig but which one? nettle?