redpanda icon indicating copy to clipboard operation
redpanda copied to clipboard

[v22.1.x] Bad seastar version in public cmake

Open mengrj opened this issue 2 years ago • 8 comments

While manually building redpanda-v22.1.7 with vectorized/redpanda-toolchain, encountered the issue:

[59/838] Building CXX object src/v/net/CMakeFiles/v_net.dir/server.cc.o
FAILED: src/v/net/CMakeFiles/v_net.dir/server.cc.o 
ccache /usr/bin/clang++ -DFMT_LOCALE -DFMT_SHARED -DSEASTAR_API_LEVEL=6 -DSEASTAR_SCHEDULING_GROUPS_COUNT=16 -DXXH_PRIVATE_API -I../src/v -Isrc/v -isystem deps_install/include -fPIC -fcolor-diagnostics -O3 -DNDEBUG -fPIC -Wall -Wextra -Werror -Wno-missing-field-initializers -std=c++20 -U_FORTIFY_SOURCE -DSEASTAR_SSTRING -Werror=unused-result "-Wno-error=#warnings" -std=c++20 -MD -MT src/v/net/CMakeFiles/v_net.dir/server.cc.o -MF src/v/net/CMakeFiles/v_net.dir/server.cc.o.d -o src/v/net/CMakeFiles/v_net.dir/server.cc.o -c ../src/v/net/server.cc
In file included from ../src/v/net/server.cc:10:
In file included from ../src/v/net/server.h:16:
../src/v/net/connection.h:59:34: error: no member named 'session_dn' in namespace 'seastar'
    ss::future<std::optional<ss::session_dn>> get_distinguished_name() {
                             ~~~~^
../src/v/net/connection.h:60:20: error: no member named 'get_distinguished_name' in 'seastar::connected_socket'
        return _fd.get_distinguished_name();
               ~~~ ^
../src/v/net/server.cc:80:22: error: no matching function for call to 'listen'
                ss = ss::tls::listen(
                     ^~~~~~~~~~~~~~~
deps_install/include/seastar/net/tls.hh:340:19: note: candidate function not viable: no known conversion from 'seastar::server_socket' to 'seastar::socket_address' for 2nd argument
    server_socket listen(shared_ptr<server_credentials>, socket_address sa, listen_options opts = listen_options());

It could be using an incompatible version of seastar. I reviewed the latest seastar code, the 'session_dn' in namespace 'seastar', but no member named 'get_distinguished_name' in 'seastar::connected_socket'. I tried to revise the code in /src/v/net/connection.h, then it reports more errors:

../src/v/net/connection.h:73:41: error: field has incomplete type 'seastar::net::connected_socket_impl'
    seastar::net::connected_socket_impl _fd;

Could you give suggestions about how to manage to build redpanda manually? Thanks.

mengrj avatar Aug 05 '22 03:08 mengrj

It looks like the public files on the 22.1.x. branch are out of date. Please try this patch https://github.com/redpanda-data/redpanda/pull/5865

jcsp avatar Aug 05 '22 13:08 jcsp

(that PR merged, so if you check out the tip of v22.1.x you should get past the build error you saw)

jcsp avatar Aug 05 '22 15:08 jcsp

Many thanks for your update. The building error about seastar is gone.

However, while manually building in Fredora:34 and the recommended image vectorized/redpanda-toolchain, encountered another issue about depot_tools:

[98/144] Performing download step for 'v8'
depot_tools update failed. Conflict in /opt/depot_tools
error: Your local changes to the following files would be overwritten by checkout:
	.gitattributes
	.gitignore
	.vpython
	.vpython3
	GOMA_OWNERS
	LUCI_OWNERS
	OWNERS
	PRESUBMIT.py
	README.md
	bootstrap/manifest.txt
	bootstrap/manifest_bleeding_edge.txt
	cipd_client_version
	cipd_client_version.digests
	cipd_manifest.txt
	cipd_manifest.versions
	clang-format.bat
	compile_single_file.bat
	compile_single_file.py
	cpplint.bat
	fetch_configs/android_internal.py
	fetch_configs/chromium.py
	fetch_configs/ios_internal.py
	fetch_configs/pdfium.py
	fix_encoding.py
	gclient_eval.py
	gclient_scm.py
	gclient_utils.py
	gerrit_util.py
	git_common.py
	git_migrate_default_branch.py
	goma_auth.bat
	goma_ctl.bat
	gsutil.vpython
	infra/config/OWNERS
	infra/config/recipes.cfg
	man/html/depot_tools.html
	man/html/depot_tools_tutorial.html
	man/html/git-cl.html
	man/html/git-drover.html
	man/html/git-footers.html
	man/html/git-freeze.html
	man/html/git-hyper-blame.html
	man/html/git-map-branches.html
	man/html/git-map.html
	man/html/git-mark-merge-base.html
	man/html/git-nav-downstream.html
	man/html/git-nav-upstream.html
	man/html/git-new-branch.html
	man/html/git-rebase-update.html
	man/html/git-rename-branch.html
	man/html/git-reparent-branch.html
	man/html/git-retry.html
	man/html/git-squash-branch.html
	man/html/git-thaw.html
	man/html/git-upstream-diff.html
	man/man1/git-cl.1
	man/man1/git-drover.1
	man/man1/git-footers.1
	man/man1/git-freeze.1
	man/man1/git-hyper-blame.1
	man/man1/git-map-branches.1
	man/man1/git-map.1
	man/man1/git-mark-merge-base.1
	man/man1/git-nav-downstream.1
	man/man1/git-nav-upstream.1
	man/man1/git-new-branch.1
	man/man1/git-rebase-update.1
	man/man1/git-rename-branch.1
	man/man1/git-reparent-branch.1
	man/man1/git-retry.1
	man/man1/git-squash-branch.1
	man/man1/git-thaw.1
	man/man1/git-upstream-diff.1
	man/man7/depot_tools.7
	man/man7/depot_tools_tutorial.7
	man/src/depot_tools_tutorial.txt
	man/src/git-drover.txt
	man/src/git-footers.txt
	man/src/git-map-branches.txt
	man/src/git-nav-downstream.txt
	man/src/git-nav-upstream.txt
	man/src/git-new-branch.txt
	man/src/git-rebase-update.txt
	man/src/git-reparent-branch.txt
	man/src/git-squash-branch.txt
	man/src/git-upstream-diff.txt
	metrics.py
	metrics_utils.py
	ninjalog.README.md
	owners_finder.py
	presubmit_canned_checks.py
	presubmit_canned_checks_test.py
	presubmit_canned_checks_test_mocks.py
	pylint.bat
	rdb_wrapper.py
	recipes/OWNERS
	recipes/README.recipes.md
	recipes/recipe_modules/bot_update/OWNERS
	recipes/recipe_modules/bot_update/__init__.py
	recipes/recipe_modules/bot_update/api.py
	recipes/recipe_modules/bot_update/examples/full.expected/add_blamelists.json
	recipes/recipe_modules/bot_update/examples/full.expected/add_blamelists_bot_update_failure.json
	recipes/recipe_modules/bot_update/examples/full.expected/basic.json
	recipes/recipe_modules/bot_update/examples/full.expected/basic_with_branch_heads.json
	recipes/recipe_modules/bot_update/examples/full.expected/bot_update_failure.json
	recipes/recipe_modules/bot_update/examples/full.expected/clobber.json
	recipes/recipe_modules/bot_update/examples/full.expected/deprecated_got_revision_mapping.json
	recipes/recipe_modules/bot_update/examples/full.expected/gerrit_no_rebase_patch_ref.json
	recipes/recipe_modules/bot_update/examples/full.expected/gerrit_no_reset.json
	recipes/recipe_modules/bot_update/examples/full.expected/input_commit_with_id_without_repo.json
	recipes/recipe_modules/bot_update/examples/full.expected/multiple_patch_refs.json
	recipes/recipe_modules/bot_update/examples/full.expected/no_apply_patch_on_gclient.json
	recipes/recipe_modules/bot_update/examples/full.expected/no_cp_checkout_HEAD.json
	recipes/recipe_modules/bot_update/examples/full.expected/no_cp_checkout_a_branch_head.json
	recipes/recipe_modules/bot_update/examples/full.expected/no_cp_checkout_a_specific_commit.json
	recipes/recipe_modules/bot_update/examples/full.expected/no_cp_checkout_master.json
	recipes/recipe_modules/bot_update/examples/full.expected/origin_master.json
	recipes/recipe_modules/bot_update/examples/fu
Aborting
/opt/depot_tools/bootstrap_python3: line 28: cipd: command not found
/opt/depot_tools/bootstrap_python3: line 32: [email protected]_bin/python3/bin/python3: No such file or directory
...
ninja: build stopped: subcommand failed.
-- Configuring incomplete, errors occurred!

mengrj avatar Aug 07 '22 08:08 mengrj

The depot_tools update failed issue also occurs in old versions like branch v21.11.x.

mengrj avatar Aug 07 '22 09:08 mengrj

There seems another issue about undefined reference to fmt::v7::basic_format_context. As the readme, I manually built (1) in fedora:34 with the command sudo ./install-dependencies.sh && CC=clang CXX=clang++ ./build.sh, and (2) in image vectorized/redpanda-toolchain with the command docker run --rm -ti -v $PWD:$PWD:Z -w $PWD vectorized/redpanda-toolchain ./build.sh. These two ways both reported the issues above.

FAILED: bin/storage_multi_thread_rpunit 
...
/usr/bin/ld: lib/libv_v_security.a(mtls.cc.o): in function `void fmt::v7::detail::value<fmt::v7::basic_format_context<fmt::v7::detail::buffer_appender<char>, char> >::format_custom_arg<fmt::v7::arg_join<__gnu_cxx::__normal_iterator<security::tls::rule const*, std::vector<security::tls::rule, std::allocator<security::tls::rule> > >, __gnu_cxx::__normal_iterator<security::tls::rule const*, std::vector<security::tls::rule, std::allocator<security::tls::rule> > >, char>, fmt::v7::formatter<fmt::v7::arg_join<__gnu_cxx::__normal_iterator<security::tls::rule const*, std::vector<security::tls::rule, std::allocator<security::tls::rule> > >, __gnu_cxx::__normal_iterator<security::tls::rule const*, std::vector<security::tls::rule, std::allocator<security::tls::rule> > >, char>, char, void> >(void const*, fmt::v7::basic_format_parse_context<char, fmt::v7::detail::error_handler>&, fmt::v7::basic_format_context<fmt::v7::detail::buffer_appender<char>, char>&)':
mtls.cc:(.text._ZN3fmt2v76detail5valueINS0_20basic_format_contextINS1_15buffer_appenderIcEEcEEE17format_custom_argINS0_8arg_joinIN9__gnu_cxx17__normal_iteratorIPKN8security3tls4ruleESt6vectorISE_SaISE_EEEESK_cEENS0_9formatterISL_cvEEEEvPKvRNS0_26basic_format_parse_contextIcNS1_13error_handlerEEERS6_[_ZN3fmt2v76detail5valueINS0_20basic_format_contextINS1_15buffer_appenderIcEEcEEE17format_custom_argINS0_8arg_joinIN9__gnu_cxx17__normal_iteratorIPKN8security3tls4ruleESt6vectorISE_SaISE_EEEESK_cEENS0_9formatterISL_cvEEEEvPKvRNS0_26basic_format_parse_contextIcNS1_13error_handlerEEERS6_]+0x2d): undefined reference to `fmt::v7::basic_format_context<fmt::v7::detail::buffer_appender<char>, char>::iterator fmt::v7::formatter<security::tls::rule, char, void>::format<fmt::v7::basic_format_context<fmt::v7::detail::buffer_appender<char>, char> >(security::tls::rule const&, fmt::v7::basic_format_context<fmt::v7::detail::buffer_appender<char>, char>&)'
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)

mengrj avatar Aug 07 '22 12:08 mengrj

Containers: It looks like the redpanda-toolchain image may be quite severely out of date, I'm asking around internally to see if this was left online by mistake. The compilation error is clearly something else though, since you're getting that outside of the docker image as well.

Compilation error: As you've probably already realised, you're the first person to build this branch using the public cmake bits in a while. There have been fixes on dev more recently: if you take the diff between v22.1.x and dev on the cmake/ directory, there are some promising looking changes there, notably a change to where fmt comes from, which might help with this compilation error.

Thank you for your perseverence!

jcsp avatar Aug 08 '22 12:08 jcsp

For the compilation error: As your suggestion, check the cmake/ directory. I guess the fix is to add the fmt lib with:

ExternalProject_Add(fmt
  URL https://github.com/fmtlib/fmt/archive/refs/tags/8.1.1.tar.gz
  URL_MD5 fe7f1585844b14c647bd332ad5562832
  INSTALL_DIR @REDPANDA_DEPS_INSTALL_DIR@
  CMAKE_COMMAND ${CMAKE_COMMAND} -E env ${cmake_build_env} ${CMAKE_COMMAND}
  DEPENDS ${default_depends}
  CMAKE_ARGS
     ${common_cmake_args}
     -DFMT_DOC=OFF
     -DFMT_TEST=OFF)

However, it reports another issue likely about incompatible fmt version:

../src/v/bytes/details/out_of_range.h:20:41: error: call to consteval function 'fmt::basic_format_string<char, unsigned long &, unsigned long &>::basic_format_string<const char *, 0>' is not a constant expression
    throw std::out_of_range(fmt::format(fmt, A, B));
                                        ^
deps_install/include/fmt/core.h:3057:67: note: function parameter 'fmt' with unknown value cannot be used in a constant expression
  FMT_CONSTEVAL FMT_INLINE basic_format_string(const S& s) : str_(s) {

Could you let me know which redpanda branch or version can be built manually by users? I witnessed many errors during building.

mengrj avatar Aug 09 '22 10:08 mengrj

Could you let me know which redpanda branch or version can be built manually by users? I witnessed many errors during building.

Your best bet is to use the tip of dev, that's what I'm aware of others building most recently.

jcsp avatar Aug 09 '22 10:08 jcsp

While building the dev branch commit 6b9599e7ff5e3b56dbac9db0c27f2a58cca4e869, report errors about static_assert failed. Is there a way to fix this building issue?

FAILED: src/v/storage/CMakeFiles/v_storage.dir/offset_translator_state.cc.o 
/usr/bin/ccache /usr/bin/clang++ -DFMT_LOCALE -DSEASTAR_API_LEVEL=6 -DSEASTAR_SCHEDULING_GROUPS_COUNT=16 -DXXH_PRIVATE_API -DZSTD_STATIC_LINKING_ONLY -I../src/v -Isrc/v -isystem deps_install/include -isystem deps_install/include/hdr -fPIC -fcolor-diagnostics -O3 -DNDEBUG -fPIC -Wall -Wextra -Werror -Wno-missing-field-initializers -U_FORTIFY_SOURCE -DSEASTAR_SSTRING -Werror=unused-result "-Wno-error=#warnings" -std=c++20 -MD -MT src/v/storage/CMakeFiles/v_storage.dir/offset_translator_state.cc.o -MF src/v/storage/CMakeFiles/v_storage.dir/offset_translator_state.cc.o.d -o src/v/storage/CMakeFiles/v_storage.dir/offset_translator_state.cc.o -c ../src/v/storage/offset_translator_state.cc
In file included from ../src/v/storage/offset_translator_state.cc:12:
In file included from ../src/v/storage/offset_translator_state.h:14:
In file included from ../src/v/model/fundamental.h:16:
../src/v/serde/serde.h:239:5: error: static_assert failed due to requirement 'has_serde_write<storage::(anonymous namespace)::persisted_batches_map> || is_serde_compatible_v<storage::(anonymous namespace)::persisted_batches_map>'
    static_assert(has_serde_write<Type> || is_serde_compatible_v<Type>);
    ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/v/serde/serde.h:831:5: note: in instantiation of function template specialization 'serde::write<storage::(anonymous namespace)::persisted_batches_map>' requested here
    write(b, std::forward<T>(t));
    ^
../src/v/storage/offset_translator_state.cc:303:19: note: in instantiation of function template specialization 'serde::to_iobuf<storage::(anonymous namespace)::persisted_batches_map>' requested here
    return serde::to_iobuf(std::move(persisted));
                  ^
In file included from ../src/v/storage/offset_translator_state.cc:12:
In file included from ../src/v/storage/offset_translator_state.h:14:
In file included from ../src/v/model/fundamental.h:16:
../src/v/serde/serde.h:518:5: error: static_assert failed due to requirement 'has_serde_read<storage::(anonymous namespace)::persisted_batches_map> || is_serde_compatible_v<storage::(anonymous namespace)::persisted_batches_map>'
    static_assert(has_serde_read<T> || is_serde_compatible_v<Type>);
    ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/v/serde/serde.h:745:5: note: in instantiation of function template specialization 'serde::read_nested<storage::(anonymous namespace)::persisted_batches_map>' requested here
    read_nested(in, t, bytes_left_limit);
    ^
../src/v/serde/serde.h:441:16: note: in instantiation of function template specialization 'serde::read_nested<storage::(anonymous namespace)::persisted_batches_map>' requested here
    auto ret = read_nested<T>(in, 0U);
               ^
../src/v/serde/serde.h:838:12: note: in instantiation of function template specialization 'serde::read<storage::(anonymous namespace)::persisted_batches_map>' requested here
    return read<T>(in);
           ^
../src/v/storage/offset_translator_state.cc:308:29: note: in instantiation of function template specialization 'serde::from_iobuf<storage::(anonymous namespace)::persisted_batches_map>' requested here
    auto persisted = serde::from_iobuf<persisted_batches_map>(std::move(buf));
                            ^
2 errors generated.

It seems that the current status is not very nice for community build:(. Tried to build many branches and versions, but still struggle to get a successful build.

mengrj avatar Aug 10 '22 13:08 mengrj

It seems that the current status is not very nice for community build:(. Tried to build many branches and versions, but still struggle to get a successful build.

You are right, this had got into a stale state recently. I think the most recent error is from using a distro clang (12?) whereas the latest redpanda code requires 15. That's the fault of the install-dependencies.sh script, which is incorrectly assuming that the distro clang is going to be recent enough.

jcsp avatar Aug 10 '22 14:08 jcsp

Thanks for your update. Do you have any plans to update relevant scripts or docker images? As far as I can tell, there is no version that can be manually built successfully. So updating docs should be quite welcomed by the public community.

mengrj avatar Aug 10 '22 14:08 mengrj

Hi. I'm also trying to build dev branch but still didn't succeed. I think I could workaround about static_assert issue above (and some other issues) by this change: https://github.com/redpanda-data/redpanda/commit/2a21aef9aac4dbd5c86ad208e76434747b5071f8 though, I got another error on linking.

environment:

  • Docker version: Docker version 20.10.17, build 100c701
  • Host OS: Ubuntu 20.04.3 LTS

Reproducible step:

$ DOCKER_BUILDKIT=1 docker build -t vectorized/rp-toolchain -f tools/docker/Dockerfile .
$ docker run --rm --privileged -ti -v $PWD:$PWD -w $PWD vectorized/rp-toolchain ./build.sh

Error message (excerpt):

/usr/bin/ld: lib/libv_v_kafka_protocol.a(fetch_response.cc.o): in function `std::vector<kafka::fetchable_topic_response, std::allocator<kafka::fetchable_topic_response> > kafka::request_reader::do_read_array<kafka::fetch_response_data::decode(iobuf, detail::base_named_type<short, kafka::kafka_requests_api_version, std::integral_constant<bool, true> >)::$_0, kafka::fetchable_topic_response>(int, kafka::fetch_response_data::decode(iobuf, detail::base_named_type<short, kafka::kafka_requests_api_version, std::integral_constant<bool, true> >)::$_0&&)':
fetch_response.cc:(.text+0x166c): undefined reference to `vtable for kafka::batch_reader'
/usr/bin/ld: lib/libv_v_kafka_protocol.a(fetch_response.cc.o): in function `kafka::request_reader::read_nullable_batch_reader()':
fetch_response.cc:(.text._ZN5kafka14request_reader26read_nullable_batch_readerEv[_ZN5kafka14request_reader26read_nullable_batch_readerEv]+0x2a1): undefined reference to `vtable for kafka::batch_reader'
fetch_response.cc:(.text._ZN5kafka14request_reader26read_nullable_batch_readerEv[_ZN5kafka14request_reader26read_nullable_batch_readerEv]+0x2a1): undefined reference to `vtable for kafka::batch_reader'
clang-16: error: linker command failed with exit code 1 (use -v to see invocation)

Could anyone help?

ocadaruma avatar Aug 15 '22 03:08 ocadaruma

To summarize the state of things:

  • toolchain images on dockerhub are badly out of date, avoid them
  • install-dependencies.sh is relying on your distro's clang/llvm version, and if that doesn't happen to be llvm 15, you will have problems compiling.

I recognize that this is a painful experience at present: it is likely that to resolve it we're going to end up revoking that stale docker image, and updating the install-dependencies.sh script to install the proper llvm version from upstream.

jcsp avatar Aug 15 '22 07:08 jcsp