Skip to content

Commit 70ee7e8

Browse files
committed
BUGFIX: Adds the static libraries from cgo_deps to the link command line
Not sure why this wasn't added here.
1 parent 9741b36 commit 70ee7e8

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

go/private/actions/link.bzl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,18 @@ def emit_link(
140140
]))
141141
extldflags.extend(cgo_rpaths)
142142

143+
# BUG: Have we forgotten about the .a files?
144+
for f in archive.cgo_deps.to_list():
145+
extldflags.extend([
146+
"-L", f.dirname,
147+
# This shenaningan converts "libzmq.a" into "-lzmq" as one would
148+
# want in a CC command line.
149+
"-l{}".format(f.basename[3:-2])]
150+
)
151+
# We will need to link with stdc++ too if we want C++ stdlib to work.
152+
# This is probably not correct for C programs. What to do?
153+
extldflags.extend(["-lstdc++"])
154+
143155
# Process x_defs, and record whether stamping is used.
144156
stamp_x_defs_volatile = False
145157
stamp_x_defs_stable = False
@@ -188,6 +200,7 @@ def emit_link(
188200
]
189201
inputs = depset(direct = inputs_direct, transitive = inputs_transitive)
190202

203+
191204
go.actions.run(
192205
inputs = inputs,
193206
outputs = [executable],

0 commit comments

Comments
 (0)