You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's failing to build on the last step with duplicate symbols:
duplicate symbol _snappy_compress in:
/var/folders/3d/ymqb8kcx5jv4s2gsqy7rd83h0000gn/T/go-link-410495653/000000.o
/var/folders/3d/ymqb8kcx5jv4s2gsqy7rd83h0000gn/T/go-link-410495653/000003.o
I can also reproduce on linux; here's a travis build.
The issue seems to be that I have a diamond dependency on a local static library. I vendor and build a version of snappy, which is in turn used by sparkey, which I also build, and that is in turn used by a vendored version of go-sparkey, which is used in my app.
That had all been working fine (you can check out the 1.0 branch to see it in action). The issue arose when I introduced another dependency on snappy, in sequencefile/snappy.go. Then the build started breaking.
To summarize, the dependency graph looks like this (see the Makefile for reference):
Everything was working before I added the brach on the right; the linked commit contains the full set of changes that break the build.
Thanks in advance for the help! Sorry this is gnarly.
The text was updated successfully, but these errors were encountered:
ianlancetaylor
changed the title
Diamond CGO dependency produces a symbol collision
cmd/go: diamond CGO dependency produces a symbol collision
Jul 22, 2016
One step of the cgo build is to take the .o files that have been generated so far for the package (containing the Go-specific wrappers) and merge them into one by using (I am simplifying a little):
$CC -o _all.o *.o $CGO_LDFLAGS
The $CGO_LDFLAGS in this invocation has -l arguments stripped out, precisely to avoid this problem, but not explicit paths like foo.a. I believe that if you change your CGO_LDFLAGS to:
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?What operating system and processor architecture are you using (
go env
)?What did you do?
compressed-sequencefiles
branch)make sequins
.What did you expect to see?
Successful build output!
What did you see instead?
It's failing to build on the last step with duplicate symbols:
I can also reproduce on linux; here's a travis build.
The issue seems to be that I have a diamond dependency on a local static library. I vendor and build a version of snappy, which is in turn used by sparkey, which I also build, and that is in turn used by a vendored version of go-sparkey, which is used in my app.
That had all been working fine (you can check out the
1.0
branch to see it in action). The issue arose when I introduced another dependency on snappy, insequencefile/snappy.go
. Then the build started breaking.To summarize, the dependency graph looks like this (see the Makefile for reference):
Everything was working before I added the brach on the right; the linked commit contains the full set of changes that break the build.
Thanks in advance for the help! Sorry this is gnarly.
The text was updated successfully, but these errors were encountered: