tahoma2d / tahoma2d

2D and Stop Motion Animation Software
https://tahoma2d.org
Other
329 stars 59 forks source link

Build fails on Manjaro/Arch (and other systems using OpenCV with OpenEXR 3.2+) if libdeflate isn't explicitly linked #1248

Closed Razzaline closed 2 weeks ago

Razzaline commented 9 months ago

Bug Description

When I compile Tahoma2D, following the Linux build instructions either as is or with a modified PKGBUILD, it always stops around 62% after it says it finished building something, e.g. toonzqt or tnzstdfx, with the error make: *** [Makefile:136: all] Error 2. If I try compiling again a few times, somehow it seems to get past that part and I can even get to 100% (after it says it finished building the Tahoma2D executable) but still have this error. Adding LANG=C and VERBOSE=1 doesn't give any more helpful/meaningful output.

This has been a problem since around August or September, and I don't know what changed.

Edit: Possibly something to do with openexr updating from 3.1.11 to 3.2.0 and installing libdeflate as a dependency (has a linker error, usually further up around 42% or 43%, about undefined references in libimage to libdeflate).

Steps to reproduce

  1. Start building from command line, following instructions
  2. Error occurs

Relevant logs/screenshots

/usr/bin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `libdeflate_free_decompressor'
/usr/bin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `libdeflate_alloc_compressor'
/usr/bin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `libdeflate_zlib_decompress'
/usr/bin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `libdeflate_zlib_compress_bound'
/usr/bin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `libdeflate_zlib_compress'
/usr/bin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `libdeflate_free_compressor'
/usr/bin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `libdeflate_alloc_decompressor'
collect2: error: ld returned 1 exit status

Software Version

Other (Specify below)

Software Version Information

Commit 919d53815 (or whichever is latest at the time, since I try again with each commit)

Operating System

Manjaro with Linux kernel 6.5.7

Graphics Card

No response

Drawing Tablet

No response

manongjohn commented 9 months ago

Can you copy/paste the output of the build into a file and add it to this issue so i can see the real compile error which should have been thrown somewhere before it stopped?

Razzaline commented 9 months ago

All I saw leading up to the Makefile error was warnings, not build errors, but here's the entire log. log_1.txt

Razzaline commented 9 months ago

Oh, also, OpenToonz has been building fine without any of these errors. It's just Tahoma2D that's having this trouble.

manongjohn commented 9 months ago

From the log:

/usr/bin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `libdeflate_free_decompressor'
/usr/bin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `libdeflate_alloc_compressor'
/usr/bin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `libdeflate_zlib_decompress'
/usr/bin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `libdeflate_zlib_compress_bound'
/usr/bin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `libdeflate_zlib_compress'
/usr/bin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `libdeflate_free_compressor'
/usr/bin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `libdeflate_alloc_decompressor'
collect2: error: ld returned 1 exit status
Razzaline commented 9 months ago

Sometimes I could find that error (usually at the end), but other times it got lost in all the other output so I wasn't sure if it was consistent. But when I tried downgrading libdeflate from 1.19 to 1.18 (that was the only change I could think of on my system in the time that it stopped compiling) that seemingly went away but the makefile error was still there.

Razzaline commented 9 months ago

Nevermind, the error is still there even if I downgrade the version (after deleting the build directory and trying again) >.<

Razzaline commented 9 months ago

It seems like libdeflate was installed as a dependency for openexr at the beginning of September when openexr updated from 3.1.11 to 3.2.0. Maybe the linking process is conflicting with libdeflate being installed in the system?

manongjohn commented 9 months ago

What is openexr a dependency of? You must be using a newer library of something that is requiring openexr and therefore libdeflate than what I normally build on Ubunutu 20.04 with since those libraries are not in the current builds as far as I can tell.

As for why it can't find libdeflate? Maybe add the location of the libarary to the library path? May need to add -ldeflate to the CMAKE_CXX_FLAGS based on some discussions I found regarding libdeflate linking issues.

Razzaline commented 9 months ago

Openexr is mostly a dependency for graphics programs on my system. Here's the full list:

blender
freeimage
gegl
gimp
gst-plugins-bad
krita
libjxl
opencolorio
opencv
openimageio
synfig

It seems to be finding libdeflate just fine, since it's detected in the configure step. If I downgrade openexr and remove libdeflate then it stops in the configure process because it can't find it, so that doesn't seem to be the problem.

How would I add -ldeflate to the flags?

manongjohn commented 9 months ago

