-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
spdlog 1.12.0 is incompatible with fmt/ranges.h of libfmt 10.1.0 #2894
Comments
The link error is probably because you are using a pre-built spdlog instead of a header-only. |
Yes, I turn on I write a CmakeLists file with cpm to reproduce this problem, but I also tried to manually compile and install spdlog (whether cmake_minimum_required(VERSION 3.14...3.22)
project( testspdlog VERSION 1.0 LANGUAGES CXX)
include(./CPM.cmake)
CPMAddPackage(
NAME fmt
GIT_TAG 10.1.1 # 9.1.0 OK
GITHUB_REPOSITORY fmtlib/fmt
OPTIONS "FMT_INSTALL YES"
)
CPMAddPackage(
NAME spdlog
GIT_TAG v1.12.0
GITHUB_REPOSITORY gabime/spdlog
OPTIONS "SPDLOG_INSTALL YES
SPDLOG_FMT_EXTERNAL YES"
)
add_executable(${PROJECT_NAME} test.cpp)
target_link_libraries(${PROJECT_NAME} fmt::fmt spdlog::spdlog)
Also, it is fine to include only |
The package manager named conan seems to be able to build spdlog 1.12.0 with fmt 10.1.1.
I don't understand why a problem that does not occur in the package manager only occurs on your machine. |
Thank you for your reply. I tried Canon and successfully solved the problem. After checking my configuration more carefully, I found that the reason for the problem was that I used the Options option of CPMAddPackage incorrectly, which did not pass For the error in my native machine, it may also due to my compilation order, I’m not sure. But after I completely deleted For the sake of people who may encounter similar problems in the future, I leave my CMakeLists that successfully compiled with CPM: cmake_minimum_required(VERSION 3.14...3.22)
project( testspdlog VERSION 1.0 LANGUAGES CXX)
include(./CPM.cmake)
CPMAddPackage(
NAME fmt
GIT_TAG 10.1.1 # 9.1.0 OK
GITHUB_REPOSITORY fmtlib/fmt
OPTIONS "FMT_INSTALL YES"
)
CPMAddPackage(
NAME spdlog
GIT_TAG v1.12.0
GITHUB_REPOSITORY gabime/spdlog
OPTIONS "SPDLOG_INSTALL YES"
"SPDLOG_FMT_EXTERNAL YES"
)
add_dependencies(spdlog fmt)
add_executable(${PROJECT_NAME} test.cpp)
target_link_libraries(${PROJECT_NAME} fmt::fmt spdlog::spdlog)
|
I encountered the same problem |
I use spdlog 1.12.0 and libfmt 10.1.1 to compile the following code:
The error message is as follows:
If I swap the include order of spdlog.h and ranges.h, then I get the following link error:
The program can be compiled normally when using libfmt 9.1.0. Turning on
SPDLOG_FMT_EXTERNAL
does not help with the problem.gcc version: 11.1.0
cmake version: 3.16.3
The text was updated successfully, but these errors were encountered: