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

Fails to build with gcc 5.4.0 in C++14 mode #2816

Open
reddwarf69 opened this issue Jul 14, 2023 · 1 comment
Open

Fails to build with gcc 5.4.0 in C++14 mode #2816

reddwarf69 opened this issue Jul 14, 2023 · 1 comment

Comments

@reddwarf69
Copy link
Contributor

When trying to build spdlog 1.12.0 with gcc 5.4.0 in C++14, we get

bash-5.2# cmake -B build -DSPDLOG_BUILD_BENCH=OFF -DSPDLOG_BUILD_EXAMPLE=OFF -DSPDLOG_BUILD_TESTS=OFF -DCMAKE_CXX_STANDARD=14 -DCMAKE_CXX_COMPILER=<path_to_gcc_54>
-- The CXX compiler identification is GNU 5.4.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: <path_to_gcc_54> - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Build spdlog: 1.12.0
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Build type: Release
-- Generating install
-- Configuring done (0.6s)
-- Generating done (0.0s)
-- Build files have been written to: /spdlog-1.12.0/build
bash-5.2# cmake --build build 
[ 12%] Building CXX object CMakeFiles/spdlog.dir/src/spdlog.cpp.o
In file included from /spdlog-1.12.0/include/spdlog/spdlog.h:12:0,
                 from /spdlog-1.12.0/include/spdlog/spdlog-inl.h:7,
                 from /spdlog-1.12.0/src/spdlog.cpp:8:
/spdlog-1.12.0/include/spdlog/common.h: In function 'constexpr spdlog::string_view_t spdlog::details::to_string_view(const memory_buf_t&)':
/spdlog-1.12.0/include/spdlog/common.h:351:42: error: call to non-constexpr function 'const T* fmt::v9::detail::buffer<T>::data() const [with T = char]'
     return spdlog::string_view_t{buf.data(), buf.size()};
                                          ^
gmake[2]: *** [CMakeFiles/spdlog.dir/build.make:76: CMakeFiles/spdlog.dir/src/spdlog.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/spdlog.dir/all] Error 2
gmake: *** [Makefile:156: all] Error 2
bash-5.2#

The problem being that fmt only defines FMT_CONSTEXPR in gcc 6+ (https://github.com/gabime/spdlog/blob/v1.12.0/include/spdlog/fmt/bundled/core.h#L95) while spdlog just does a C++14 support check (https://github.com/gabime/spdlog/blob/v1.12.0/include/spdlog/common.h#L71).

Given https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67371, and spdlog using fmt functions supposedly affected by it, I guess spdlog should do the same check?

@tt4g
Copy link
Contributor

tt4g commented Jul 14, 2023

If you can fix that, you should send a PR.

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

2 participants