-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
How to use header only way #1511
Comments
If you are using spdlog with more than one library, make sure the version and build options match exactly. In addition, if you link the static library in the wrong order, a link error will occur. |
this time, I just want to try header files only. why still error in linking stage? or I should still link some sub-libs although no need of whole libspdlog.a? |
For link errors, Therefore, I determined that you linked multiple static libraries to your application and the build failed. Is this wrong? |
thank you very much. you are right that I also linked the static lib for libface.a in its makefile. Now it's ok and no coredump. Same whole project code that if i use static lib, it will crash. very strange. Just that the header file only almost double my exe size compared with static way. |
and I am very sure my project only links spdlog static lib once because of this HEADER file only check. |
in fact, initially I used header file only way and my code ran ok. Later I downloaded new version of spdlog and tried static way, then immediately crashed as reported. Now I use our old logging method and my code is running ok. I have some time now so trying to see how can I use spdlog's static method. |
it seems that signal function is happy with header file only mood. |
As noted above (#1511 (comment)), spdlog is not guaranteed to work with signal functions. This is a move based on the C++ standard. |
understood. I just feedback the difference btw header-only and static lib modes. |
(gabime#1511) Co-authored-by: Lalit Kumar Bhasin <labhas@microsoft.com>
I did not use -DSPDLOG_COMPILED_LIB, but include spdlog header files path.
I got these link error:
/fs02/home/thirdparty/spdlog2/include/spdlog/fmt/bundled/format.h:877: undefined reference to
fmt::v6::internal::assert_fail(char const*, int, char const*)' /fs02/home/jenkins/workspace/Rel-15-1-0_PROD/Rel-15-1-54_c++14/directfeeds/face/AS7/libface.a(FtSpdFileLog.o): In function
char* fmt::v6::internal::format_decimal<unsigned int, char, char* fmt::v6::internal::format_decimal<char, char*, unsigned int>(char*, unsigned int, int)::{lambda(char*)#1}>(char* fmt::v6::internal::format_decimal<char, char*, unsigned int>(char*, unsigned int, int)::{lambda(char*)#1}, unsigned int, int, char* fmt::v6::internal::format_decimal<char, char*, unsigned int>(char*, unsigned int, int)::{lambda(char*)#1})':/fs02/home/thirdparty/spdlog2/include/spdlog/fmt/bundled/format.h:843: undefined reference to
fmt::v6::internal::assert_fail(char const*, int, char const*)' /fs02/home/jenkins/workspace/Rel-15-1-0_PROD/Rel-15-1-54_c++14/directfeeds/face/AS7/libface.a(FtSpdFileLog.o): In function
endl(FtSpdlogDebugStream&)':/fs02/home/thirdparty/spdlog2/include/FtSpdlogStream.h:60: undefined reference to
spdlog::default_logger()' /fs02/home/jenkins/workspace/Rel-15-1-0_PROD/Rel-15-1-54_c++14/directfeeds/face/AS7/libface.a(FtSpdFileLog.o): In function
endl(FtSpdlogTraceStream&)':/fs02/home/thirdparty/spdlog2/include/FtSpdlogStream.h:40: undefined reference to
spdlog::default_logger()' /fs02/home/jenkins/workspace/Rel-15-1-0_PROD/Rel-15-1-54_c++14/directfeeds/face/AS7/libface.a(FtSpdFileLog.o): In function
endl(FtSpdlogCriticalStream&)':/fs02/home/thirdparty/spdlog2/include/FtSpdlogStream.h:142: undefined reference to
spdlog::default_logger()' /fs02/home/jenkins/workspace/Rel-15-1-0_PROD/Rel-15-1-54_c++14/directfeeds/face/AS7/libface.a(FtSpdFileLog.o): In function
endl(FtSpdlogErrorStream&)':/fs02/home/thirdparty/spdlog2/include/FtSpdlogStream.h:122: undefined reference to
spdlog::default_logger()' /fs02/home/jenkins/workspace/Rel-15-1-0_PROD/Rel-15-1-54_c++14/directfeeds/face/AS7/libface.a(FtSpdFileLog.o): In function
endl(FtSpdlogWarnStream&)':/fs02/home/thirdparty/spdlog2/include/FtSpdlogStream.h:101: undefined reference to
spdlog::default_logger()' /fs02/home/jenkins/workspace/Rel-15-1-0_PROD/Rel-15-1-54_c++14/directfeeds/face/AS7/libface.a(FtSpdFileLog.o):/fs02/home/thirdparty/spdlog2/include/FtSpdlogStream.h:81: more undefined references to
spdlog::default_logger()' follow/fs02/home/jenkins/workspace/Rel-15-1-0_PROD/Rel-15-1-54_c++14/directfeeds/face/AS7/libface.a(FtSpdFileLog.o): In function
fmt::v6::basic_format_context<std::back_insert_iterator<fmt::v6::internal::buffer<char> >, char>::on_error(char const*)': /fs02/home/thirdparty/spdlog2/include/spdlog/fmt/bundled/core.h:1169: undefined reference to
fmt::v6::internal::error_handler::on_error(char const*)'/fs02/home/jenkins/workspace/Rel-15-1-0_PROD/Rel-15-1-54_c++14/directfeeds/face/AS7/libface.a(FtSpdFileLog.o): In function
unsigned long long fmt::v6::internal::width_checker<fmt::v6::internal::error_handler>::operator()<float, 0>(float)': /fs02/home/thirdparty/spdlog2/include/spdlog/fmt/bundled/format.h:1988: undefined reference to
fmt::v6::internal::error_handler::on_error(char const*)'/fs02/home/jenkins/workspace/Rel-15-1-0_PROD/Rel-15-1-54_c++14/directfeeds/face/AS7/libface.a(FtSpdFileLog.o): In function
unsigned long long fmt::v6::internal::precision_checker<fmt::v6::internal::error_handler>::operator()<float, 0>(float)': /fs02/home/thirdparty/spdlog2/include/spdlog/fmt/bundled/format.h:2008: undefined reference to
fmt::v6::internal::error_handler::on_error(char const*)'/fs02/home/jenkins/workspace/Rel-15-1-0_PROD/Rel-15-1-54_c++14/directfeeds/face/AS7/libface.a(FtSpdFileLog.o): In function
std::make_unsigned<int>::type fmt::v6::internal::to_unsigned<int>(int)': /fs02/home/thirdparty/spdlog2/include/spdlog/fmt/bundled/core.h:266: undefined reference to
fmt::v6::internal::assert_fail(char const*, int, char const*)'collect2: error: ld returned 1 exit status
my program coredumps when use SPDLOG_COMPILED_LIB. I want to try header files only.
The text was updated successfully, but these errors were encountered: