Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
cmd/link: external linking does not link dynamic libraries without cgo #42459
https://golang.org/cl/232397 removes the cgo implementation from crypto/x509, which was preserved just for test purposes.
In doing so it seems to have broken external linking.
I suppose the build was relying on the
Thanks for reporting. I can reproduce on the current tip with
I agree it is related to the LDFLAGS. One way is that you could add
to one of the non-cgo files (e.g. crypto/x509/internal/macos/corefoundation.go). (You have to do one flag a line, sorry.)
cc @ianlancetaylor about using cgo_ldflag in non-cgo-generated files. (It is still limited to the standard library by the compiler.)
I don't know there is anyway for the linker to add those flags automatically in general. (Another possibility is to pass them in the command line, as
Ideas welcome :)