Skip to content
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

FMT issues #1634

Closed
sab24 opened this issue Jul 25, 2020 · 2 comments
Closed

FMT issues #1634

sab24 opened this issue Jul 25, 2020 · 2 comments

Comments

@sab24
Copy link

sab24 commented Jul 25, 2020

Hi, I'm trying to evaluate whether to use spdlog in my project, but so far it has only complicated the workflow and not provided the intended benefits of a logging library. Including this project gives strange errors. I saw in the git history that {fmt} has updated their namespaces, but I still have a lot of errors in spdlog/fmt/bundled/format.h:

/home/cross/include/spdlog/fmt/bundled/format.h:308:30: error: use of undeclared identifier 'void_t'                                                                                 
struct iterator_category<It, void_t<typename It::iterator_category>> {                                                                                                               
                             ^                                                                                                                                                       
/home/cross/include/spdlog/fmt/bundled/format.h:503:51: error: unknown type name 'char8_type'; did you mean 'detail::char8_type'?                                                    
inline size_t count_code_points(basic_string_view<char8_type> s) {                                                                                                                   
                                                  ^~~~~~~~~~                                                                                                                         
                                                  detail::char8_type                                                                                                                 
/home/cross/include/fmt/core.h:328:7: note: 'detail::char8_type' declared here                                                                                                       
using char8_type = char8_t;                                                                                                                                                          
      ^                                                                                                                                                                              
                                                                                                            
In file included from /home/cross/include/spdlog/spdlog.h:12:                                                                                                                        
In file included from /home/cross/include/spdlog/common.h:36:                                                                                                                        
In file included from /home/cross/include/spdlog/fmt/fmt.h:21:                                                                                                                       
/home/cross/include/spdlog/fmt/bundled/format.h:515:50: error: unknown type name 'char8_type'; did you mean 'detail::char8_type'?                                                    
inline size_t code_point_index(basic_string_view<char8_type> s, size_t n) {                                                                                                          
                                                 ^~~~~~~~~~                                                                                                                          
                                                 detail::char8_type                                                                                                                  
/home/cross/include/fmt/core.h:328:7: note: 'detail::char8_type' declared here                                                                                                       
using char8_type = char8_t;                                                                                                                                                          
      ^                                                                                                                                                                              
                                                                                                              
In file included from /home/cross/include/spdlog/spdlog.h:12:                                                                                                                        
In file included from /home/cross/include/spdlog/common.h:36:                                                                                                                        
In file included from /home/cross/include/spdlog/fmt/fmt.h:21:                                                                                                                       
/home/cross/include/spdlog/fmt/bundled/format.h:516:9: error: unknown type name 'char8_type'; did you mean 'detail::char8_type'?                                                     
  const char8_type* data = s.data();                                                                                                                                                 
        ^~~~~~~~~~                                                                                                                                                                   
        detail::char8_type                                                                                                                                                           
/home/cross/include/fmt/core.h:328:7: note: 'detail::char8_type' declared here                                                                                                       
using char8_type = char8_t;                                                                                                                                                          
      ^                                                                                                                                                                              
                                                                                                             
In file included from /home/cross/include/spdlog/spdlog.h:12:                                                                                                                        
In file included from /home/cross/include/spdlog/common.h:36:                                                                                                                        
In file included from /home/cross/include/spdlog/fmt/fmt.h:21:                                                                                                                       
/home/cross/include/spdlog/fmt/bundled/format.h:526:8: error: unknown type name 'char8_type'; did you mean 'detail::char8_type'?                                                     
inline char8_type to_char8_t(char c) { return static_cast<char8_type>(c); }                                                                                                          
       ^~~~~~~~~~                                                                                                                                                                    
       detail::char8_type                                                                                                                                                            
/home/cross/include/fmt/core.h:328:7: note: 'detail::char8_type' declared here
using char8_type = char8_t;

In file included from /home/cross/include/spdlog/spdlog.h:12:
In file included from /home/cross/include/spdlog/common.h:36:
In file included from /home/cross/include/spdlog/fmt/fmt.h:21:
/home/cross/include/spdlog/fmt/bundled/format.h:526:59: error: unknown type name 'char8_type'; did you mean 'detail::char8_type'?
inline char8_type to_char8_t(char c) { return static_cast<char8_type>(c); }

@sab24
Copy link
Author

sab24 commented Jul 25, 2020

Made it compile by replacing the core.h format.h and format-inl.h files from fmt library head

@tt4g
Copy link
Contributor

tt4g commented Jul 25, 2020

This refers to the fmt library header, which is not bundled with spdlog: /home/cross/include/fmt/core.h:328:7: note: 'detail::char8_type' declared here

When using external fmt with spdlog, you have to define and build the CMake variable SPDLOG_FMT_EXTERNAL.
If use header-only fmt, define SPDLOG_FMT_EXTERNAL_HO instead of SPDLOG_FMT_EXTERNAL.

spdlog/CMakeLists.txt

Lines 86 to 92 in 616caa5

option(SPDLOG_FMT_EXTERNAL "Use external fmt library instead of bundled" OFF)
option(SPDLOG_FMT_EXTERNAL_HO "Use external fmt header-only library instead of bundled" OFF)
option(SPDLOG_NO_EXCEPTIONS "Compile with -fno-exceptions. Call abort() on any spdlog exceptions" OFF)
if(SPDLOG_FMT_EXTERNAL AND SPDLOG_FMT_EXTERNAL_HO)
message(FATAL_ERROR "SPDLOG_FMT_EXTERNAL and SPDLOG_FMT_EXTERNAL_HO are mutually exclusive")
endif()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants