media-autobuild_suite icon indicating copy to clipboard operation
media-autobuild_suite copied to clipboard

mediainfo can't link libbrotli

Open LigH-de opened this issue 1 year ago • 44 comments

┌ mediainfo git  ...................................... [Recently updated]
├ Running autogen...
├ Running configure...
├ Running install...
Likely error (tail of the failed operation logfile):
G:/MABS/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/13.2.0/../../../../i686-w64-mingw32/bin/ld.exe: G:/MABS/msys64/mingw32/lib/libbrotlidec.a(decode.c.obj):(.text+0x3f38): undefined reference to `BrotliTransformDictionaryWord'
G:/MABS/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/13.2.0/../../../../i686-w64-mingw32/bin/ld.exe: G:/MABS/msys64/mingw32/lib/libbrotlidec.a(decode.c.obj):(.text+0x534e): undefined reference to `_kBrotliPrefixCodeRanges'
G:/MABS/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/13.2.0/../../../../i686-w64-mingw32/bin/ld.exe: G:/MABS/msys64/mingw32/lib/libbrotlidec.a(decode.c.obj):(.text+0x5356): undefined reference to `_kBrotliPrefixCodeRanges'
G:/MABS/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/13.2.0/../../../../i686-w64-mingw32/bin/ld.exe: G:/MABS/msys64/mingw32/lib/libbrotlidec.a(decode.c.obj):(.text+0x56eb): undefined reference to `_kBrotliContextLookupTable'
G:/MABS/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/13.2.0/../../../../i686-w64-mingw32/bin/ld.exe: G:/MABS/msys64/mingw32/lib/libbrotlidec.a(state.c.obj):(.text+0x132): undefined reference to `BrotliGetDictionary'
G:/MABS/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/13.2.0/../../../../i686-w64-mingw32/bin/ld.exe: G:/MABS/msys64/mingw32/lib/libbrotlidec.a(state.c.obj):(.text+0x13d): undefined reference to `BrotliGetTransforms'
G:/MABS/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/13.2.0/../../../../i686-w64-mingw32/bin/ld.exe: G:/MABS/msys64/mingw32/lib/libbrotlidec.a(state.c.obj):(.text+0x159): undefined reference to `BrotliDefaultAllocFunc'
G:/MABS/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/13.2.0/../../../../i686-w64-mingw32/bin/ld.exe: G:/MABS/msys64/mingw32/lib/libbrotlidec.a(state.c.obj):(.text+0x15e): undefined reference to `BrotliDefaultFreeFunc'
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:328: mediainfo.exe] Error 1
install failed. Check G:/MABS/build/mediainfo-git/Project/GNU/CLI/ab-suite.install.log
This is required for other packages, so this script will exit.

logs.zip

LigH-de avatar Aug 05 '23 19:08 LigH-de

I'm also running into this issue. Seems to be related to https://github.com/curl/curl/issues/10620 and https://github.com/curl/curl/issues/10694

I'm not sure which version of curl is cloned using the autobuild but my guess is that is was fixed with 8.0.0 as it's an issue with 7.88.1

pieterhouwen avatar Aug 08 '23 11:08 pieterhouwen

libcurl was rebuilt today; build/curl-git/build-32bit/libcurl.pc reports Version: 8.3.0-DEV and contains -lbrotlidec twice.

msys64/var/log/pacman.log reports mingw-w64-[i686|x86_64]-brotli (1.0.9-5 -> 1.0.9-6) as last update.

LigH-de avatar Aug 08 '23 14:08 LigH-de

Same

Fishman0919 avatar Aug 09 '23 20:08 Fishman0919

This happened to me today as well

r-silver1 avatar Aug 11 '23 03:08 r-silver1

same

WuDi329 avatar Aug 22 '23 02:08 WuDi329

Try downgrading pkgconf. I don't see this link error, but I'm admittedly running an older pkgconf version due to an unrelated issue with pkgconf in my environment that I haven't tracked down yet (I'm currently using 1.9.5). I'm wondering if my local issue is an actual bug rather than just specific to my environment.

waldonnis avatar Aug 25 '23 16:08 waldonnis

That's not easy because the suite keeps the MSYS2 environment up-to-date.

LigH-de avatar Aug 25 '23 16:08 LigH-de

That's not easy because the suite keeps the MSYS2 environment up-to-date.

True, but it's worth a test and you can add it to an IgnorePkg line in /etc/pacman.conf for the duration of the test. I'm mostly just trying to figure out where the issue may be and am definitely not suggesting this as a permanent solution 😇

