-
-
Notifications
You must be signed in to change notification settings - Fork 56
static build problems #62
Comments
This is a binding to libxml2, which requires cgo so CGO_ENABLED=0 does not make sense. |
you are right, I thought I edited this post, I get errors when trying to make a static build with |
Without thinking I just copied your command:
I understand that the above could just be a typo and what not, but just to make sure, can you kindly reproduce this again and paste the actual go command invocation plus the associated logs (doesn't need to be the entire log, just a few lines is fine)? |
thanks for the help, here is the log, works fine when building without static, but I believe we had it configured to try to build static when deployed in docker go build -ldflags '-w -extldflags "-static"' -o ./bin/app ./cmd/app /usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1 |
I have a feeling it's because of this golang/go#26492 Seems like the full solution hasn't landed yet, and for now it will probably be easier if you just edit (possibly via a custom build script that gets invoked when you build your tool) the file
to
|
thanks, I saw that issue as well, wasn't sure if it was related |
If I were you I'd just bite the bullet and run dep ensure then modify the file inplace using sed or perl, then build. I know, not an ideal solution but it should work |
not sure if that worked $ mv clib.go.custom /go/src/github.com/myapp/vendor/github.com/lestrrat-go/libxml2/clib/clib.go /usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1 |
There are two problems that you can see in the logs: os/user, and libicu. The os/user problem seems to be referenced from the same issue golang/go#26492, and seems to stem from probably the same cause, and you probably need to use the incantation referenced in the original post on that same issue (or, stop using os/user). For libicu, I'm not sure, but it's something from libxml2 -- I don't get that in my environment :/ |
I referenced this in the README. I believe there's little I can do at this point from libxml2 binding's side to help you guys, so I'm going to close this for now. Feel free to reopen it if you believe that I'm doing something wrong and that I can make things a bit easier for you. Thanks. |
@leonged did you manage to solve this issue? |
I don't remember what I did. I think I just scrapped it. |
When building with
CGO_ENABLED=0
I'm getting
vendor/github.com/lestrrat-go/libxml2/xpath/xpath.go:40:30: undefined: clib.XMLXPathObjectType
vendor/github.com/lestrrat-go/libxml2/xpath/xpath.go:45:9: undefined: clib.XMLXPathObjectFloat64
vendor/github.com/lestrrat-go/libxml2/xpath/xpath.go:50:9: undefined: clib.XMLXPathObjectBool
vendor/github.com/lestrrat-go/libxml2/xpath/xpath.go:74:13: undefined: clib.XMLXPathObjectNodeList
vendor/github.com/lestrrat-go/libxml2/xpath/xpath.go:91:13: undefined: clib.XMLXPathObjectNodeList
vendor/github.com/lestrrat-go/libxml2/xpath/xpath.go:124:2: undefined: clib.XMLXPathFreeObject
vendor/github.com/lestrrat-go/libxml2/xpath/xpath.go:129:14: undefined: clib.XMLXPathCompile
vendor/github.com/lestrrat-go/libxml2/xpath/xpath.go:149:2: undefined: clib.XMLXPathFreeCompExpr
vendor/github.com/lestrrat-go/libxml2/xpath/xpath.go:163:17: undefined: clib.XMLXPathNewContext
vendor/github.com/lestrrat-go/libxml2/xpath/xpath.go:179:9: undefined: clib.XMLXPathContextSetContextNode
vendor/github.com/lestrrat-go/libxml2/xpath/xpath.go:179:9: too many errors
github.com/18F/e-QIP-prototype/api/vendor/github.com/lestrrat-go/libxml2/xsd
vendor/github.com/lestrrat-go/libxml2/xsd/xsd.go:29:15: undefined: clib.XMLSchemaParse
vendor/github.com/lestrrat-go/libxml2/xsd/xsd.go:40:15: undefined: clib.XMLSchemaParseFromFile
vendor/github.com/lestrrat-go/libxml2/xsd/xsd.go:55:12: undefined: clib.XMLSchemaFree
vendor/github.com/lestrrat-go/libxml2/xsd/xsd.go:65:10: undefined: clib.XMLSchemaValidateDocument
The text was updated successfully, but these errors were encountered: