Repository navigation
Description
Step 1: remove useless "install" directives. Examples:
Apr 22 06:07:27 [41/42] Install the project...
Apr 22 06:07:27 -- Install configuration: "RelWithDebInfo"
Apr 22 06:07:27 -- Installing: /build/packages/root/usr/lib/libglibc-compatibility.a
Apr 22 06:07:27 -- Installing: /build/packages/root/usr/lib/libmemcpy.a
Apr 22 06:07:27 -- Installing: /build/packages/root/usr/lib/libharmful.a
Apr 22 06:07:27 -- Installing: /build/packages/root/usr/lib/libunwind.a
Apr 22 06:07:27 -- Installing: /build/packages/root/usr/lib/libcxxabi.a
Apr 22 06:07:27 -- Installing: /build/packages/root/usr/lib/libcxx.a
Apr 22 06:07:27 -- Installing: /build/packages/root/usr/cmake/global.cmake
Apr 22 06:07:27 -- Installing: /build/packages/root/usr/cmake/global-relwithdebinfo.cmake
Apr 22 06:07:27 -- Installing: /build/packages/root/etc/clickhouse-server/config.xml
Apr 22 06:07:27 -- Installing: /build/packages/root/etc/clickhouse-server/users.xml
Apr 22 06:07:27 -- Installing: /build/packages/root/etc/clickhouse-client/config.xml
Apr 22 06:07:27 -- Installing: /build/packages/root/usr/share/bash-completion/completions/clickhouse-bootstrap
Apr 22 06:07:27 -- Installing: /build/packages/root/usr/share/bash-completion/completions/clickhouse-client
Apr 22 06:07:27 -- Installing: /build/packages/root/usr/share/bash-completion/completions/clickhouse-local
Apr 22 06:07:27 -- Installing: /build/packages/root/usr/share/bash-completion/completions/clickhouse-benchmark
Apr 22 06:07:27 -- Installing: /build/packages/root/usr/share/bash-completion/completions/clickhouse
Apr 22 06:07:27 -- Installing: /build/packages/root/etc/clickhouse-keeper/keeper_config.xml
Apr 22 06:07:27 -- Installing: /build/packages/root/usr/bin/clickhouse-keeper
Apr 22 06:07:27 -- Installing: /build/packages/root/usr/lib/debug/usr/bin/clickhouse-keeper.debug/clickhouse-keeper.debug
Apr 22 06:07:27 -- Installing: /build/packages/root/usr/bin/clickhouse-odbc-bridge
Apr 22 06:07:27 -- Installing: /build/packages/root/usr/lib/debug/usr/bin/clickhouse-odbc-bridge.debug/clickhouse-odbc-bridge.debug
Apr 22 06:07:27 -- Installing: /build/packages/root/usr/bin/clickhouse-library-bridge
Apr 22 06:07:28 -- Installing: /build/packages/root/usr/lib/debug/usr/bin/clickhouse-library-bridge.debug/clickhouse-library-bridge.debug
Apr 22 06:07:28 -- Installing: /build/packages/root/usr/bin/clickhouse-server
Apr 22 06:07:28 -- Installing: /build/packages/root/usr/bin/clickhouse-client
Apr 22 06:07:28 -- Installing: /build/packages/root/usr/bin/clickhouse-local
Apr 22 06:07:28 -- Installing: /build/packages/root/usr/bin/clickhouse-benchmark
Apr 22 06:07:28 -- Installing: /build/packages/root/usr/bin/clickhouse-copier
Apr 22 06:07:28 -- Installing: /build/packages/root/usr/bin/clickhouse-extract-from-config
Apr 22 06:07:28 -- Installing: /build/packages/root/usr/bin/clickhouse-compressor
Apr 22 06:07:28 -- Installing: /build/packages/root/usr/bin/clickhouse-format
Apr 22 06:07:28 -- Installing: /build/packages/root/usr/bin/clickhouse-obfuscator
Apr 22 06:07:28 -- Installing: /build/packages/root/usr/bin/clickhouse-git-import
Apr 22 06:07:28 -- Installing: /build/packages/root/usr/bin/clickhouse-static-files-disk-uploader
Apr 22 06:07:28 -- Installing: /build/packages/root/usr/bin/clickhouse-keeper-converter
Apr 22 06:07:28 -- Installing: /build/packages/root/usr/bin/clickhouse
Apr 22 06:07:28 -- Installing: /build/packages/root/usr/lib/debug/usr/bin/clickhouse.debug/clickhouse.debug
Apr 22 06:07:29 -- Installing: /build/packages/root/usr/bin/clickhouse-report
Apr 22 06:07:29 + bash -x /build/packages/build
Step 2: don't use "install" from CMake at all.
Motivation:
The "install" feature from CMake is intended for installation of the built project to the system. It does not make sense for ClickHouse, because CMake is not being able to correctly install it. Nevertheless, it has been used to copy some files to some subdirectories before converting these subdirectories to packages. It was used when "debian" packages infrastructure was used. We don't use it anymore, so the "install" feature of CMake appeared almost useless. The risk of misunderstanding this feature by developers and the risk of accumulation of garbage remains. A second point is that CMake is very complex piece of technology, and it is reasonable to use it as little as possible, avoiding most of the features. We already get rid of most of its features like "find_library", because we are using hermetic builds. This will also help to switch to different build systems (like Bazel) more easily, anticipating the trend that CMake will become less and less relevant.
Version info
- Resolved by: Build packages from the build and source directories without CMake
install#107115 - Merged into:
26.12.1.346-master(included in26.12and later)
Activity
alexey-milovidov commentedon Apr 24, 2022
Here we can replace temporary "install" directory to the build directory:
alexey-milovidov commentedon Apr 29, 2026
@groeneai, implement this change.
groeneai commentedon Apr 29, 2026
@alexey-milovidov — audit complete, posting findings before opening PRs.
Step 1 status: largely already done
The static-library installs from the issue body (
libglibc-compatibility.a,libmemcpy.a,libharmful.a,libunwind.a,libcxxabi.a,libcxx.a) and thecmake/global*.cmakefiles no longer have anyinstall()directives. Verified by inspecting the generatedcmake_install.cmakeforcontrib/libcxx-cmake,contrib/libcxxabi-cmake,contrib/libunwind-cmake,base/glibc-compatibility,base/harmful— they are all empty boilerplate. So the example output in the issue body is from 2022 and the obvious cleanup has happened over the years.Remaining first-party
install()footprintprograms/CMakeLists.txtclickhousebinary (whenSPLIT_DEBUG_SYMBOLS=OFF), Google protobuf.protofiles, chdig dummy fallbacksprograms/server/CMakeLists.txtconfig.xml,users.xmlprograms/client/CMakeLists.txtclickhouse-client.xml(renamed toconfig.xml)programs/keeper/CMakeLists.txtkeeper_config.xml, standaloneclickhouse-keeperbinary,clickhouse-keeper-clientsymlinkprograms/bash-completion/completions/CMakeLists.txtcmake/split_debug_symbols.cmake.debugsymbol files for nfpmOrphan installs (Step 1.5 candidate)
programs/CMakeLists.txtcallsclickhouse_program_install(...)for several subcommands whose symlinks land inbuild/packages/root/usr/bin/but are not referenced by any packaging YAML, so they get dropped at the nfpm step — pure wasted I/O:clickhouse-check-marks,clickhouse-checksum-for-compressed-block,clickhouse-disks,clickhouse-docker-init,clickhouse-git-import,clickhouse-static-files-disk-uploader,clickhouse-su,clickhouse-zookeeper-dump-tree,clickhouse-zookeeper-remove-by-list,clickhouse-keeper-data-dumper,clickhouse-keeper-utils,clickhouse-keeper-bench.(Cross-checked
packages/*.yaml— none of these names appear.) Users still invoke them asclickhouse <subcommand>on the multi-call binary; only the standalone aliases are unused.Proposed plan — three small PRs
Step 1.5: Drop orphan installs. Split
clickhouse_program_installinto a_link-only variant for non-packaged subcommands. Keeps the symlink in the build directory (handy for dev) but skips the wastedinstall(FILES …). Mechanical, low-risk.Step 2a: Replace
install()of static source files with direct YAML paths.config.xml,users.xml,clickhouse-client.xml,keeper_config.xml, the bash completions, and the protobuf.protofiles are already in the source tree — packaging YAMLs can point at them directly under the repo root. Removes 5 of the remaining 17install()callsites without touching the build flow.Step 2b: Replace
install()of build artifacts with direct YAML paths. The mainclickhousebinary, multi-call symlinks, standalone keeper, and split-debug.debugfiles. Packaging YAMLs point intobuild/programs/. The CI script (ci/jobs/build_clickhouse.py:312runsninja programs/installwithDESTDIR=root) becomes a no-op step that can be deleted alongside theinstall()removals. Bigger refactor — touches the build matrix and packaging flow.I'll open Step 1.5 first as the safest mechanical change, verify a clean build + packaging round-trip locally, and then iterate on Step 2a / 2b. If you'd prefer a single combined PR or a different order, happy to adjust.
Do not install standalone symlinks for multi-call-only subcommands