quill icon indicating copy to clipboard operation
quill copied to clipboard

Quill built with QUILL_FMT_EXTERNAL fails to find system Fmt includes

Open alebcay opened this issue 2 years ago • 2 comments

Hello, I encountered this issue in trying to package Quill for the Homebrew package manager. Right now we build Quill and use its bundled Fmt. Ideally we would use system/external Fmt, to reduce duplication of dependencies and make updating dependencies easier.

When building Quill with the QUILL_FMT_EXTERNAL option, the build and install succeeds. I see that the bundled Fmt is not installed. However, trying to include Quill headers results in:

In file included from /usr/local/Cellar/quill/1.6.3/include/quill/Logger.h:8:
/usr/local/Cellar/quill/1.6.3/include/quill/Fmt.h:20:12: fatal error: 'quill/bundled/fmt/chrono.h' file not found
  #include "quill/bundled/fmt/chrono.h"
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

The issue is that when building with QUILL_FMT_EXTERNAL, Fmt headers are located somewhere else. But the Quill headers still expect Fmt to be present in the bundled location. A workaround for now that worked for me is to symlink the Fmt headers folder into the bundled location, but for distributing via package manager, this is not ideal.

alebcay avatar Sep 02 '21 19:09 alebcay

Hello, thanks for reporting and for packing the new version :)

Looking into this, after installing Quill you still should pass the flag into your project.

e.g as a compiler flag -DQUILL_FMT_EXTERNAL or before including quill.h

#define QUILL_FMT_EXTERNAL
#include "Quill.h"

Do you mean that for a package manager that is not an ideal solution and would like something where quill is aware the bundled one is missing without the additional flag ?

odygrd avatar Sep 09 '21 14:09 odygrd

Ah, I see, that makes more sense.

Yes, I think that would be helpful from a packaging perspective, if it's something that you'd be comfortable including. To me it seems that the choice of bundled vs external fmt is something that happens at configure + build time (and should be remembered), rather than counting on consumers to remember.

I could also see it being confusing for other projects that depend on Quill, as they also now need to check if the Quill being used has internal vs external Fmt and the compiler flag needs to be set. One option is to preprocess Logger.h (and other headers) to point to the desired location at configure/build time (in my opinion, the most foolproof way) or another option is to conditionally modify the pkg-config file with the flag at configure/build-time.

alebcay avatar Sep 09 '21 18:09 alebcay