clickhouse-cpp/2.5.1 Conan package fails to build with GCC 11
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 55/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 冷清
- 技术栈
- cpp
调研方向
使用最小的 conanfile.py 和报告中的 conan install 命令重现该故障,然后检查 src/clickhouse/types/types.cpp 第 164 行附近以及 src/clickhouse/columns/lowcardinality.cpp 第 344 行附近。完成标准是 clickhouse-cpp/2.5.1 能够在 GCC 11、C++20 和 -Werror 下成功构建,且不出现报告中的两条诊断信息。
由索引模型根据 Issue 内容生成。
描述
Summary
After the recent ConanCenter update of the clickhouse-cpp/2.5.1 recipe (as shown on the ConanCenter page, last updated 2025‑11‑17), building clickhouse-cpp/2.5.1 from source via Conan fails with GCC 11 and C++20.
The main error is:
- use of std::memory_order::memory_order_relaxed instead of std::memory_order_relaxed in types.cpp
Additionally, there is another build failure due to a deprecated enum‑enum bitwise operation being treated as an error (-Werror).
Downgrading to clickhouse-cpp/2.5.0 makes the issue disappear, so this seems to be a regression in the 2.5.1 Conan recipe / sources.
———
Environment
- OS: Linux x86_64
- Compiler: GCC 11
- C++ standard: gnu20 (profile compiler.cppstd=gnu20)
- Conan client: 2.x (using conancenter remote)
- Package: clickhouse-cpp/2.5.1 from ConanCenter
- Consumer project uses:
- conanfile.py with self.requires("clickhouse-cpp/2.5.1")
- Profile sets compiler.libcxx=libstdc++11, build_type=Release
———
Conan profile (relevant parts)
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.version=11
compiler.cppstd=gnu20
compiler.libcxx=libstdc++11
os=Linux
———
Steps to reproduce
-
Create a minimal conanfile.py:
from conan import ConanFile
class TestClickhouseCpp(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "CMakeDeps", "CMakeToolchain"def requirements(self): self.requires("clickhouse-cpp/2.5.1") -
Run:
conan install . --output-folder=build/conan_files --build=missing
-
Let Conan download and build clickhouse-cpp/2.5.1 from ConanCenter.
———
Actual behavior
The build fails in the clickhouse-cpp sources.
Key errors (paths are Conan’s build folder):
/home//.conan2/p/b/click6c1a182889a69/b/src/clickhouse/types/types.cpp: In member function ‘uint64_t clickhouse::Type::GetTypeUniqueId() const’: /home//.conan2/p/b/click6c1a182889a69/b/src/clickhouse/types/types.cpp:164:57: error: ‘memory_order_relaxed’ is not a member of ‘std::memory_order’ 164 | if (type_unique_id_.load(std::memory_order::memory_order_relaxed) == 0) { | ^~~~~~~~~~~~~~~~~~~~ /home//.conan2/p/b/click6c1a182889a69/b/src/clickhouse/types/types.cpp:166:112: error: ‘memory_order_relaxed’ is not a member of ‘std::memory_order’ 166 | type_unique_id_.store(CityHash64WithSeed(name.c_str(), name.size(), code_), std::memory_order::memory_order_relaxed); | ^~~~~~~~~~~~~~~~~~~~
From the same build, another error:
/home//.conan2/p/b/click6c1a182889a69/b/src/clickhouse/columns/lowcardinality.cpp: In member function ‘virtual void clickhouse::ColumnLowCardinality::SaveBody(clickhouse::OutputStream*)’: /home//.conan2/p/b/click6c1a182889a69/b/src/clickhouse/columns/lowcardinality.cpp:344:88: error: bitwise operation between different enumeration types ‘{anonymous}::IndexType’ and ‘{anonymous}::IndexFlag’ is deprecated [-Werror=deprecated-enum- enum-conversion] 344 | const uint64_t index_serialization_type = indexTypeFromIndexColumn(*index_column_) | IndexFlag::HasAdditionalKeysBit; | ~~~~~~~~~^ cc1plus: all warnings being treated as errors make[2]: *** [clickhouse/CMakeFiles/clickhouse-cpp-lib.dir/columns/lowcardinality.cpp.o] Error 1
Full CMake/Make invocation is driven by Conan; the key point is that warnings are treated as errors and the deprecated enum‑enum bitwise OR becomes a hard error.
———
Expected behavior
- clickhouse-cpp/2.5.1 builds successfully with GCC 11 and C++20 (and typical -Werror settings) via ConanCenter.
- No misuse of std::memory_order.
———
Analysis
-
Invalid use of std::memory_order
In src/clickhouse/types/types.cpp the code currently uses:
if (type_unique_id_.load(std::memory_order::memory_order_relaxed) == 0) {
const auto name = GetName();
type_unique_id_.store(
CityHash64WithSeed(name.c_str(), name.size(), code_),
std::memory_order::memory_order_relaxed
);
}But in standard C++ (since C++11):
- std::memory_order is the enum type.
- Enumerators are std::memory_order_relaxed, std::memory_order_acquire, etc., in namespace std, not as nested names inside the enum.
The correct usage should be:
if (type_unique_id_.load(std::memory_order_relaxed) == 0) {
const auto name = GetName();
type_unique_id_.store(
CityHash64WithSeed(name.c_str(), name.size(), code_),
std::memory_order_relaxed
);
}With this change, GCC 11 accepts the code.
-
Deprecated enum bitwise OR with -Werror
In src/clickhouse/columns/lowcardinality.cpp:
const uint64_t index_serialization_type =
indexTypeFromIndexColumn(*index_column_) | IndexFlag::HasAdditionalKeysBit;indexTypeFromIndexColumn returns an IndexType, and IndexFlag is a different enum. GCC 11 (with C++20 and current warning settings) warns:
bitwise operation between different enumeration types … is deprecated
Because warnings are treated as errors, this stops the build. One way to avoid this is to explicitly cast to an integer type before the bitwise operation, for example:
const uint64_t index_serialization_type =
static_cast<uint64_t>(indexTypeFromIndexColumn(*index_column_)) |
static_cast<uint64_t>(IndexFlag::HasAdditionalKeysBit);
———
Workaround
As a temporary workaround on the consumer side, downgrading to clickhouse-cpp/2.5.0 in conanfile.py:
self.requires("clickhouse-cpp/2.5.0")
allows conan install ... to complete successfully in the same environment.
———
Request
- Please fix the std::memory_order::memory_order_relaxed usage to std::memory_order_relaxed in types.cpp.
- Please also consider adjusting the enum bitwise operation in lowcardinality.cpp (or relaxing the relevant warning) so that the library builds cleanly with modern compilers and -Werror.
- 主要语言
- C
- 星标
- 388
- 派生
- 220
- 平均合并
- 1 天 25 分钟
- 30 天内合并 PR
- 16
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
ClickHouse/clickhouse-cpp 的其他 Issue
-
bug data-types
难度 2/5 1-3 小时 新手友好度 76/100
ClickHouse/clickhouse-cpp#645 ·
维护者通常 1 天内回复
-
bug queries
难度 2/5 1-3 小时 新手友好度 79/100
ClickHouse/clickhouse-cpp#644 ·
维护者通常 1 天内回复
-
bug data-types native-format
难度 2/5 1-3 小时 新手友好度 82/100
ClickHouse/clickhouse-cpp#643 ·
维护者通常 1 天内回复
-
bug connectivity native-protocol
难度 2/5 1-3 小时 新手友好度 78/100
ClickHouse/clickhouse-cpp#638 ·
维护者通常 1 天内回复
-
Core SQL test harness: ParseSetAssignments does not skip comments inside SET可能已有人在做 @puretechteam 于 12 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 85/100
ClickHouse/clickhouse-cpp#626 · 1 条评论 ·
维护者通常 1 天内回复
查看 ClickHouse/clickhouse-cpp 的全部 Issue
相似的 Issue
-
CF_CFDP_S_SendFileData computes the file checksum from the SB buffer after CFE_SB_TransmitBuffer未关闭
难度 2/5 1-3 小时 新手友好度 78/100
-
needs triage
难度 2/5 1-3 小时 新手友好度 72/100
389ds/389-ds-base#8251 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100