Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
coffeinflash opened this issue May 16, 2024 · 4 comments

Comments

@coffeinflash
Copy link

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
Copy link
Collaborator

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
Copy link
Author

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

@phunkyfish
Copy link
Collaborator

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

@hbiyik
Copy link

hbiyik commented Jun 22, 2024

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?

hbiyik pushed a commit to hbiyik/inputstream.ffmpegdirect that referenced this issue Jun 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants