m-ab-s / media-autobuild_suite

This Windows Batchscript helps setup a Mingw-w64 compiler environment for building ffmpeg and other media tools under Windows.
GNU General Public License v3.0
1.49k stars 256 forks source link

libtiff: compiling/linking tiffgt fails, undefined references to FreeGLUT symbols #2681

Closed LigH-de closed 1 month ago

LigH-de commented 1 month ago
...
[120/125] Linking C executable tools\tiffgt.exe
FAILED: tools/tiffgt.exe 
C:\Windows\system32\cmd.exe /C "cd . && G:\MABS\msys64\mingw32\bin\ccache.exe  gcc -D_FORTIFY_SOURCE=2 -fstack-protector-strong -mtune=generic -O2 -pipe -D__USE_MINGW_ANSI_STDIO=1 -mthreads -DFREEGLUT_STATIC -Wall -Winline -Wformat-security -Wpointer-arith -Wdisabled-optimization -Wno-unknown-pragmas -fstrict-aliasing -O3 -DNDEBUG -D_FORTIFY_SOURCE=2 -fstack-protector-strong -mtune=generic -O2 -pipe -D__USE_MINGW_ANSI_STDIO=1 -static-libgcc -static-libstdc++ tools/CMakeFiles/tiffgt.dir/tiffgt.c.o -o tools\tiffgt.exe -Wl,--out-implib,tools\libtiffgt.dll.a -Wl,--major-image-version,0,--minor-image-version,0  libtiff/libtiff.a  -lopengl32  G:/MABS/local32/lib/libglut.a  G:/MABS/msys64/mingw32/lib/libz.a  G:/MABS/msys64/mingw32/lib/libdeflate.a  G:/MABS/msys64/mingw32/lib/libjpeg.a  G:/MABS/msys64/mingw32/lib/liblzma.a  G:/MABS/msys64/mingw32/lib/libzstd.a  G:/MABS/msys64/mingw32/lib/libm.a  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
G:/MABS/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/14.1.0/../../../../i686-w64-mingw32/bin/ld.exe: G:/MABS/local32/lib/libglut.a(fg_misc.c.obj):fg_misc.c:(.text+0x51): undefined reference to `_imp__glGetString@4'
G:/MABS/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/14.1.0/../../../../i686-w64-mingw32/bin/ld.exe: G:/MABS/local32/lib/libglut.a(fg_misc.c.obj):fg_misc.c:(.text+0xc4): undefined reference to `_imp__glGetError@0'
G:/MABS/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/14.1.0/../../../../i686-w64-mingw32/bin/ld.exe: G:/MABS/local32/lib/libglut.a(fg_window.c.obj):fg_window.c:(.text+0x199): undefined reference to `_imp__glDrawBuffer@4'
G:/MABS/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/14.1.0/../../../../i686-w64-mingw32/bin/ld.exe: G:/MABS/local32/lib/libglut.a(fg_window.c.obj):fg_window.c:(.text+0x1a9): undefined reference to `_imp__glReadBuffer@4'
...

https://gitlab.com/libtiff/libtiff/-/issues/637

logs.zip

LigH-de commented 1 month ago

Suggestion by @rouault

Looks like a CMake static linking issue with FreeGLUT. You can disable tiffgt for such build with cmake -Dtiff-opengl=OFF Or maybe manually set -DOPENGL_gl_LIBRARY to where the OpenGL library on your system is

Zordrak commented 1 month ago

Workaround for people who just need this to work today:

https://github.com/m-ab-s/media-autobuild_suite/blob/9e6d87f1e981d5365c7531d42f4ebe396e474727/build/media-suite_compile.sh#L489

from: do_cmakeinstall global -D{webp,jbig,lerc}=OFF "${extracommands[@]}" to: do_cmakeinstall global -D{webp,jbig,lerc,tiff-opengl}=OFF "${extracommands[@]}"

1480c1 commented 1 month ago

https://github.com/m-ab-s/media-autobuild_suite/commit/d25cdbc4ffd45e45722b6e68b15253c9a662a64e