Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Using RPC lib with bazel in v1 #1946

Open
thegreathir opened this issue Feb 16, 2024 · 5 comments
Open

Using RPC lib with bazel in v1 #1946

thegreathir opened this issue Feb 16, 2024 · 5 comments

Comments

@thegreathir
Copy link

Hi,
I'm using v1, and I'm using Capnp in a bazel project with something like this in my WORKSPACE:

http_archive(
    name = "capnp-cpp",
    sha256 = "3cfd0ed58080d78b3a3381305489f2175cdaf1ef1cb55425d8fc8246a76bdff3",
    strip_prefix = "capnproto-1.0.2/c++",
    urls = [
        "https://github.com/capnproto/capnproto/archive/refs/tags/v1.0.2.tar.gz",
    ],
)

Everything works great concerning serialization, but I'm unable to use EzRpc.

I add something like this to my cc_binary:

deps = [
    "@capnp-cpp//src/capnp:capnp-rpc",
]

(that it's so unpleasant itself since I don't want to have src in target name)

The problem is it can't be built due:

capnp/ez-rpc.h:25:10: fatal error: message.h: No such file or directory

Seems ez-rpc.h is including message.h relatively.

@kentonv
Copy link
Member

kentonv commented Feb 20, 2024

This is the same problem discussed in #1942. The include needs to be changed to <capnp/message.h> to work in Bazel. It hasn't been noticed because the Bazel files were written specifically for use in workerd, which doesn't use ez-rpc. I'm happy to accept a PR (against the master branch) updating the include.

@thegreathir
Copy link
Author

OK,
Is this the only file that should be fixed?
I'm going to provide a PR
And it wasn't easy for me to figure out how low level api works (without using ez-rpc). It would be nice to have an example.

Also what's your opinion about capnp-cpp//src/capnp:capnp-rpc,
Are you using like that in your project?
I'm not happy with the prefix path...
It would be nice to bind it or something for better exposure.

@kentonv
Copy link
Member

kentonv commented Feb 20, 2024

These bazel files were not carefully designed for public consumption. They were added to support workerd specifically (the team that builds workerd is also the team that maintains Cap'n Proto). There is probably a lot that could be improved, especially in terms of aesthetics.

That said, yes, things like @capnp-cpp//src/capnp:capnp-rpc appear in workerd's build files, and it hasn't been a problem.

@thegreathir
Copy link
Author

Would you accept PR related to example with low-level APIS?

Btw do you guys care about v1 anymore?

@kentonv
Copy link
Member

kentonv commented Feb 21, 2024

Would you accept PR related to example with low-level APIS?

FWIW the v2 branch has actually removed ez-rpc and updated the samples to use the lower-level APIs already.

Btw do you guys care about v1 anymore?

v1 is in maintenance mode, we care about fixing bugs but probably won't be adding new features to it.

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

No branches or pull requests

2 participants