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

Golang 1.9 build warning : Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking #21421

Closed
ghost opened this issue Aug 13, 2017 · 7 comments

Comments

@ghost
Copy link

ghost commented Aug 13, 2017

    go build -ldflags "-linkmode external -extldflags -static" -v
 ---> Running in 6b61be97025f
github.com/aws/aws-sdk-go (download)
github.com/elazarl/go-bindata-assetfs (download)
github.com/fvbock/endless (download)
github.com/gin-gonic/gin (download)
github.com/gin-contrib/sse (download)
github.com/golang/protobuf (download)
github.com/ugorji/go (download)
Fetching https://gopkg.in/go-playground/validator.v8?go-get=1
Parsing meta tags from https://gopkg.in/go-playground/validator.v8?go-get=1 (status code 200)
get "gopkg.in/go-playground/validator.v8": found meta tag get.metaImport{Prefix:"gopkg.in/go-playground/validator.v8", VCS:"git", RepoRoot:"https://gopkg.in/go-playground/validator.v8"} at https://gopkg.in/go-playground/validator.v8?go-get=1
gopkg.in/go-playground/validator.v8 (download)
Fetching https://gopkg.in/yaml.v2?go-get=1
Parsing meta tags from https://gopkg.in/yaml.v2?go-get=1 (status code 200)
get "gopkg.in/yaml.v2": found meta tag get.metaImport{Prefix:"gopkg.in/yaml.v2", VCS:"git", RepoRoot:"https://gopkg.in/yaml.v2"} at https://gopkg.in/yaml.v2?go-get=1
gopkg.in/yaml.v2 (download)
github.com/mattn/go-isatty (download)
github.com/golang/groupcache (download)
github.com/naoina/toml (download)
github.com/naoina/go-stringutil (download)
github.com/netroby/feeds (download)
github.com/netroby/mysql (download)
github.com/jteeuwen/go-bindata (download)
github.com/jteeuwen/go-bindata
github.com/jteeuwen/go-bindata/go-bindata
github.com/elazarl/go-bindata-assetfs
github.com/elazarl/go-bindata-assetfs/go-bindata-assetfs
github.com/aws/aws-sdk-go/aws/awserr
github.com/aws/aws-sdk-go/internal/shareddefaults
github.com/aws/aws-sdk-go/aws/client/metadata
github.com/aws/aws-sdk-go/vendor/github.com/go-ini/ini
github.com/aws/aws-sdk-go/vendor/github.com/jmespath/go-jmespath
github.com/fvbock/endless
github.com/aws/aws-sdk-go/aws/endpoints
gosense/vendor/github.com/garyburd/redigo/internal
gosense/vendor/github.com/garyburd/redigo/redis
github.com/aws/aws-sdk-go/aws/credentials
github.com/aws/aws-sdk-go/aws/awsutil
gosense/vendor/github.com/gorilla/securecookie
gosense/vendor/github.com/gorilla/context
github.com/gin-contrib/sse
gosense/vendor/github.com/gorilla/sessions
github.com/gin-gonic/gin/json
github.com/golang/protobuf/proto
github.com/ugorji/go/codec
gosense/vendor/github.com/boj/redistore
github.com/aws/aws-sdk-go/aws
gopkg.in/go-playground/validator.v8
github.com/aws/aws-sdk-go/aws/request
gopkg.in/yaml.v2
github.com/aws/aws-sdk-go/aws/client
github.com/aws/aws-sdk-go/aws/corehandlers
github.com/aws/aws-sdk-go/private/protocol/rest
github.com/aws/aws-sdk-go/private/protocol
github.com/aws/aws-sdk-go/private/protocol/query/queryutil
github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil
github.com/aws/aws-sdk-go/aws/signer/v4
github.com/aws/aws-sdk-go/private/protocol/query
github.com/aws/aws-sdk-go/aws/ec2metadata
github.com/aws/aws-sdk-go/service/sts
github.com/aws/aws-sdk-go/aws/credentials/endpointcreds
github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds
github.com/aws/aws-sdk-go/private/protocol/restxml
github.com/aws/aws-sdk-go/aws/defaults
github.com/aws/aws-sdk-go/aws/credentials/stscreds
github.com/aws/aws-sdk-go/service/s3
github.com/mattn/go-isatty
github.com/golang/groupcache/lru
github.com/naoina/go-stringutil
github.com/aws/aws-sdk-go/aws/session
github.com/naoina/toml/ast
github.com/naoina/toml
github.com/netroby/feeds
github.com/netroby/mysql
github.com/gin-gonic/gin/binding
github.com/gin-gonic/gin/render
github.com/gin-gonic/gin
gosense/vendor/github.com/gin-gonic/contrib/sessions
gosense
# gosense
/tmp/go-link-809436522/000000.o: In function `_cgo_b0c710f30cfd_C2func_getaddrinfo':
/tmp/go-build/net/_obj/cgo-gcc-prolog:46: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

@ghost ghost changed the title Golang 1.9 build warning : Golang 1.9 build warning : Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking Aug 13, 2017
@davecheney
Copy link
Contributor

@netroby Does this warning occur with previous versions of Go?

@ghost
Copy link
Author

ghost commented Aug 13, 2017

1.7 is fine

Sent from my Xiaomi Mi Note 2 using FastHub

@davecheney
Copy link
Contributor

davecheney commented Aug 13, 2017 via email

@ghost
Copy link
Author

ghost commented Aug 13, 2017

later this day

Sent from my Xiaomi Mi Note 2 using FastHub

@ghost
Copy link
Author

ghost commented Aug 13, 2017

Hello, @davecheney , golang 1.8.3 tested, and it was ok to compile without any errors

scw-4df604 gosense (master) # go build -ldflags "-linkmode external -extldflags -static" -v
github.com/netroby/gosense
scw-4df604 gosense (master) # go version
go version go1.8.3 linux/amd64

@davecheney
Copy link
Contributor

Thank you, I have verified the warning from gcc

lucky(~/src/github.com/pkg/sftp) % go build -ldflags "-linkmode external -extldflags -static" -v github.com/netroby/gosense
github.com/aws/aws-sdk-go/aws/awserr
github.com/aws/aws-sdk-go/vendor/github.com/go-ini/ini
github.com/aws/aws-sdk-go/aws/client/metadata
github.com/aws/aws-sdk-go/vendor/github.com/jmespath/go-jmespath
github.com/aws/aws-sdk-go/private/endpoints
github.com/fvbock/endless
github.com/garyburd/redigo/internal
github.com/garyburd/redigo/redis
github.com/aws/aws-sdk-go/aws/credentials
github.com/aws/aws-sdk-go/aws
github.com/gorilla/securecookie
github.com/aws/aws-sdk-go/aws/awsutil
github.com/gorilla/context
github.com/gin-contrib/sse
github.com/aws/aws-sdk-go/aws/request
github.com/gin-gonic/gin/json
github.com/gorilla/sessions
github.com/golang/protobuf/proto
github.com/ugorji/go/codec
github.com/boj/redistore
github.com/aws/aws-sdk-go/aws/client
github.com/aws/aws-sdk-go/aws/corehandlers
github.com/aws/aws-sdk-go/aws/ec2metadata
github.com/aws/aws-sdk-go/aws/credentials/endpointcreds
github.com/aws/aws-sdk-go/private/protocol/rest
github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds
github.com/aws/aws-sdk-go/private/protocol
github.com/aws/aws-sdk-go/private/protocol/query/queryutil
github.com/aws/aws-sdk-go/aws/defaults
github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil
github.com/aws/aws-sdk-go/aws/signer/v4
github.com/aws/aws-sdk-go/private/waiter
gopkg.in/go-playground/validator.v8
github.com/aws/aws-sdk-go/aws/session
github.com/aws/aws-sdk-go/private/protocol/query
gopkg.in/yaml.v2
github.com/aws/aws-sdk-go/private/protocol/restxml
github.com/mattn/go-isatty
github.com/golang/groupcache/lru
github.com/naoina/go-stringutil
github.com/aws/aws-sdk-go/service/s3
github.com/naoina/toml/ast
github.com/gin-gonic/gin/binding
github.com/naoina/toml
github.com/netroby/feeds
github.com/netroby/mysql
github.com/gin-gonic/gin/render
github.com/gin-gonic/gin
github.com/gin-gonic/contrib/sessions
github.com/netroby/gosense
# github.com/netroby/gosense
/tmp/go-link-376843605/000000.o: In function `_cgo_b0c710f30cfd_C2func_getaddrinfo':
/tmp/go-build/net/_obj/cgo-gcc-prolog:46: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

@ianlancetaylor
Copy link
Member

This is actually a bug fix. In earlier versions of Go the external linker was emitting the warning, but the Go linker was hiding it from you. Can you see this in the earlier versions if you add -v to your -ldflags string. This was fixed for #17935.

Closing because I think the behavior is correct.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants