google/go-jsonnet

Need help building the c-bindings

JanosGit opened this issue · 0 comments

I want to integrate jsonnet support into a C++ application, so I want to build the c-bindings. Being no go developer I'm having a hard time getting it build. I'm on Windows right now, but I want to build a macOS version as well.

My first approach was just running

go build .\c-bindings

which returned without errors but unexpectedly created a c-bindings.exe file which is a bit unexpected since I expect it to generate library that I can link against in my application.

My second approach was trying out Bazel as it is recommended as an alternative way to build it and I see that the c-bindings folder contains a BUILD.bazel file. I tried to run

bazel build //c-bindings

which results in an error like this

ERROR: An error occurred during the fetch of repository 'bazel_gazelle_go_repository_config':
   Traceback (most recent call last):
        File "C:/users/janos/_bazel_janos/l5gznqzr/external/bazel_gazelle/internal/go_repository_config.bzl", line 45, column 40, in _go_repository_config_impl
                macro_label = Label("@" + ctx.attr.config.workspace_name + "//:" + f)
Error in Label: invalid label in Label(): invalid target name 'bazel\deps.bzl': target names may not contain '\'

Again, I also have not used Bazel before, so it might be a simple usage error on my side or some misconfiguration or whatever.

Since I only need the libary to integrate it in my C++ application (which is an environment I'm much more familiar with) I'd love to get some instructions on how to build the c-bindings correctly without needing to dive deep into development tools I have never worked with before. Would you consider adding a section with some instructions to the Readme?

I'm using the latest master commit of go-jsonnet and use go 1.20.7