What version of opencv are you using? Does that require openexr? Did you install that for T2D or was that already there?

You can edit the toonz\sources\CMakeLists.txt. There is a section for CMAKE_C_FLAGS and CMAKE_CXX_FLAGS for Linux builds. Might also be able to add it as an environment variable which would add it.

Razzaline commented 9 months ago

I'm using opencv 4.8.1, and it does require openexr. Both of them were already installed for other things long before Tahoma2D, but I wouldn't be sure what in particular (probably one of the graphics programs I mentioned). I found Tahoma2D more recently (maybe a year ago), so I wouldn't have installed openexr specifically for Tahoma2D.

Okay, explicitly linking libdeflate seems to have fixed it!

FabioLolix commented 6 months ago

Hello, I'm the maintainer of the AUR pkgbuilds of tahoma2d and tahoma2d-git, in addition to the libdeflate problem I have an issue with libwebp

With libwebp I have that problem since earlier this year, v is 1.3.2, its build option can be seen here https://gitlab.archlinux.org/archlinux/packaging/packages/libwebp/-/blob/main/PKGBUILD?ref_type=heads

[ 47%] Building CXX object toonzqt/CMakeFiles/toonzqt.dir/spectrumfield.cpp.o
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `WebPIAppend'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `WebPEncode'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `libdeflate_free_decompressor'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `WebPIDecGetRGB'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `libdeflate_alloc_compressor'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `libdeflate_zlib_decompress'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `WebPIDelete'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `WebPInitDecBufferInternal'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `WebPPictureImportRGBA'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `WebPPictureFree'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `WebPConfigInitInternal'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `libdeflate_zlib_compress_bound'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `libdeflate_zlib_compress'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `WebPINewDecoder'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `WebPFreeDecBuffer'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `WebPPictureInitInternal'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `WebPPictureImportRGB'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `libdeflate_free_compressor'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `libdeflate_alloc_decompressor'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `WebPValidateConfig'
collect2: error: ld returned 1 exit status
make[2]: *** [tcleanupper/CMakeFiles/tdcleanup.dir/build.make:120: bin/tdcleanup] Error 1
make[1]: *** [CMakeFiles/Makefile2:843: tcleanupper/CMakeFiles/tdcleanup.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 47%] Building CXX object toonzqt/CMakeFiles/toonzqt.dir/spreadsheetviewer.cpp.o
At global scope:
cc1plus: note: unrecognized command-line option '-Wno-#warnings' may have been intended to silence earlier diagnostics
[ 47%] Building CXX object stdfx/CMakeFiles/tnzstdfx.dir/ino_blend_hard_light.cpp.o
[ 47%] Building CXX object stdfx/CMakeFiles/tnzstdfx.dir/ino_blend_hard_mix.cpp.o
[ 47%] Building CXX object toonzqt/CMakeFiles/toonzqt.dir/strokesdata.cpp.o
[ 47%] Building CXX object toonzqt/CMakeFiles/toonzqt.dir/studiopaletteviewer.cpp.o
[ 47%] Building CXX object stdfx/CMakeFiles/tnzstdfx.dir/ino_blend_lighten.cpp.o
[ 47%] Building CXX object stdfx/CMakeFiles/tnzstdfx.dir/ino_blend_lighter_color.cpp.o
[ 47%] Building CXX object toonzqt/CMakeFiles/toonzqt.dir/styleeditor.cpp.o
[ 48%] Building CXX object stdfx/CMakeFiles/tnzstdfx.dir/ino_blend_linear_burn.cpp.o
[ 48%] Building CXX object stdfx/CMakeFiles/tnzstdfx.dir/ino_blend_linear_dodge.cpp.o
[ 48%] Building CXX object stdfx/CMakeFiles/tnzstdfx.dir/ino_blend_linear_light.cpp.o
[ 48%] Building CXX object toonzqt/CMakeFiles/toonzqt.dir/styleindexlineedit.cpp.o
[ 48%] Building CXX object stdfx/CMakeFiles/tnzstdfx.dir/ino_blend_multiply.cpp.o
[ 48%] Building CXX object stdfx/CMakeFiles/tnzstdfx.dir/ino_blend_over.cpp.o
[ 48%] Building CXX object toonzqt/CMakeFiles/toonzqt.dir/swatchviewer.cpp.o
[ 49%] Linking CXX executable ../bin/tdconverter
[ 49%] Building CXX object stdfx/CMakeFiles/tnzstdfx.dir/ino_blend_overlay.cpp.o
[ 49%] Building CXX object stdfx/CMakeFiles/tnzstdfx.dir/ino_blend_pin_light.cpp.o
[ 50%] Building CXX object toonzqt/CMakeFiles/toonzqt.dir/tabbar.cpp.o
[ 50%] Building CXX object stdfx/CMakeFiles/tnzstdfx.dir/ino_blend_screen.cpp.o
[ 50%] Building CXX object toonzqt/CMakeFiles/toonzqt.dir/tdockwindows.cpp.o
[ 50%] Building CXX object stdfx/CMakeFiles/tnzstdfx.dir/ino_blend_soft_light.cpp.o
[ 50%] Building CXX object stdfx/CMakeFiles/tnzstdfx.dir/ino_blend_subtract.cpp.o
[ 50%] Building CXX object toonzqt/CMakeFiles/toonzqt.dir/tonecurvefield.cpp.o
[ 50%] Building CXX object toonzqt/CMakeFiles/toonzqt.dir/treemodel.cpp.o
[ 50%] Building CXX object toonzqt/CMakeFiles/toonzqt.dir/tselectionhandle.cpp.o
[ 50%] Building CXX object stdfx/CMakeFiles/tnzstdfx.dir/ino_blend_vivid_light.cpp.o
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `WebPIAppend'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `WebPEncode'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `libdeflate_free_decompressor'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `WebPIDecGetRGB'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `libdeflate_alloc_compressor'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `libdeflate_zlib_decompress'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `WebPIDelete'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `WebPInitDecBufferInternal'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `WebPPictureImportRGBA'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `WebPPictureFree'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `WebPConfigInitInternal'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `libdeflate_zlib_compress_bound'
[ 50%] Building CXX object stdfx/CMakeFiles/tnzstdfx.dir/ino_blur.cpp.o
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `libdeflate_zlib_compress'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `WebPINewDecoder'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `WebPFreeDecBuffer'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `WebPPictureInitInternal'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `WebPPictureImportRGB'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `libdeflate_free_compressor'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `libdeflate_alloc_decompressor'
/usr/sbin/ld: ../lib/tahoma2d/libimage.so: undefined reference to `WebPValidateConfig'
collect2: error: ld returned 1 exit status
make[2]: *** [tconverter/CMakeFiles/tdconverter.dir/build.make:119: bin/tdconverter] Error 1
make[1]: *** [CMakeFiles/Makefile2:908: tconverter/CMakeFiles/tdconverter.dir/all] Error 2
[ 50%] Building CXX object stdfx/CMakeFiles/tnzstdfx.dir/ino_channel_selector.cpp.o
[ 50%] Building CXX object stdfx/CMakeFiles/tnzstdfx.dir/ino_common.cpp.o

