diff --git a/go/private/actions/link.bzl b/go/private/actions/link.bzl index 18dd1f94ad..3b15c3df99 100644 --- a/go/private/actions/link.bzl +++ b/go/private/actions/link.bzl @@ -140,6 +140,18 @@ def emit_link( ])) extldflags.extend(cgo_rpaths) + # BUG: Have we forgotten about the .a files? + for f in archive.cgo_deps.to_list(): + extldflags.extend([ + "-L", f.dirname, + # This shenaningan converts "libzmq.a" into "-lzmq" as one would + # want in a CC command line. + "-l{}".format(f.basename[3:-2])] + ) + # We will need to link with stdc++ too if we want C++ stdlib to work. + # This is probably not correct for C programs. What to do? + extldflags.extend(["-lstdc++"]) + # Process x_defs, and record whether stamping is used. stamp_x_defs_volatile = False stamp_x_defs_stable = False @@ -188,6 +200,7 @@ def emit_link( ] inputs = depset(direct = inputs_direct, transitive = inputs_transitive) + go.actions.run( inputs = inputs, outputs = [executable],