-
-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
clickhouse 21.7 (new formula) #79378
Conversation
Last try to add ClickHouse was in 2016 #7222 |
class Clickhouse < Formula | ||
desc "Free analytics DBMS for big data with SQL interface" | ||
homepage "https://clickhouse.tech" | ||
url "https://github.com/ClickHouse/ClickHouse/releases/download/v21.6.3.14-stable/ClickHouse_sources_with_submodules.tar.gz" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to vendor a whole lot of dependencies. We should avoid that and use a Homebrew/core dependency whenever one is available.
See https://docs.brew.sh/Acceptable-Formulae#stuff-that-requires-vendored-versions-of-homebrew-formulae.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your fast review.
Actually we have very thorough CI process in ClickHouse and we test master and stable versions that occur as packages and binaries for our users. You can read more about CI here https://clickhouse.tech/docs/en/development/continuous-integration/
We do not use dynamic libraries and almost even minimize glibc dependences for maximum portability.
As ClickHouse is written in C++ there is no easy way for dependencies check and updates like in Java/etc. Our community and team updates libraries and this process usually needs.
If we start to support separate build process for brew it will be complex as lots of libraries do not release official updates(for example Poco) and we have to add bugfixes in forked repos. All changes are published in https://github.com/ClickHouse-Extras. Moreover we cannot test such releases with unbundled versions of libraries the same way as we test upstream and stable releases.
Separate build for brew means we provide our users not the same ClickHouse that is available in official builds. I understood https://docs.brew.sh/Acceptable-Formulae#we-dont-like-binary-formulae as it is better to build everything in your envionment and not just reuse build artifacts from our CI process. As you can see we do not use any system libraries and just need working compiler with c++17 support.
I see it is not an easy question and we should find solution that will benefits our communities.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might have your own testing infrastructure for your dependencies, but I think your coverage is also a bit limited here.
For example, it's clear that you don't test building FlatBuffers on macOS Mojave since the Mojave build fails at building FlatBuffers. If you used Homebrew FlatBuffers instead, this would not be a problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually there is a lot of work done to make binaries which are portable. For example we check that you can use the exact same binary on centos:5/ubuntu:12.04 with really old glibc 2.4. We have cross-compile builds for aarch64, freebsd and macOS. Currently we do not have macOS servers to be able to run all necessary checks for that platform(and for different macOS versions).
We do have precompiled versions(https://clickhouse.tech/docs/en/getting-started/install/#from-binaries-non-linux) - it should be trivial to check that it works on Mojave. Probably we will get Apple servers in future and add them to CI.
FlatBuffers here is not a single problem - actually I'm almost sure it would successfully build if I add llvm dependency and build it without AppleClang on Mojave. When I encountered the same error on Catalina, I found that Xcode developer tools allow to complile project and CLT fails. Build environment should not be somehow related to functionality and we allow to use c++17 and c++20 features if it is justifiable. So, yes - we do not test building on old platforms, but support running ClickHouse on older operating systems.
Imagine we will get it somehow working. Rewrite all cmake files. Add 75 dependencies to libraries that are present in Homebrew or those that are not. Export all patches from 60+ libraries that we had to write to fix bugs in those libraries.
- We can't control that all 75 libraries have mainatainers that update brew formula for them.
- I can't understand how we can patch library source code and not only our sources. For example we have 85 commits in Poco, that was not yet taken to upstream(example TCPServerDispatcher.h: missing <atomic> pocoproject/poco#2961)
- In normal way we have just make security fix to upstream(probably just checkout newer submodule version), test this build and switch version in brew to more recent release. Here I don't understand who exactly updates library. You force dynamic linkage or you want to rebuild all packages that depend on library in build stage?
- We know several use cases when using other versions of dynamic libraries lead to problems in stability. If we do not know exactly what versions will be user by a user we cannot check this environment. And considering we have 75 submodules, it is almost unthinkable.
And to understand what is the reason of this policy. Is it just for security reason only or there are some other ideas?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually there is a lot of work done to make binaries which are portable.
Sure; I don't doubt that. That doesn't mean your testing coverage isn't finite.
FlatBuffers here is not a single problem - actually I'm almost sure it would successfully build if I add llvm dependency and build it without AppleClang on Mojave.
I've done a bit of work on using LLVM Clang in place of Apple Clang in order to build a formula on Mojave (see, e.g., grpc
, mavsdk
, bear
, folly
, etc), and I'm almost sure it would not build successfully just by using LLVM Clang in place of Apple Clang.
An unguarded aligned_alloc
call just isn't something you can fix by using a newer compiler, because it likely involves making system calls that just aren't implemented. I'm happy to be proven wrong here, however, since this would allow me to fix workarounds I've put in place elsewhere.
Export all patches from 60+ libraries that we had to write to fix bugs in those libraries.
You should be upstreaming these patches anyway, regardless of whether you support building ClickHouse with system-provided libraries or not.
- We can't control that all 75 libraries have mainatainers that update brew formula for them.
Sure. This is true about any software that uses an external dependency. I would argue that attempting to exert control over external dependencies isn't really something you should be trying to do anyway.
- I can't understand how we can patch library source code and not only our sources. For example we have 85 commits in Poco, that was not yet taken to upstream(example pocoproject/poco#2961)
Why haven't these patches been upstreamed?
- In normal way we have just make security fix to upstream(probably just checkout newer submodule version), test this build and switch version in brew to more recent release. Here I don't understand who exactly updates library. You force dynamic linkage or you want to rebuild all packages that depend on library in build stage?
We link libraries dynamically.
- We know several use cases when using other versions of dynamic libraries lead to problems in stability. If we do not know exactly what versions will be user by a user we cannot check this environment. And considering we have 75 submodules, it is almost unthinkable.
What problems are these exactly?
And to understand what is the reason of this policy. Is it just for security reason only or there are some other ideas?
Security is one reason. De-duplication is another. It kinda defeats a big part of the use of a package manager if a package's build system includes its own specialised package manager for its vendored dependencies.
version "21.6" | ||
sha256 "696bbcdef4796bfdf1becdb78abb5e97c0220acc9863f5a821193dd297ce428b" | ||
license "Apache-2.0" | ||
head "https://github.com/ClickHouse/ClickHouse.git" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
head "https://github.com/ClickHouse/ClickHouse.git" | |
head "https://github.com/ClickHouse/ClickHouse.git" | |
Let's make the formatting here consistent with other formulae.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. I'll add it after I'll get current build results.
mkdir_p bin | ||
mkdir_p "#{HOMEBREW_PREFIX}/etc/clickhouse-server" | ||
mkdir_p "#{var}/log/clickhouse-server" | ||
mkdir_p "#{var}/lib/clickhouse-server" | ||
mkdir_p "#{var}/run/clickhouse-server" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens when you don't do this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Install procedure will not find a directory.
At least I had to fix creation of ones like Cellar/clickhouse/21.6/bin
that has version number in them.
By the way, it was really exhausting to debug build failures in brew install --build-from-source -v clickhouse
as it required to rebuild everything without cache. And it took more than 3 hours on each try. Is there a way to retry one step in noninteractive way?
args = std_cmake_args | ||
args.delete("-DCMAKE_BUILD_TYPE=Release") | ||
args << "-DCMAKE_BUILD_TYPE=RelWithDebInfo" | ||
|
||
system "cmake", ".", *args |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
args = std_cmake_args | |
args.delete("-DCMAKE_BUILD_TYPE=Release") | |
args << "-DCMAKE_BUILD_TYPE=RelWithDebInfo" | |
system "cmake", ".", *args | |
system "cmake", ".", *std_cmake_args |
We don't support building with debug symbols.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't met this in Cookbook. I can change it.
Can you elaborate what is the idea? I don't know how I can help a user to report a bug without symbols and I don't know a way to provide separate package with symbols in brew. In Debian packages we can split artifacts to binary and symbols – do we have alternative there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really, though I'm personally open to entertain the possibility of externalising debug information and packaging them separately. (I don't speak for other maintainers on this, though.)
At the moment, however, we don't support building with debug info at all. Indeed, you'll find that most attempts to build with debug info will either break the build, or just not produce any debug info (since brew
will intercept any -g
flags passed to the compiler).
|
||
plist_options manual: "clickhouse-server --config-file #{HOMEBREW_PREFIX}/etc/clickhouse-server/config.xml" | ||
|
||
def plist |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use a service
block instead of manually creating a plist
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess sure we can. But I can't find any documentation about this and probably try to catch the idea from #79366
|
This comes from the unguarded use of |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
brew install --build-from-source <formula>
, where<formula>
is the name of the formula you're submitting?brew test <formula>
, where<formula>
is the name of the formula you're submitting?brew audit --strict <formula>
(after doingbrew install --build-from-source <formula>
)? If this is a new formula, does it passbrew audit --new <formula>
?