Fix issue #236: drop FMT_STRING wrappers in ColourSpace example#237
Conversation
|
It's needed for any compilation using C++17 or older, which includes my build environment. |
|
Interesting. I tried a bunch of compiler/OS/fmt/spdlog versions yesterday and couldn't make it fail without it, so please send the exact setup and I'll make sure that's tested and we'll add checks for it. |
|
This is building the examples inside our Baselight makefile-based build, not using cmake or other build systems. |
|
Specifically, gcc 11.5, fmt{} 11.1.4, |
|
Here's what I ran into: With g++ 14.2.1, compiling either C++17 or C++20, using spdlog 1.5.1 or 1.7.0, with either the embedded fmt version or the corresponding, external fmt, the compiler rejects calls to RIght now I'm having to override FMT_STRING(): but of course the compiler complains. We could either try to figure out the specific compiler versions which have issues with this and #ifdef appropriately, or use our own OFX_FMT_STRING() macro so it can be easily #ifdef'd away without having to re-define the existing one? |
|
Thanks for these notes, folks — I'll look into this and come up with a proper fix. |
…COMPILE_STRING Some downstream projects (e.g. Baselight) opt in to fmt's strict compile-string check via -DFMT_ENFORCE_COMPILE_STRING. In C++17 that flag rejects any format string that isn't wrapped in FMT_STRING, which broke the unwrapped calls from AcademySoftwareFoundation#237. At the same time, wrapping zero-arg spdlog calls in FMT_STRING was what triggered the original failure in AcademySoftwareFoundation#236 (old spdlog's SFINAE couldn't handle the compile-time type when there were no placeholders). The wrapper expands to FMT_STRING only when the fmt strict flag is set *and* fmt itself can't consteval-check (so C++20+ and modern fmt just get plain strings). It's only applied at callsites that pass format args; zero-arg spdlog::info("msg") takes a string_view overload that bypasses fmt's format_string machinery entirely, so those sites are left alone and AcademySoftwareFoundation#236's failure pattern stays avoided. Also adds a Makefile for ColourSpace (was missing; not in Examples SUBDIRS either) and a CI matrix entry "Linux Rocky 8 VFX CY2023 strict fmt" that builds with -DFMT_ENFORCE_COMPILE_STRING, so any future example that adopts spdlog without OFX_FMT_STRING trips the build. The new entry sets skip_release_upload so it doesn't produce extra release artifacts. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
jfpanisset
left a comment
There was a problem hiding this comment.
Looks like you actually went to the bottom of this!
BTW I'm about to release updated aswf-docker images, including an update to the 2023 images (which had not been updated in a long time since the transition of 2024/25/26 to Conan 2), I've verified that it builds against OpenFX 1.5s, but not latest. Will be good to test.
|
Yeah, took a few tries (Claude helps a lot with this, spinning up containers, trying things quickly). But I think this is a complete solution. I wish that macro weren't needed at all, but for older compilers/fmt versions it looks like it is. |
…ColourSpace example Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
…COMPILE_STRING Some downstream projects (e.g. Baselight) opt in to fmt's strict compile-string check via -DFMT_ENFORCE_COMPILE_STRING. In C++17 that flag rejects any format string that isn't wrapped in FMT_STRING, which broke the unwrapped calls from AcademySoftwareFoundation#237. At the same time, wrapping zero-arg spdlog calls in FMT_STRING was what triggered the original failure in AcademySoftwareFoundation#236 (old spdlog's SFINAE couldn't handle the compile-time type when there were no placeholders). The wrapper expands to FMT_STRING only when the fmt strict flag is set *and* fmt itself can't consteval-check (so C++20+ and modern fmt just get plain strings). It's only applied at callsites that pass format args; zero-arg spdlog::info("msg") takes a string_view overload that bypasses fmt's format_string machinery entirely, so those sites are left alone and AcademySoftwareFoundation#236's failure pattern stays avoided. Also adds a Makefile for ColourSpace (was missing; not in Examples SUBDIRS either) and a CI matrix entry "Linux Rocky 8 VFX CY2023 strict fmt" that builds with -DFMT_ENFORCE_COMPILE_STRING, so any future example that adopts spdlog without OFX_FMT_STRING trips the build. The new entry sets skip_release_upload so it doesn't produce extra release artifacts. Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
884eb45 to
b350155
Compare
spdlog since around 1.8 doesn't need FMT_STRING anymore, and it may cause type errors when used on plain strings with no format specs.