Skip to content

Preparation to build with Musl#30248

Merged
alexey-milovidov merged 6 commits intomasterfrom
musl-4
Oct 16, 2021
Merged

Preparation to build with Musl#30248
alexey-milovidov merged 6 commits intomasterfrom
musl-4

Conversation

@alexey-milovidov
Copy link
Copy Markdown
Member

@alexey-milovidov alexey-milovidov commented Oct 15, 2021

Changelog category (leave one):

  • Build/Testing/Packaging Improvement

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
ClickHouse can be statically built with Musl. This is added as experiment, it does not support building odbc-bridge, library-bridge, integration with CatBoost and some libraries.

@robot-clickhouse robot-clickhouse added the pr-not-for-changelog This PR should not be mentioned in the changelog label Oct 15, 2021
@robot-ch-test-poll1 robot-ch-test-poll1 added the submodule changed At least one submodule changed in this PR. label Oct 15, 2021
#define JEMALLOC_OVERRIDE___LIBC_MEMALIGN
#define JEMALLOC_OVERRIDE___LIBC_REALLOC
#define JEMALLOC_OVERRIDE___LIBC_VALLOC
#if !defined(USE_MUSL)
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.

There are also defines for other platforms:

$ gg '#define JEMALLOC_OVERRIDE___LIBC_CALLOC'
contrib/jemalloc-cmake/include_linux_aarch64/jemalloc/internal/jemalloc_internal_defs.h.in:#define JEMALLOC_OVERRIDE___LIBC_CALLOC
contrib/jemalloc-cmake/include_linux_ppc64le/jemalloc/internal/jemalloc_internal_defs.h.in:#define JEMALLOC_OVERRIDE___LIBC_CALLOC
contrib/jemalloc-cmake/include_linux_x86_64/jemalloc/internal/jemalloc_internal_defs.h.in:#define JEMALLOC_OVERRIDE___LIBC_CALLOC

Or musl will be used only for x86_64?

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.

It can be used on multiple platforms and in fact in makes cross-compilation much more easy.
But I did not try Musl on any other platforms, and I don't want to add any changes blindly.

@alexey-milovidov
Copy link
Copy Markdown
Member Author

CC=clang-13 CXX=clang++-13 cmake -DCMAKE_TOOLCHAIN_FILE=cmake/linux/toolchain-x86_64-musl.cmake -DENABLE_ODBC=0 -DENABLE_EMBEDDED_COMPILER=0 -DENABLE_GRPC=0 -DUSE_SENTRY=0 -DENABLE_HDFS=0 ..
milovidov@milovidov-desktop:~/work/ClickHouse/build$ ldd programs/clickhouse
        statically linked
milovidov@milovidov-desktop:~/work/ClickHouse/build$ programs/clickhouse local
ClickHouse local version 21.11.1.1.

milovidov-desktop :) SELECT 1

SELECT 1

Query id: d5a98580-efa0-4440-a251-98647f582c00

┌─1─┐
│ 1 │
└───┘

1 rows in set. Elapsed: 0.001 sec. 

milovidov-desktop :) SELECT throwIf(1)

SELECT throwIf(1)

Query id: 64e1596b-4488-41c0-ad5a-0faf12626605


0 rows in set. Elapsed: 0.065 sec. 

Received exception:
Code: 395. DB::Exception: Value passed to 'throwIf' function is non zero: While processing throwIf(1). (FUNCTION_THROW_IF_VALUE_IS_NON_ZERO)

milovidov-desktop :) Bye.

Server also works.

@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 Oct 16, 2021
@alexey-milovidov alexey-milovidov merged commit e9af03e into master Oct 16, 2021
@alexey-milovidov alexey-milovidov deleted the musl-4 branch October 16, 2021 15:44
@alexey-milovidov alexey-milovidov self-assigned this Oct 16, 2021
@alexey-milovidov
Copy link
Copy Markdown
Member Author

@azat FYI we can add this build type to CI just in case but now it looks too early.
It works, but many corner cases will break.
If you are interested, maybe it is worth playing :)

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 submodule changed At least one submodule changed in this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants