maliput / drake_ros_buildfarm

ROS packaging for building Drake into the ros_buildfarm
0 stars 0 forks source link

Try to build Bazel (4.0) in a rootless environment on Ubuntu Jammy #3

Closed j-rivero closed 1 year ago

j-rivero commented 1 year ago

Part of #1

After the works in #2 we probably require Bazel 4.0 to build Drake on Ubuntu Jammy. The Bazel from source compilation uses a previous version of Bazel to bootstrap new Bazel so there is a chance that we can build Bazel 4.0 under a non root account using the system 3.5.1 version on Ubuntu Jammy and use that version to compile Drake instead of the system one.

j-rivero commented 1 year ago

A quick run for testing shown that it should be possible but there are compilers errors:

#10 41.75 INFO: Analyzed target //src:bazel-dev (326 packages loaded, 8662 targets configured).
#10 41.76 INFO: Found 1 target...
#10 41.91 [0 / 638] [Prepa] Writing file src/embedded_tools_jdk_allmodules.params
#10 49.06 [19 / 834] Compiling external/com_google_protobuf/src/google/protobuf/arena.cc; 1s processwrapper-sandbox ... (3 actions, 2 running)
#10 56.50 [37 / 834] Compiling external/com_google_protobuf/src/google/protobuf/generated_message_table_driven_lite.cc; 2s processwrapper-sandbox ... (4 actions, 3 running)
#10 64.69 INFO: From Compiling external/com_google_protobuf/src/google/protobuf/message_lite.cc [for host]:
#10 64.71 In file included from /usr/include/string.h:535,
#10 64.71                  from external/com_google_protobuf/src/google/protobuf/stubs/port.h:39,
#10 64.71                  from external/com_google_protobuf/src/google/protobuf/stubs/macros.h:34,
#10 64.71                  from external/com_google_protobuf/src/google/protobuf/stubs/common.h:46,
#10 64.71                  from external/com_google_protobuf/src/google/protobuf/message_lite.h:45,
#10 64.71                  from external/com_google_protobuf/src/google/protobuf/message_lite.cc:36:
#10 64.71 In function 'void* memcpy(void*, const void*, size_t)',
#10 64.71     inlined from 'google::protobuf::uint8* google::protobuf::io::EpsCopyOutputStream::WriteRaw(const void*, int, google::protobuf::uint8*)' at external/com_google_protobuf/src/google/protobuf/io/coded_stream.h:699:16,
#10 64.71     inlined from 'virtual google::protobuf::uint8* google::protobuf::internal::ImplicitWeakMessage::_InternalSerialize(google::protobuf::uint8*, google::protobuf::io::EpsCopyOutputStream*) const' at external/com_google_protobuf/src/google/protobuf/implicit_weak_message.h:85:28,
#10 64.71     inlined from 'bool google::protobuf::MessageLite::SerializePartialToZeroCopyStream(google::protobuf::io::ZeroCopyOutputStream*) const' at external/com_google_protobuf/src/google/protobuf/message_lite.cc:419:30:
#10 64.71 /usr/include/x86_64-linux-gnu/bits/string_fortified.h:29:33: warning: 'void* __builtin___memcpy_chk(void*, const void*, long unsigned int, long unsigned int)' specified size between 18446744071562067968 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
#10 64.71    29 |   return __builtin___memcpy_chk (__dest, __src, __len,
#10 64.71       |          ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
#10 64.71    30 |                                  __glibc_objsize0 (__dest));
#10 64.71       |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~
#10 64.73 [59 / 834] Compiling external/com_google_protobuf/src/google/protobuf/repeated_field.cc [for host]; 2s processwrapper-sandbox ... (4 actions, 3 running)
#10 74.03 [76 / 834] Compiling external/com_google_protobuf/src/google/protobuf/generated_message_util.cc [for host]; 3s processwrapper-sandbox ... (4 actions, 3 running)
#10 84.76 [171 / 834] Compiling external/com_github_grpc_grpc/src/core/lib/debug/trace.cc; 0s processwrapper-sandbox ... (4 actions, 3 running)
#10 91.23 ERROR: /home/buildfarm/.cache/bazel/_bazel_buildfarm/ee8532c5c69dfff0fd0d0cf9658f23d3/external/com_google_absl/absl/synchronization/BUILD.bazel:30:11: C++ compilation of rule '@com_google_absl//absl/synchronization:graphcycles_internal' failed (Exit 1) gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++0x' -MD -MF ... (remaining 31 argument(s) skipped)
#10 91.23 
#10 91.23 Use --sandbox_debug to see verbose messages from the sandbox
#10 91.23 external/com_google_absl/absl/synchronization/internal/graphcycles.cc: In member function 'void absl::lts_2020_02_25::synchronization_internal::GraphCycles::RemoveNode(void*)':
#10 91.23 external/com_google_absl/absl/synchronization/internal/graphcycles.cc:451:26: error: 'numeric_limits' is not a member of 'std'
#10 91.23   451 |   if (x->version == std::numeric_limits<uint32_t>::max()) {
#10 91.23       |                          ^~~~~~~~~~~~~~
#10 91.23 external/com_google_absl/absl/synchronization/internal/graphcycles.cc:451:49: error: expected primary-expression before '>' token
#10 91.23   451 |   if (x->version == std::numeric_limits<uint32_t>::max()) {
#10 91.23       |                                                 ^
#10 91.23 external/com_google_absl/absl/synchronization/internal/graphcycles.cc:451:52: error: '::max' has not been declared; did you mean 'std::max'?
#10 91.23   451 |   if (x->version == std::numeric_limits<uint32_t>::max()) {
#10 91.23       |                                                    ^~~
#10 91.23       |                                                    std::max
#10 91.23 In file included from /usr/include/c++/11/algorithm:62,
#10 91.23                  from external/com_google_absl/absl/synchronization/internal/graphcycles.cc:38:
#10 91.23 /usr/include/c++/11/bits/stl_algo.h:3467:5: note: 'std::max' declared here
#10 91.23  3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
#10 91.23       |     ^~~
#10 91.37 Target //src:bazel-dev failed to build
#10 91.38 Use --verbose_failures to see the command lines of failed build steps.

Seems to be reported in https://github.com/bazelbuild/bazel/issues/12756. Still open.

j-rivero commented 1 year ago

Patching it is able to compile :rocket: around 21 min in Intel(R) Core(TM) i5-4308U CPU @ 2.80GHz old MacMini.