Skip to content

libc++ 13 compatibility#32484

Merged
alexey-milovidov merged 29 commits intoClickHouse:masterfrom
Algunenano:libcxx13_take2
Dec 25, 2021
Merged

libc++ 13 compatibility#32484
alexey-milovidov merged 29 commits intoClickHouse:masterfrom
Algunenano:libcxx13_take2

Conversation

@Algunenano
Copy link
Copy Markdown
Member

@Algunenano Algunenano commented Dec 9, 2021

Changelog category (leave one):

  • Build/Testing/Packaging Improvement

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
PENDING (Should mention submodule updates and versions)

Detailed description / Documentation draft:

Still missing (to be done in another PR):

  • Update libcxx and libcxxabi submodule.

References #32018

@robot-clickhouse robot-clickhouse added the pr-build Pull request with build/testing/packaging improvement label Dec 9, 2021
@robot-ch-test-poll4 robot-ch-test-poll4 added the submodule changed At least one submodule changed in this PR. label Dec 9, 2021
@Algunenano
Copy link
Copy Markdown
Member Author

Temporarily switching the boost submodule to my fork to test if upgrading everything to boost 1.78 is the best way to go. That way I don't need to keep pushing PRs that might or might not work when they reach the CI

@Algunenano Algunenano force-pushed the libcxx13_take2 branch 2 times, most recently from 6f187d4 to 6457baf Compare December 10, 2021 17:28
@Algunenano
Copy link
Copy Markdown
Member Author

Seems like the pending failures are either found in master too (test_s3_zero_copy_replication) or issues when downloading docker images (#32772) so I believe it should be ready for review. I'll create PRs to the remaining submodules first.

@Algunenano
Copy link
Copy Markdown
Member Author

PRs with the submodule changes:

AFAICS, with that plus the changes here everything should be ready to use libc++13.

@Algunenano
Copy link
Copy Markdown
Member Author

Updated with master/HEAD. Changes boost to use ClickHouse-Extras after the changes were merged. Add a missing include after a recent change.

Still missing: Nuraft PR and Arrow 6.0.1 branch in ClickHouse-Extras.

@Algunenano
Copy link
Copy Markdown
Member Author

Removing the Draft tag since all this need now is to accept the changes to submodules and review the changes in this PR

@Algunenano Algunenano changed the title Draft: libc++ 13 compatibility libc++ 13 compatibility Dec 22, 2021
@Algunenano Algunenano marked this pull request as ready for review December 22, 2021 09:43
@alexey-milovidov
Copy link
Copy Markdown
Member

Ok.

milovidov@milovidov-desktop:~/work/ClickHouse/contrib/arrow$ git fetch [email protected]:apache/arrow.git release-6.0.1
milovidov@milovidov-desktop:~/work/ClickHouse/contrib/arrow$ git checkout -b release-6.0.1 FETCH_HEAD
milovidov@milovidov-desktop:~/work/ClickHouse/contrib/arrow$ git remote add origin-ssh [email protected]:ClickHouse-Extras/arrow.git
milovidov@milovidov-desktop:~/work/ClickHouse/contrib/arrow$ git push origin-ssh

@alexey-milovidov alexey-milovidov self-assigned this Dec 23, 2021
@@ -1,5 +1,22 @@
set (CMAKE_CXX_STANDARD 17)

set(ARROW_VERSION "6.0.1")
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.

We completely don't need it as we don't install Arrow .so.

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 is needed, or something equivalent, to generate the config.h with proper values. Otherwise it will fail to compile with errors like:

/mnt/ch/ClickHouse/contrib/arrow/cpp/src/arrow/config.cc:33:5: error: indirection requires pointer operand ('int' invalid)
    ARROW_VERSION,

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.

Ok.

{
assert(which != Types::String); // See specialization for char
using ValueType = std::decay_t<T>;
ValueType * MAY_ALIAS ptr = reinterpret_cast<ValueType *>(&storage);
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.

Rewrite with unalignedLoad?

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.

unalignedLoad returns a new object and then the compiler might decide it doesn't need to create it, and reinterpret always returns a reference to an object built on top of the existing memory. I'm not sure if they are equivalent.

src/Core/Field.h Outdated
template <>
inline char & Field::reinterpret<char>()
{
using ValueType = std::decay_t<char>;
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.

Looks weird.

src/Core/Field.h Outdated
{
// For String we want to return a pointer to the data, not the start of the class
// as the layout of std::string depends on the STD version and options
ValueType * MAY_ALIAS ptr = reinterpret_cast<ValueType *>(reinterpret_cast<String *>(&storage)->data());
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.

This is unneeded, as aliasing of char is permitted by C++ standard.

// Specialize reinterpreting to char (used in ColumnUnique) to make sure Strings are reinterpreted correctly
// inline to avoid multiple definitions
template <>
inline char & Field::reinterpret<char>()
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.

Please simplify the code of this function.

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.

Mostly LGTM.

@alexey-milovidov alexey-milovidov merged commit c583ea7 into ClickHouse:master Dec 25, 2021
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