-
Notifications
You must be signed in to change notification settings - Fork 309
Export fmt dependency in CMake config #3108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
has this been tested? I wouldn't expect it to be needed. |
Not yet, hence the draft still...
It is no different to other dependencies for static linkage?
|
|
Hmm. I was hoping that the CIFuzz would start working by itself after #2769 was merged. I can see from the build log that it is installing the |
|
Not it. Looks like Ubuntu doesn't ship static Edit: apart from MSYS2, looks like no distro is shipping the static lib (checked only major ones like Arch, Debian, Fedora)? In that case, this PR makes less sense indeed... |
Oh. So you think it's because of the |
|
OSS-Fuzz is using Ubuntu 20.04, so maybe that's part of the issue. |
True that...
Very likely, it ships an ancient version 6.1.2... |
|
Is there a cmake flag that will tell OSS-Fuzz to build without fmt? That might be the simplest solution. It's already building without the libinih library due to a similar issue. |
|
Not optional - it's either libfmt (we didn't check the minimum version? @neheb) or C++20 features in more recent libstdc++/libc++, but not without either option. Might be time to bump requirements on main... |
|
Is there a flag to build with C++20? I could try that: I expect they offer that latest compiler versions on OSS-Fuzz even though they're on an old version of Ubuntu. |
Looks like we might be in luck, it is indeed Clang 18... You can use the same flag we use for Cygwin builds (no libfmt there):
|
14b05f0 to
cbf4157
Compare
|
Is libfmt 6 not working? |
|
Apparently not linking for some reason w/ |
|
The C++20 idea didn't work: kevinbackhouse/oss-fuzz#12 But I just tried building in a ubuntu:focal docker container and it works fine (with or without the C++20 flag). I'm building with clang-18. So it must be something else about the OSS-Fuzz environment. |
tested ubuntu 20.04 with libfmt and clang++-10. works fine. exiv2 is not using special functionality in fmt. Just the std::format compatible stuff. |
That...is a bug that needs fixing. |
|
@kevinbackhouse does this addition in src/pgfimage.cpp work? |
|
@neheb: that |
|
I'll test in #2645 to see if CI can reproduce. It's most likely a missing bit header. |
Yes, this solves the I guess it might be worth making this change anyway though? |
|
OK soo: Ubuntu-20.04 does not come with the format header, so the check fails and fmt gets used. It uses the libc++ from gcc9. 13 introduces format. libfmt gets found and used. But LD errors with I think I've seen this but don't remember where. Since oss-fuzz uses clang-18, would it be possible to also use lld-18? edit: oooohhh that's exactly how I saw it. clang compiler with gcc's libc++ when I was testing meson CI. |
There you install explicitly LLVM's libc++: exiv2/.github/workflows/on_PR_meson.yaml Line 44 in 8545614
Maybe that's the missing piece? |
|
No, that's unrelated. |
|
Also found this chestnut:
|
cbf4157 to
4dae7f2
Compare
|
Unfortunate. Looks like the check needs to be adjusted. |
|
anyway, CIFuzz failure. Some research led me to: google/oss-fuzz#11698 theory: libfmt is static, while everything else is shared, causing the error. But then again I don't think that means cmake will use static versions of its dependencies. I wonder if the issue is double linking. Anyway, lld will definitely work. |
|
I tried modifying the build to use Do you think it's worth trying to build with meson rather than cmake, since you've already got that working on Ubuntu 20.04? Is there a way to build the fuzz build target with meson? |
That error looks like missing -lfmt in the linker flags for exiv2_int Tests are generally speaking unimplemented in meson. I have a WIP commit that doesn’t fully work. Problem is the tests require making modifications to the source directory, not the build one from what I remember. Fuzz target also needs implementing. |
One would've thought this should do it: Line 256 in 99c307f
|
|
CMAKE_VERBOSE_MAKEFILE would confirm that. if I had to guess it’s some fmt cmake bug. It would be nice to convert fully to meson since it works properly, but extra code is needed to get the tests and fuzzing working. edit: I wonder if that lld on that run is lld-18 or older. |
|
I added |
|
I've started a discussion on the OSS-Fuzz repo to ask for help: google/oss-fuzz#12934 |
|
Meanwhile, we'll have to ignore the CIFuzz failures. Would you like to merge this PR? |
I still think so... |
|
OK I just accidentally hit this in a different project. My error was having in CXXFLAGS. edit: If OSS-Fuzz mandates llvm libc++, then fmt must absolutely be built as a subproject. |
|
Ah, so that's maybe why I've seen a few projects vendor libmft... In any case, I guess the options are:
|
No description provided.