Any more info I can provide?

manongjohn commented 6 months ago

@FabioLolix This is likely a similiar situation as the libdeflate issue. If you are not compiling OpenCV as part of the build process, that is likely the reason for this.

As part of OpenCV building for T2D, I compile with the following options:

cmake -DCMAKE_BUILD_TYPE=Release \
      -DBUILD_JASPER=OFF \
      -DBUILD_JPEG=OFF \
      -DBUILD_OPENEXR=OFF \
      -DBUILD_PERF_TESTS=OFF \
      -DBUILD_PNG=OFF \
      -DBUILD_PROTOBUF=OFF \
      -DBUILD_TESTS=OFF \
      -DBUILD_TIFF=OFF \
      -DBUILD_WEBP=OFF \
      -DBUILD_ZLIB=OFF \
      -DBUILD_opencv_hdf=OFF \
      -DBUILD_opencv_java=OFF \
      -DBUILD_opencv_text=ON \
      -DOPENCV_ENABLE_NONFREE=ON \
      -DOPENCV_GENERATE_PKGCONFIG=ON \
      -DPROTOBUF_UPDATE_FILES=ON \
      -DWITH_1394=OFF \
      -DWITH_CUDA=OFF \
      -DWITH_EIGEN=ON \
      -DWITH_FFMPEG=ON \
      -DWITH_GPHOTO2=OFF \
      -DWITH_GSTREAMER=ON \
      -DWITH_JASPER=OFF \
      -DWITH_OPENEXR=ON \
      -DWITH_OPENGL=OFF \
      -DWITH_QT=OFF \
      -DWITH_TBB=ON \
      -DWITH_VTK=ON \
      -DBUILD_opencv_python2=OFF \
      -DBUILD_opencv_python3=ON 

I build OpenCV, in part to ensure LGPL compliance when packaging, and also to avoid the compile errors.