waldonnis avatar Aug 25 '23 17:08 waldonnis

Same problem here

BillClaghorn avatar Aug 25 '23 19:08 BillClaghorn

I also have this problem

nomaam avatar Sep 02 '23 02:09 nomaam

I have no idea where the responsibility for this lies, but without it being fixed, m-ab-s is virtually useless, unfortunately.

jfe1205 avatar Sep 02 '23 19:09 jfe1205

Try downgrading pkgconf. I That's not easy because the suite keeps the MSYS2 environment up-to-date.

If one is to try this fix what steps do I have to perform?

C:\media-ab\local64\bin-global>curl --version
curl 8.3.0-DEV (x86_64-w64-mingw32) libcurl/8.3.0-DEV OpenSSL/3.1.2 zlib/1.3 brotli/1.0.9 zstd/1.5.5 libidn2/2.3.0 libpsl/0.21.0 (no IDNA support) nghttp2/1.55.1
Release-Date: [unreleased]
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM PSL SPNEGO SSL SSPI threadsafe TLS-SRP UnixSockets zstd

- - - 
 C:/media-ab/msys64/mingw64/lib/libbrotlidec.a(decode.c.obj):(.rdata$.refptr._kBrotliPrefixCodeRanges[.refptr._kBrotliPrefixCodeRanges]+0x0): undefined reference to `_kBrotliPrefixCodeRanges'
C:/media-ab/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/media-ab/msys64/mingw64/lib/libbrotlidec.a(state.c.obj):(.text+0xda): undefined reference to `BrotliGetDictionary'
C:/media-ab/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/media-ab/msys64/mingw64/lib/libbrotlidec.a(state.c.obj):(.text+0xe6): undefined reference to `BrotliGetTransforms'
C:/media-ab/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/media-ab/msys64/mingw64/lib/libbrotlidec.a(state.c.obj):(.text+0x103): undefined reference to `BrotliDefaultAllocFunc'
C:/media-ab/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/media-ab/msys64/mingw64/lib/libbrotlidec.a(state.c.obj):(.text+0x10a): undefined reference to `BrotliDefaultFreeFunc'
C:/media-ab/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/media-ab/msys64/mingw64/lib/libbrotlidec.a(state.c.obj):(.rdata$.refptr.BrotliDefaultFreeFunc[.refptr.BrotliDefaultFreeFunc]+0x0): undefined reference to `BrotliDefaultFreeFunc'
C:/media-ab/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/media-ab/msys64/mingw64/lib/libbrotlidec.a(state.c.obj):(.rdata$.refptr.BrotliDefaultAllocFunc[.refptr.BrotliDefaultAllocFunc]+0x0): undefined reference to `BrotliDefaultAllocFunc'
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:328: mediainfo.exe] Error 1

Murmur avatar Sep 06 '23 13:09 Murmur

@Murmur If you want to try it, insert the following line into line 3 of the build\media-suite_compile.sh file: for 64-bit: pacman -U --noconfirm https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-pkgconf-1~1.9.5-1-any.pkg.tar.zst for 32-bit: pacman -U --noconfirm https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-pkgconf-1~1.9.5-1-any.pkg.tar.zst I have only tested it for 64-bit Clang

Don't get confused, every time you run the script the package is upgraded and then downgraded again. But this should only take seconds.

H7-26 avatar Sep 06 '23 19:09 H7-26

Haven't tried for 32-bit, but certainly works for 64-bit. Thanks a lot.

jfe1205 avatar Sep 07 '23 08:09 jfe1205

Works for 64bit script such as gpac.exe, MP4Box.exe, mediainfo.exe binaries were compiled.

Override pkgconf binary: media-suite_compile.sh (line 4): pacman -U --noconfirm "https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-pkgconf-1~1.9.5-1-any.pkg.tar.zst"

However later vulkan-loader.git project failed and mb script exits, no ffmpeg binaries were written yet I was looking for. This may or may not be related to a same problem described in this topic. ( https://github.com/m-ab-s/media-autobuild_suite/issues/2507 vulkan-loader )

┌ vulkan-loader git  ..................................... [Updates found]
├ Running uninstall...
0001-loader-cross-compile-static-linking-hacks.patch
        Patch could not be applied with `git am`. Continuing without patching.
0003-loader-prefix-cjson-symbols-and-mark-most-as-static.patch
        Patch could not be applied with `git am`. Continuing without patching.
├ Running dependencies...
├ Installing Vulkan-Headers...
├ Running uninstall...
├ Running cmake...
├ Running build...
├ Running install...
├ Building Vulkan-Loader...
├ Running cmake...
├ Running build...
Likely error (tail of the failed operation logfile):
C:/projects/media-ab/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: loader/libloader-opt.a(phys_dev_ext.c.obj):phys_dev_ext.c:(.rdata$.refptr.vkPhysDevExtTramp7[.refptr.vkPhysDevExtTramp7]+0x0): undefined reference to `vkPhysDevExtTramp7'
C:/projects/media-ab/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: loader/libloader-opt.a(phys_dev_ext.c.obj):phys_dev_ext.c:(.rdata$.refptr.vkPhysDevExtTramp6[.refptr.vkPhysDevExtTramp6]+0x0): undefined reference to `vkPhysDevExtTramp6'
C:/projects/media-ab/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: loader/libloader-opt.a(phys_dev_ext.c.obj):phys_dev_ext.c:(.rdata$.refptr.vkPhysDevExtTramp5[.refptr.vkPhysDevExtTramp5]+0x0): undefined reference to `vkPhysDevExtTramp5'
C:/projects/media-ab/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: loader/libloader-opt.a(phys_dev_ext.c.obj):phys_dev_ext.c:(.rdata$.refptr.vkPhysDevExtTramp4[.refptr.vkPhysDevExtTramp4]+0x0): undefined reference to `vkPhysDevExtTramp4'
C:/projects/media-ab/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: loader/libloader-opt.a(phys_dev_ext.c.obj):phys_dev_ext.c:(.rdata$.refptr.vkPhysDevExtTramp3[.refptr.vkPhysDevExtTramp3]+0x0): undefined reference to `vkPhysDevExtTramp3'
C:/projects/media-ab/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: loader/libloader-opt.a(phys_dev_ext.c.obj):phys_dev_ext.c:(.rdata$.refptr.vkPhysDevExtTramp2[.refptr.vkPhysDevExtTramp2]+0x0): undefined reference to `vkPhysDevExtTramp2'
C:/projects/media-ab/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: loader/libloader-opt.a(phys_dev_ext.c.obj):phys_dev_ext.c:(.rdata$.refptr.vkPhysDevExtTramp1[.refptr.vkPhysDevExtTramp1]+0x0): undefined reference to `vkPhysDevExtTramp1'
C:/projects/media-ab/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: loader/libloader-opt.a(phys_dev_ext.c.obj):phys_dev_ext.c:(.rdata$.refptr.vkPhysDevExtTramp0[.refptr.vkPhysDevExtTramp0]+0x0): undefined reference to `vkPhysDevExtTramp0'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
build failed. Check C:/projects/media-ab/build/vulkan-loader-git/build-64bit/ab-suite.build.log
This is required for other packages, so this script will exit.

Murmur avatar Sep 11 '23 09:09 Murmur

This successfully works around issue building mediainfo.exe

If you want to try it, insert the following line into line 3 of the build\media-suite_compile.sh file: for 64-bit: pacman -U --noconfirm https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-pkgconf-1~1.9.5-1-any.pkg.tar.zst

EyeBar avatar Sep 13 '23 06:09 EyeBar

What do I insert where when I run both 32 and 64 bit compilations in one? I guess that requires a bitness switch?

LigH-de avatar Sep 13 '23 12:09 LigH-de

@LigH-de like @H7-26 already wrote: there are 2 packages, one for 32 bit, one for 64 bit. If you have both 32 and 64 bit, well then, install both :-)

However, when downgrading manually (without changing media-suite_compile.sh): After downgrading, you should tell pacman to keep it's fingers from touching pkgconfig, otherwise it would update pkgconf at next run. To do this add IgnorePkg = pkgconf mingw-w64-x86_64-pkgconf (64-bit) or IgnorePkg = pkgconf mingw-w64-i686-pkgconf (32-bit)

to pacman.conf found in /etc

When editing while using windows pacman.conf can be found in /mingw64/etc/pacman.conf for 64 bit and /mingw32/etc/pacman.conf for 32 bit

there should already be a line #IgnorePkg = in pacman.conf just remove the # and use that line

To revert this change, just add the # back in place and this line will be ignored.

nikolasr avatar Sep 17 '23 17:09 nikolasr

I have no idea where the responsibility for this lies, but without it being fixed, m-ab-s is virtually useless, unfortunately.

@1480c1 this is unresolved for weeks and stops the whole thing from working.

maddes8cht avatar Sep 21 '23 13:09 maddes8cht

The fix from MurMur above works great.

If you want to try it, insert the following line into line 3 of the build\media-suite_compile.sh file: for 64-bit: pacman -U --noconfirm https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-pkgconf-1~1.9.5-1-any.pkg.tar.zst

BillClaghorn avatar Sep 21 '23 15:09 BillClaghorn

@Biswa96 wrote in MSYS2's IRC, it may be related to https://github.com/msys2/MINGW-packages/issues/18554

Adding -lbrotlicommon may workaround the issue.

Could this be a simple extra parameter to be added to the build script for all projects which need libbrotli?

LigH-de avatar Sep 21 '23 18:09 LigH-de

Not sure I have much time to run this down further right now, but there is one behavioural difference between 1.9.5 and 2.0.x that may explain some of this (and explains one non-suite issue I had locally). Running pkgconf --path against a package that is both suite-compiled and provided by mingw (libcurl, libxml2, etc) results in different path search/matching behaviour between the two pkgconf versions. With 1.9.5, the .pc file in /local64/lib/pkgconfig was matched first, but 2.0.x matches the .pc files in /mingw64/lib/pkgconfig first instead. In this case (and others), the two are likely to be different and I'd assume the suite-compiled versions should be used for compiling/linking, but that's not the case with 2.0.x. This may cause problems if cflags and libs differ between the two (like this one).

FYI, I think there's still an ordering bug filed against upstream pkgconf, so this could be an offshoot of that, but it might also be helpful to know which version's behaviour is the proper, intended path search behaviour as well.

Edit: It's basically not respecting PKG_CONFIG_PATH ordering. It always searches the last path in the envvar first for some reason.

waldonnis avatar Sep 21 '23 21:09 waldonnis

some libbrotli object files were being renamed by the script via "do_hide_all_sharedlibs". manually copying them back during the libbrotli config allowed me to finish the compilation successfully

Zerrika avatar Sep 22 '23 02:09 Zerrika

some libbrotli object files were being renamed by the script via "do_hide_all_sharedlibs". manually copying them back during the libbrotli config allowed me to finish the compilation successfully

a silly question as I can't remember if the script builds shared or static or both ... were you building static ?

hydra3333 avatar Sep 22 '23 07:09 hydra3333

a silly question as I can't remember if the script builds shared or static or both ... were you building static ?

yes i built static

Zerrika avatar Sep 22 '23 13:09 Zerrika

Same – MABS recommends building static ffmpeg, so I select static only as well. Building both in parallel is supported but usually causes a higher chance of trouble, so I don't try that anymore.

LigH-de avatar Sep 22 '23 13:09 LigH-de

@LigH-de Thanks a lot! Changed line 16 in media-suite_compile.sh to FFMPEG_BASE_OPTS=("--pkg-config=pkgconf" --pkg-config-flags="--keep-system-libs --keep-system-cflags --static" "--cc=$CC" "--cxx=$CXX" "--ld=$CXX" "--extra-cxxflags=-fpermissive" "--extra-cflags=-Wno-int-conversion" --extra-ldflags=-lbrotlicommon ) Adding --extra-ldflags=-lbrotlicommon while using upstream msys pkgconf did the trick for me! I still had some issues with glslang, shaderc and vulkan-loader I had to work out, but that might be unrelated to this issue. So, forgive me the foreign language, to @LigH-de: "Danke, einmal mit Profis arbeiten!" :-D

nikolasr avatar Sep 22 '23 21:09 nikolasr

I am not sure if that is a suitable workaround in general. Possibly just for your state of the suite.

I just ran mine again after several weeks. And fonfconfig has now very similar issues linking bzip2. So I'll rather wait for a fix in pkgconf.

LigH-de avatar Sep 23 '23 13:09 LigH-de

Well, of course, it's just a very quick'n'dirty fix, which only masquerades the underlying root cause and might introduce other problems. So, surely this needs to be further investigated, but for those impatient folks like me, who want a binary now , it does the trick ;-)

nikolasr avatar Sep 23 '23 21:09 nikolasr

I am not sure if that is a suitable workaround in general. Possibly just for your state of the suite.

I just ran mine again after several weeks. And fonfconfig has now very similar issues linking bzip2. So I'll rather wait for a fix in pkgconf.

Just wondering, are the pkgconf maintainers aware of the issue ? (a link to the issue would be handy if you know it)

hydra3333 avatar Sep 24 '23 03:09 hydra3333