-
Notifications
You must be signed in to change notification settings - Fork 317
Description
I mainly compile libjxl using mingw64, and clang's lto seems to only work with the lld linker. However, sjpeg fails to link properly, meaning djxl, benchmark_xl, and jpegli all fail to compile by default. Only cjxl and jxlinfo can successfully compile.
JPEGXL_ENABLE_LTO works fine with gcc afaik.
A short-term solution would be to disable sjpeg but it would be nice to know why it fails. I've tried compiling sjpeg by itself with clang+lto and it also seems to fail as well, implying the issue is sjpeg's fault and not libjxl's. Is it a build system problem or something deeper?
This is my working LTO build command:
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DJPEGXL_STATIC=ON -DJPEGXL_ENABLE_LTO=ON -DJPEGXL_ENABLE_SJPEG=OFF -DCMAKE_C_FLAGS=-fuse-ld=lld -DCMAKE_CXX_FLAGS=-fuse-ld=lld -DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=lld .. && ninja
Using the command above, enabling sjpeg spits out this error:
ld.lld: error: undefined symbol: std::__once_callable
>>> referenced by C:/msys64/home/user/libjxl/third_party/sjpeg/src/enc.cc
>>> libsjpeg.a(enc.cc.obj)
OS: Windows, msys2-mingw64
Compiler: Clang 20.1.8