| Summary: | Enhancement: go.bbclass: allow appending to -ldflags flag | ||
|---|---|---|---|
| Product: | [Build System, Metadata & Runtime] OE-Core | Reporter: | Ahmed Hossam <Ahmed.Hossam> |
| Component: | oe-core other | Assignee: | Ahmed Hossam <Ahmed.Hossam> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | Medium | CC: | randy.macleod, richard.purdie |
| Version: | 3.4 | ||
| Target Milestone: | 4.0 | ||
| Hardware: | x86 | ||
| OS: | Multiple | ||
| Whiteboard: | |||
| OS type for building Yocto: | --- | Type of Regression: | --- |
| Verified: | Documentation change: | Yes (doc changes required) | |
|
Description
Ahmed Hossam
2021-09-17 08:06:10 UTC
Can't you use GO_LDFLAGS:append = "xxx" for this? Ahmen, does Richard's suggestion work for you? If so please close this enhancement. Unfortunately it doesn't work.
The goal is to add parameters inside the '-ldflags' quote, I tried using your suggestion using:
GO_LDFLAGS:append = ' -ldflags="-X main.Version=v1.0.0"'
Which would result in
GO_LDFLAGS = '-ldflags="${GO_RPATH} ${GO_LINKMODE} -extldflags '${GO_EXTLDFLAGS}'" -ldflags="-X main.Version=v1.0.0"'
But that overrode the previous '-ldflags' content, breaking qa
You can try this by adding
GO_LDFLAGS:append = ' -ldflags="-X main.Version=v1.0.0"'
to the end of poky/meta/recipes-extended/go-examples/go-helloworld_0.1.bb and building "bitbake go-helloworld", it will result in qa failures (do_package_qa)
That is why I am suggesting to add a variable *inside* the '-ldflags' quote, i.e. to result in:
GO_LDFLAGS = '-ldflags="${GO_RPATH} ${GO_LINKMODE} -X main.Version=v1.0.0 -extldflags '${GO_EXTLDFLAGS}'"'
with one occurence of '-ldflags'
Maybe someone with better go linker understanding can share a better solution.
Ahmed, can you send the patch to the list? Hey Randy, do I need to assign the bug to someone for integration? Hi Ahmen, Thanks for sending the patch to the list. It can take a while for changes to make it through our QA process and when we are doing a release for 3.4 which was going on last week, it can take even longer. You patch is merged now though: https://git.openembedded.org/openembedded-core/commit/?id=eaa7a61dab9a1d7bb039f16abdd9aacb44faa595 so I've marked this issue as resolved/fixed. Thanks! |