-
Notifications
You must be signed in to change notification settings - Fork 18k
net: sendfile needs -lsendfile for external linker on Solaris #12390
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
Comments
I'm wondering if cmd/link should automatically add -lxxx
given "cgo_import_dynamic libxxx.so"?
/cc @ianlancetaylor
|
I don't understand why we need -lsendfile, but not, say, -lsocket. |
-lsocket is in net/cgo_solaris.go, I wonder if we should add -lsendfile
there.
|
Sounds better. |
@minux cgo_import_dynamic is a directive for internal linking mode. I'm not sure it makes sense for it to affect how the external linker is used. Passing flags to the external linker seems more a job for cgo LDFLAGS or //go:cgo_ldflag. |
CL https://golang.org/cl/14072 mentions this issue. |
Thanks, guys, confirming the problem to be fixed. |
For the record, libsocket, libnsl, and libsendfile may be filter libraries in a future release of Solaris -- typically such libraries are merged into libc. So this change won't cause any problems, as the filter libraries will provide the necessary symbol compatibility, but is unnecessary starting with a future release: https://blogs.oracle.com/rie/entry/shared_object_filters |
CL https://golang.org/cl/14246 mentions this issue. |
Fixes external linking of net/http tests (or anything that uses sendfile). Fixes #12390. Change-Id: Iee08998cf66e7b0ce851db138a00ebae6dc2395e Reviewed-on: https://go-review.googlesource.com/14072 Reviewed-by: Dave Cheney <dave@cheney.net> Reviewed-by: Aram Hăvărneanu <aram@mgk.ro> Reviewed-on: https://go-review.googlesource.com/14246 Run-TryBot: Chris Broadfoot <cbro@golang.org> Reviewed-by: Minux Ma <minux@golang.org>
With Go 1.5.0 on SunOS/amd64 (namely SmartOS), packages employing the external linker and net/* packages (e.g. CouchBase or github.com/mongodb/mongo-tools) will fail due to an undefined 'sendfile' symbol.
The following patch (from pkgsrc's package for go-1.5.0) works around the problem:
https://github.com/jsonn/pkgsrc/blob/37075a88350da1870518cdd61bd6609bbf1c16c5/lang/go/patches/patch-src_net_sendfile__solaris.go
Steps to repeat:
Output:
The text was updated successfully, but these errors were encountered: