kea 1.9.7 configure fails on Fedora 34 with "error: thread (a C++11 feature) is not supported"
name: kea 1.9.7 configure fails on Fedora 34 with "error: thread (a C++11 feature) is not supported"
about: possible incompatibility with g++ 11.x
Describe the bug
When running ./configure
of kea 1.9.7 on Fedora Linux 34 the configure step fails with error message
checking lambda support... yes
checking thread support... no
configure: WARNING: unsupported C++11 feature
configure: retrying by adding --std=c++1x to g++ --std=c++0x
checking --std=c++1x support... no
configure: error: thread (a C++11 feature) is not supported
Fedora 34 has g++ 11.0.1
$ g++ --version
g++ (GCC) 11.0.1 20210324 (Red Hat 11.0.1-0)
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
It also fails with clang++
with the same error
clang version 12.0.0 (Fedora 12.0.0-0.3.rc1.fc34)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Root cause in config.log
configure:17026: checking thread support
configure:17042: g++ --std=c++0x -c -g -O2 conftest.cpp >&5
conftest.cpp:24:31: error: 'shared_ptr' in namespace 'std' does not name a template type
24 | std::shared_ptr<std::thread> th;
| ^~~~~~~~~~
conftest.cpp:24:1: note: 'std::shared_ptr' is defined in header '<memory>'; did you forget to '#include <memory>'?
23 | #include <thread>
24 | std::shared_ptr<std::thread> th;
conftest.cpp: In function 'int main()':
conftest.cpp:28:1: error: 'th' was not declared in this scope; did you mean 'tm'?
28 | th.reset(new std::thread([]() { return; }));
| ^~
| tm
configure:17042: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "kea"
| #define PACKAGE_TARNAME "kea"
| #define PACKAGE_VERSION "1.9.7"
| #define PACKAGE_STRING "kea 1.9.7"
| #define PACKAGE_BUGREPORT "kea-dev@lists.isc.org"
| #define PACKAGE_URL ""
| #define PACKAGE "kea"
| #define VERSION "1.9.7"
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_DLFCN_H 1
| #define LT_OBJDIR ".libs/"
| /* end confdefs.h. */
| #include <thread>
| std::shared_ptr<std::thread> th;
| int
| main ()
| {
| th.reset(new std::thread([]() { return; }));
| th->join();
| ;
| return 0;
| }
configure:17046: result: no
configure:16670: WARNING: unsupported C++11 feature
To Reproduce Steps to reproduce the behavior:
- Install Fedora Linux 34 (amd64)
- load and unpack kea 1.9.7
- change into source directory and run
./configure
- See error
Expected behavior
configure
script should run and configure the source
Environment:
- Kea version: 1.9.7
- OS: Fedora Linux 34 amd64
- default configure switches
Fix
This is a possible fix (aka "works for me")
From 91269d0be01e747b079663c1f240073dc6aa930e Mon Sep 17 00:00:00 2001
From: Carsten <cas@strotmann.de>
Date: Sat, 1 May 2021 09:21:36 +0200
Subject: [PATCH] Add memory include to automake template file
---
m4macros/ax_cpp11.m4 | 1 +
1 file changed, 1 insertion(+)
diff --git a/m4macros/ax_cpp11.m4 b/m4macros/ax_cpp11.m4
index f9042fa6d5..985bb685c0 100644
--- a/m4macros/ax_cpp11.m4
+++ b/m4macros/ax_cpp11.m4
@@ -182,6 +182,7 @@ for retry in "none" "--std=c++11" "--std=c++0x" "--std=c++1x" "fail"; do
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[#include <thread>
+ #include <memory>
std::shared_ptr<std::thread> th;],
[th.reset(new std::thread([[]]() { return; }));
th->join();])],
--
2.31.1