Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Project no longer builds #9

Open
niloc132 opened this issue Feb 27, 2025 · 4 comments
Open

Project no longer builds #9

niloc132 opened this issue Feb 27, 2025 · 4 comments

Comments

@niloc132
Copy link

While other j2cl projects have been updated recently, it looks like this one was forgotten - currently building any target (e.g. bazel build //java/com/google/protobuf/contrib/j2cl:options) in the project seems to fail with this error:

DEBUG: Rule 'com_google_j2cl' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "17704ea099197e5de46e034ee35df8f9c16a01cb9b6e6b11f795c3f4bcf7b1df"
DEBUG: Repository com_google_j2cl instantiated at:
  /home/colin/workspace/j2cl-protobuf/WORKSPACE:8:13: in <toplevel>
Repository rule http_archive defined at:
  /home/colin/.cache/bazel/_bazel_colin/7d776fecbd1b1fdebdadc57b97213dee/external/bazel_tools/tools/build_defs/repo/http.bzl:353:31: in <toplevel>
ERROR: error loading package '': cannot load '@com_google_j2cl//build_defs:repository.bzl': no such file
INFO: Elapsed time: 0.067s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)

Changing WORKSPACE with the following diff gets further - some basic targets can be built, but not all of //java/...

diff --git a/WORKSPACE b/WORKSPACE
index bb2b12a..9a122e5 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -3,12 +3,12 @@ workspace(name = "com_google_j2cl_protobuf")
 load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
 
 # Load J2CL separately
-_J2CL_VERSION = "master"
+_J2CL_VERSION = "20230718"
 
 http_archive(
     name = "com_google_j2cl",
     strip_prefix = "j2cl-%s" % _J2CL_VERSION,
-    url = "https://github.com/google/j2cl/archive/%s.zip" % _J2CL_VERSION,
+    url = "https://github.com/google/j2cl/archive/v%s.zip" % _J2CL_VERSION,
 )
 
 load("@com_google_j2cl//build_defs:repository.bzl", "load_j2cl_repo_deps")

Next error:

ERROR: /home/colin/.cache/bazel/_bazel_colin/7d776fecbd1b1fdebdadc57b97213dee/external/com_google_jsinterop_base/third_party/BUILD:10:6: no such package '@maven//': The repository '@maven' could not be resolved: Repository '@maven' is not defined and referenced by '@com_google_jsinterop_base//third_party:jspecify_annotations'
ERROR: Analysis of target '//java/com/google/protobuf/contrib/j2cl/runtime:jspb-utils' failed; build aborted: 
INFO: Elapsed time: 4.344s
INFO: 0 processes.

Unlike j2cl, jsinterop-base doesn't use a v prefix for git tags, so the patch is simpler:

diff --git a/repository.bzl b/repository.bzl
index eb7b155..372cb17 100644
--- a/repository.bzl
+++ b/repository.bzl
@@ -2,7 +2,7 @@
 
 load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
 
-_JSINTEROP_BASE_VERSION = "master"
+_JSINTEROP_BASE_VERSION = "1.0.1"
 
 def load_j2cl_proto_repo_deps():
     http_archive(

A little later, I've got another error (from a clean --expunge build, so I don't think it is a stale .so built as part of compiling a fresh local protoc):

ERROR: /home/colin/.cache/bazel/_bazel_colin/7d776fecbd1b1fdebdadc57b97213dee/external/com_google_protobuf/BUILD:356:15: Generating immutable_js_proto files failed: (Exit 127): bash failed: error executing command /bin/bash -c ... (remaining 1 argument skipped)
bazel-out/k8-opt-exec-2B5CBBC6/bin/external/io_bazel_rules_closure/third_party/llvm/llvm/tools/clang/clang-format: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
INFO: Elapsed time: 80.625s, Critical Path: 49.15s
INFO: 667 processes: 82 internal, 531 local, 54 worker.

Failing on linux:

$ uname -a                                          
Linux runes 6.13.2-arch1-1 #1 SMP PREEMPT_DYNAMIC Sat, 08 Feb 2025 18:54:55 +0000 x86_64 GNU/Linux

Macos gets further, passes bazel build //java/..., and bazel build javatests/com/google/protobuf/contrib/immutablejs/{protos,integration,runtime}/..., which is enough to satisfy build_test.sh.

@gkdn
Copy link
Member

gkdn commented Feb 27, 2025

The repo has been stale for long, didn't support an official serialization format and I don't think there has been much interest to it. Given closure library and bzlmod changes it might not be trivial to fix it.

Did you just come across or was it used by one of your projects?

@niloc132
Copy link
Author

I've been looking for an excuse to use this, and may have found one (though I need binary serialization). I still have never seen bazel used in the wild, so it would be maven/gradle/protoc/etc, but was hoping to at least build some "helloworld.proto" and staple some of my already-working grpc-in-gwt (like https://github.com/grpc/grpc-web/ but supports streaming in either direction, and binary payloads) code to it and see what all makes it through the compiler to experiment with.

It might be worth just merging the two changes I proposed above which gets it pinned to an old j2cl and jsinterop-base tag, then put a note in the readme about it? I probably have what I need for some light evaluation. With those two changes, at least on a mac the build_test.sh will pass, though I only tested from the one linux box.

@gkdn
Copy link
Member

gkdn commented Feb 27, 2025

I think we can pin and a note about it @kevinoconnor7

@kevinoconnor7
Copy link
Collaborator

Since we have no intention of keeping this repo in working order I'll probably go ahead and archive it to make that intention clear.

Before doing so I'll update the readme and get things pinned to approximately the last working version.

If we decide to revisit this space in the future we can certainly revive the repo.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants