Skip to content

Remove unbundled support#33690

Merged
alexey-milovidov merged 94 commits intoClickHouse:masterfrom
azat:remove-unbundled-support
Jan 20, 2022
Merged

Remove unbundled support#33690
alexey-milovidov merged 94 commits intoClickHouse:masterfrom
azat:remove-unbundled-support

Conversation

@azat
Copy link
Copy Markdown
Member

@azat azat commented Jan 16, 2022

Changelog category (leave one):

  • Build/Testing/Packaging Improvement

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Remove unbundled support

Detailed description / Documentation draft:
Recently I found one more issues with unbundled builds, and instead of fixing it in particular I decided to do a global cleanup.
Note, that right now (since d604cf5), to use UNBUNDLED build you need to manually set some variables, in other words there is no more one common switch for this (so it is unlikely that someone uses it, even I don't already)

Implementation:

  • each library is in a separate commit (more or less)
  • each commit may include some refactoring, since there was some issues while I was looking at this, one of common mistakes are:
    • not using internal bundled library (zlib)
    • use of non-existing variables (X_LIBRARIES instead of X_LIBRARY)
    • remove quirks for library types (statis/shared)
    • use ENABLE_LIBRARIES as default for contrib
    • move -DUSE_XXX to config file (configure_file)
  • original library name hidden with a prefix (to avoid accidentally using it)
  • alias that starts with ch_contrib:: is used as a public interface (that should include all include directories and compile definitions)
  • add alias libraries even for header-only libraries
  • add a style check to avoid using find_path/find_libraries (as a marker for non-bundled/system-wide libraries)

Checklist:

  • cleanup all cmake/find/*.cmake
  • cleanup docs
  • cleanup USE_INTERNAL_
  • introduce helper to include folder and check that submodule cloned

Fixes: #30598 (cc @alexey-milovidov )
Fixes: #9226

@robot-clickhouse robot-clickhouse added the pr-not-for-changelog This PR should not be mentioned in the changelog label Jan 16, 2022
Copy link
Copy Markdown
Member

@alexey-milovidov alexey-milovidov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is amazing!

@alexey-milovidov alexey-milovidov self-assigned this Jan 16, 2022
@azat azat force-pushed the remove-unbundled-support branch 3 times, most recently from ef7afef to a07ae4e Compare January 18, 2022 12:49
@robot-clickhouse robot-clickhouse added pr-build Pull request with build/testing/packaging improvement and removed pr-not-for-changelog This PR should not be mentioned in the changelog labels Jan 18, 2022
@azat azat force-pushed the remove-unbundled-support branch 10 times, most recently from 081c5bb to 96746c6 Compare January 19, 2022 06:20
@azat
Copy link
Copy Markdown
Member Author

azat commented Jan 19, 2022

Resolved lots of conflicts after merging #33695 (@amosbird some contrib headers does not requires SYSTEM, but I left them for now, since it is a minor thing (and I would say that it is a matter of choice) and it is important to finish this ASAP).

@azat
Copy link
Copy Markdown
Member Author

azat commented Jan 19, 2022

The only thing that is left for now is compatibility check, by some reason fscanf is used from 2.7

I missed some bits while converting libuv-cmake, fixed now.

@amosbird
Copy link
Copy Markdown
Collaborator

Resolved lots of conflicts after merging #33695 (@amosbird some contrib headers does not requires SYSTEM, but I left them for now, since it is a minor thing (and I would say that it is a matter of choice) and it is important to finish this ASAP).

It can be useful. System headers will appear later than normal headers which helps when some thirdparty's include dir introduces common header files, like libpq's config.h.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do these two libs not populate their only INTERFACE_INCLUDE_DIRECTORIES so that we can use modern cmake usage requirement directly? (e.g. target_link_libraries( _arrow PRIVATE ch_contrib::flatbuffers ch_contrib::hdfs) )

Copy link
Copy Markdown
Member Author

@azat azat Jan 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do these two libs not populate their only INTERFACE_INCLUDE_DIRECTORIES

They populate PUBLIC part (which is PRIVATE + INTERFACE), and only those paths, which is required for public interface.

so that we can use modern cmake usage requirement directly? (e.g. target_link_libraries( _arrow PRIVATE ch_contrib::flatbuffers ch_contrib::hdfs) )

This is indeed what is used later.

Copy link
Copy Markdown
Member Author

@azat azat Jan 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, you are talking about doing the same thing for flatbuffers, for now it is important not to use ${LIB_INCLUDE_DIR} outside of contrib since this is important (because it is easy to miss spell when variables in different files, while if everything is in one file it is more easy to do this right), everything other was leaved more or less as-is.

@azat azat force-pushed the remove-unbundled-support branch 3 times, most recently from 9ba3065 to 150c10e Compare January 19, 2022 08:09
@azat
Copy link
Copy Markdown
Member Author

azat commented Jan 19, 2022

Rebased to fix conflicts with #33742

@alesapin
Copy link
Copy Markdown
Member

@Mergifyio update

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jan 19, 2022

update

✅ Branch has been successfully updated

@azat
Copy link
Copy Markdown
Member Author

azat commented Jan 19, 2022

PullRequestCI / UnitTestsReleaseClang (pull_request) Failing after 14s — UnitTestsReleaseClang

INFO:root:Found build report json build_urls_binary_release.json
['https://s3.amazonaws.com/clickhouse-builds/33690/c397932ad4699abe58cdbb78ab56d76f4bdcbfaf/binary_release/clickhouse']
...
FileNotFoundError: [Errno 2] No such file or directory: '/home/ubuntu/actions-runner/_work/_temp/unit_tests_asan/unit_tests_dbms'

Apparently it tries to download unit tests too early, or what? @alesapin any clue?

Worth adding an exception if filter_fn does not match anything I guess?

def download_builds(result_path, build_urls, filter_fn):
for url in build_urls:
if filter_fn(url):
fname = os.path.basename(url.replace('%2B', '+').replace('%20', ' '))
logging.info("Will download %s to %s", fname, result_path)
dowload_build_with_progress(url, os.path.join(result_path, fname))

UPD: nevermind, fixed

@azat azat force-pushed the remove-unbundled-support branch from 209871e to 78858f9 Compare January 20, 2022 07:03
fi

# Check that there is no system-wide libraries/headers in use.
if git grep -e find_path -e find_library -- :**CMakeLists.txt; then
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@azat
Copy link
Copy Markdown
Member Author

azat commented Jan 20, 2022

PVS Studio (actions) — Total errors 39

PVS passed.

@alexey-milovidov alexey-milovidov merged commit 28a9d56 into ClickHouse:master Jan 20, 2022
@azat azat deleted the remove-unbundled-support branch January 20, 2022 13:57
set (LLVM_ENABLE_EH 1 CACHE INTERNAL "")
set (LLVM_ENABLE_RTTI 1 CACHE INTERNAL "")
set (LLVM_ENABLE_PIC 0 CACHE INTERNAL "")
set (LLVM_TARGETS_TO_BUILD "X86;AArch64" CACHE STRING "")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you build both x86 and aarch64? As I understand we have information about target and host architecture.

# We dont use arrow's cmakefiles because they uses too many depends and download some libs in compile time
# But you can update auto-generated parquet files manually:
# cd {BUILD_DIR}/contrib/arrow/cpp/src/parquet && mkdir -p build && cd build
# cmake .. -DARROW_COMPUTE=ON -DARROW_PARQUET=ON -DARROW_SIMD_LEVEL=NONE -DARROW_VERBOSE_THIRDPARTY_BUILD=ON
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you happen to remember why we disable SIMD completely? Seems like it could be useful and we could enable it in x86 and in ARM

Copy link
Copy Markdown
Member

@alexey-milovidov alexey-milovidov Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I don't remember.
One hypothesis is that it enabled too much, another hypothesis is that it didn't build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-build Pull request with build/testing/packaging improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: completely remove support for "unbundled" build. Build all contribs using our own CMake files

7 participants