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

BUGFIX: Adds the static libraries from cgo_deps to the link command line #4134

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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