Skip to content

Commit

Permalink
BUGFIX: Adds the static libraries from cgo_deps to the link command line
Browse files Browse the repository at this point in the history
Not sure why this wasn't added here.
  • Loading branch information
filmil committed Oct 7, 2024
1 parent 9741b36 commit 70ee7e8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions go/private/actions/link.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -188,6 +200,7 @@ def emit_link(
]
inputs = depset(direct = inputs_direct, transitive = inputs_transitive)


go.actions.run(
inputs = inputs,
outputs = [executable],
Expand Down

0 comments on commit 70ee7e8

Please sign in to comment.