Issue 557 in webp: img2webp fails compilation in MSYS2/MinGW with GCC 11.2: undefined references to libtiff routines

190 views
Skip to first unread message

cont… via monorail

unread,
Feb 19, 2022, 10:34:05 AM2/19/22
to webp-d...@webmproject.org
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 557 by cont...@ligh.de: img2webp fails compilation in MSYS2/MinGW with GCC 11.2: undefined references to libtiff routines
https://bugs.chromium.org/p/webp/issues/detail?id=557

What steps will reproduce the problem?
1. use MSYS2 / MinGW to compile all required prerequisites with GCC 11.2 for Windows platform target, including libtiff-4 (tiff version 4.3.0, libtiff library version 5.7.0)
2. use MSYS2 / MinGW to compile HEAD version of libwebp with GCC 11.2 and CMake, using several required compatibility patches
3. (I simplified this by running the "media-autobuild suite")

What is the expected output? What do you see instead?
Expecting a compilation producing command line codecs for Windows, like cwebp.exe, dwebp.exe, img2webp.exe, gif2webp.exe ... as it used to work all the time, weeks and months ago.
Instead, now the compilation of img2webp fails, complaining "undefined references" to some libtiff routines related to jbg, lerc, and lzma.

What version of the product are you using? On what operating system?
MSYS2 / MinGW, GCC 11.2, CMake in an environment installed by the media-autobuild suite, running on Windows 10.

Please provide any additional information below.
Attaching a zipped archive of log files collected by the media-autobuild suite.

Attachments:
logs.zip 88.5 KB

--
You received this message because:
1. The project was configured to send all issue notifications to this address

You may adjust your notification preferences at:
https://bugs.chromium.org/hosting/settings

jz… via monorail

unread,
Feb 23, 2022, 10:08:07 PM2/23/22
to webp-d...@webmproject.org

Comment #1 on issue 557 by jz...@google.com: img2webp fails compilation in MSYS2/MinGW with GCC 11.2: undefined references to libtiff routines
https://bugs.chromium.org/p/webp/issues/detail?id=557#c1

Thanks for the report. I don't think this is gcc-11 related, but I did just upgrade and the code compiles for me with configure and cmake with 'mingw-w64-x86_64-libtiff 4.3.0-7' installed. The cmake command from your logs minus the toolchain file [1] works for me too.

You're right that it looks like the libtiff dependencies aren't being linked. In my case a .dll.a is used for the link [2]. If libtiff was compiled from source and the static lib used then I'd expect to see link errors like this given the command from the logs [3]. Looking at FindTIFF.cmake it looks like it's geared towards a shared library.

CMAKE_C_STANDARD_LIBRARIES [4] or setting LDFLAGS (LDLIBS would work with configure) might be a workaround. Searching around there seem to be a few old threads about this kind of thing as well as an abandoned patch for lzma [5].

[1]
cmake .. -G Ninja -DBUILD_SHARED_LIBS=off -DCMAKE_INSTALL_PREFIX=/local32 -DUNIX=on -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_BINDIR=/local32/bin-global -DWEBP_ENABLE_SWAP_16BIT_CSP=ON -DWEBP_BUILD_EXTRAS=OFF -DWEBP_BUILD_VWEBP=OFF -DWEBP_BUILD_CWEBP=ON -DWEBP_BUILD_DWEBP=ON -DWEBP_BUILD_GIF2WEBP=ON -DWEBP_BUILD_IMG2WEBP=ON -DWEBP_BUILD_ANIM_UTILS=ON -DWEBP_BUILD_WEBPMUX=ON
[2]
cmd.exe /C "cd . && msys64\mingw64\bin\cc.exe -pthread -O3 -DNDEBUG CMakeFiles/img2webp.dir/examples/img2webp.c.o -o img2webp.exe -Wl,--out-implib,libimg2webp.dll.a -Wl,--major-image-version,0,--minor-image-version,0 libexampleutil.a libimagedec.a libimageioutil.a libwebp.a libwebpmux.a libwebpdemux.a /msys64/mingw64/lib/libpng.dll.a /msys64/mingw64/lib/libz.dll.a /msys64/mingw64/lib/libjpeg.dll.a /msys64/mingw64/lib/libtiff.dll.a libwebp.a -lshlwapi -lole32 -lwindowscodecs -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
[3]
cmd.exe /C "cd . && G:\MABS\msys64\mingw32\bin\ccache.exe gcc -mthreads -mtune=generic -O2 -pipe -DFREEGLUT_STATIC -pthread -O3 -DNDEBUG -pipe -static-libgcc -static-libstdc++ CMakeFiles/img2webp.dir/examples/img2webp.c.o -o img2webp.exe -Wl,--out-implib,libimg2webp.dll.a -Wl,--major-image-version,0,--minor-image-version,0 libexampleutil.a libimagedec.a libimageioutil.a libwebp.a libwebpmux.a libwebpdemux.a -Llib -ltiff -ldeflate -LG:/MABS/msys64/mingw32/lib -lz -lzstd -ljpeg -lpng16 -lz -lzstd -ljpeg -lpng16 libwebp.a -lshlwapi -lole32 -lwindowscodecs -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
[4] https://cmake.org/cmake/help/v3.19/variable/CMAKE_LANG_STANDARD_LIBRARIES.html
[5].https://gitlab.kitware.com/cmake/cmake/-/merge_requests/1798

jz… via monorail

unread,
Dec 15, 2022, 8:50:19 PM12/15/22
to webp-d...@webmproject.org
Updates:
Mergedinto: 572
Status: Duplicate

Comment #2 on issue 557 by jz...@google.com: img2webp fails compilation in MSYS2/MinGW with GCC 11.2: undefined references to libtiff routines
https://bugs.chromium.org/p/webp/issues/detail?id=557#c2

I think this is referring to https://github.com/m-ab-s/media-autobuild_suite and that it could be considered a duplicate of #572.
Reply all
Reply to author
Forward
0 new messages