Description
Summary
I failed to integrate wasmer-go to other project using bazel, both from remote and local.
Could anyone solve this?
Additional details
I am trying to use wasmer-go as a third party library but have a problem with bazel build.
The project (let me call it project X) I am trying to integrate wasmer-go to uses bazel. I added following lines to WORKSPACE
of project X
go_repository(
name = "com_github_wasmer_go",
importpath = "github.com/wasmerio/wasmer-go",
commit = "..."
)
and I added the following line to deps
in corresponding BUILD
file where a Go file importing wasmer-go exists
"@com_github_wasmer_go//wasmer:go_default_library"
but still get this error
ERROR: .... no such package '@com_github_wasmer_go//wasmer': BUILD file not found in directory 'wasmer' of external repository @com_github_wasmer_go. Add a BUILD file to a directory to mark it as a package. and referenced by ....
I see wasmer/
directory doesn't have BUILD
file as this error says. Could you tell me how to fix this error?
P.S.
I cloned wasmer-go to local and I changed the BUILD
file of wasmer-go to
load("@bazel_gazelle//:def.bzl", "gazelle")
# gazelle:prefix github.com/wasmerio/wasmer-go
gazelle(name = "gazelle")
package(default_visibility = ["//visibility:public"])
and ran bazel run gazelle
, and then modified the WORKSPACE
and BUILD
file of the project X to use the local wasmer-go. Now I get this strange error when I compile with bazel build <target>
Use --sandbox_debug to see verbose messages from the sandbox
<file>: undefined: wasmer.Instance
<file>: undefined: wasmer.NewEngine
...
compilepkg: error running subcommand external/go_sdk/pkg/tool/linux_amd64/compile: exit status 2