Created attachment 228573 [details] patch bazel uses a bundled abseil. To build on powerpc*, abseil requires a trivial patch. However, since abseil is bundled, it needs to be patched in bazel's source. Then its sha256 needs to be updated. grpc also has abseil's sha256 bundled, so it also needs to be updated. Then grpc's hash too needs to be updated. For the record, the error is: In file included from external/com_google_absl/absl/base/internal/unscaledcycleclock.cc:27: /usr/include/sys/sysctl.h:1185:25: error: unknown type name 'u_int' int sysctl(const int *, u_int, void *, size_t *, const void *, size_t); ^ external/com_google_absl/absl/base/internal/unscaledcycleclock.cc:91:10: error: unknown type name 'once_flag' static once_flag init_timebase_frequency_once; ^ external/com_google_absl/absl/base/internal/unscaledcycleclock.cc:93:18: error: no member named 'LowLevelCallOnce' in namespace 'absl::lts_2020_02_25::base_internal' base_internal::LowLevelCallOnce(&init_timebase_frequency_once, [&]() { ~~~~~~~~~~~~~~~^
Thanks for looking into the build failures of bazel on powerpc. As I don't have that architecture, I appreciate your help. With respect to the the patch, I think, something went wrong during generation or upload: it mentions ${FILESDIR}/extra-patch-absl_base_internal_unscaledcycleclock.cc but does not add that file (as if the -N option was missing in the invocation of `diff`). Concerning the way the patch is added to the build, I think the approach of unpacking and repacking distfiles (in this case the bundled ones) is very maintainable. As - bazel includes grpc as an http_archive, - grp includes abseil as an http_archive, and - bazel's http_archive supports patching[1] I would use that official bazel mechanism to add the patch to the build. More precisely, I would do the following. At pre (or even post) patch time copy the extra patch files to ${WRKSRC}/third_party/grpc. Patch line 1235 of the ${WRKSRC}/WORKSPACE to include an additional patch after the patch mentioned there already. That patch patches bazel/grpc_deps.bzl to change the definition of the http_archive of abseil to include your patch (by adding the patches attribute). It has to be a p0 patch relative to grpc's root. What do you think? In my opinion, using bazel's official patching mechanism in the described way, the port stays easier to adapt on updates of bazel. Should we do it like this? Can you update your patch accordingly? Thanks again for caring about the bazel port. Klaus [1] https://docs.bazel.build/versions/main/repo/http.html#http_archive
Created attachment 228589 [details] v2 Thanks for your quick reply. Please have a look at the attached patch.
Created attachment 228590 [details] v3 Remove the previous (commented out) method of patching.
Created attachment 228591 [details] v4 Add @ before CP to silence it and merge two CP's into one.
Comment on attachment 228591 [details] v4 Thanks for cleaning up patch. Looks good now! And thank you for taking care of the powerpc architecture.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=8abf3fd74456a955857e83bb337184d62d27a90c commit 8abf3fd74456a955857e83bb337184d62d27a90c Author: Piotr Kubaj <pkubaj@FreeBSD.org> AuthorDate: 2021-10-12 18:37:02 +0000 Commit: Piotr Kubaj <pkubaj@FreeBSD.org> CommitDate: 2021-10-12 18:37:02 +0000 devel/bazel: fix build on powerpc* bazel uses a bundled abseil. To build on powerpc*, abseil requires a trivial patch. In file included from external/com_google_absl/absl/base/internal/unscaledcycleclock.cc:27: /usr/include/sys/sysctl.h:1185:25: error: unknown type name 'u_int' int sysctl(const int *, u_int, void *, size_t *, const void *, size_t); ^ external/com_google_absl/absl/base/internal/unscaledcycleclock.cc:91:10: error: unknown type name 'once_flag' static once_flag init_timebase_frequency_once; ^ external/com_google_absl/absl/base/internal/unscaledcycleclock.cc:93:18: error: no member named 'LowLevelCallOnce' in namespace 'absl::lts_2020_02_25::base_internal' base_internal::LowLevelCallOnce(&init_timebase_frequency_once, [&]() { ~~~~~~~~~~~~~~~^ PR: 259056 Approved by: ehlig@linta.de (maintainer) devel/bazel/Makefile | 5 +++++ ...ra-patch-absl_base_internal_unscaledcycleclock.cc (new) | 14 ++++++++++++++ devel/bazel/files/extra-patch-bazel_grpc__deps.bzl (new) | 10 ++++++++++ devel/bazel/files/patch-WORKSPACE (new) | 14 ++++++++++++++ 4 files changed, 43 insertions(+)
Committed, thanks!