docker-compose: fix textrel QA issue
PATCH 1/1 docker-compose: fix textrel QA issue
From: Chen Qi <[email protected]>
Fix textrel QA issue like below:
ERROR: QA Issue: docker-compose: ELF binary /usr/lib/docker/cli-plugins/
docker-compose has relocations in .text [textrel]
The problem could be fixed by adding -buildmode=pie, as this option has already been in GOBUILDFLAGS except for mips and riscv32, let's make use of GOBUILDFLAGS.
Also, make use of GO_EXTRA_LDFLAGS to hold our this recipe's specific ldflags.
--- recipes-containers/docker-compose/docker-compose_git.bb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
recipes-containers/docker-compose/docker-compose_git.bb +3 -4
@@ -40,6 +40,8 @@ PACKAGECONFIG ?= "" include relocation.inc +GOBUILDFLAGS:append = " -mod=vendor" +GO_EXTRA_LDFLAGS = "-s -w -X internal.Version=${PV} -X ${COMPOSE_PKG}/internal.Version=${PV}" do_compile() { cd ${S}/src/import
@@ -52,17 +54,14 @@ do_compile() { export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}" export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" - export GOFLAGS="-mod=vendor -trimpath" - # our copied .go files are to be used for the build ln -sf vendor.copy vendor # inform go that we know what we are doing cp ${WORKDIR}/modules.txt vendor/ - GO_LDFLAGS="-s -w -X internal.Version=${PV} -X ${COMPOSE_PKG}/internal.Version=${PV}" GO_BUILDTAGS="" mkdir -p ./bin - ${GO} build $GOFLAGS -tags "$GO_BUILDTAGS" -ldflags "$GO_LDFLAGS" -o ./bin/docker-compose ./cmd + ${GO} build ${GOBUILDFLAGS} -tags "$GO_BUILDTAGS" -o ./bin/docker-compose ./cmd } do_install() {
Signature · 1 line
2.40.0
In message: [meta-virtualization][PATCH] docker-compose: fix textrel QA issue
Quoted 10 lines · on 17/09/2023 Chen Qi via lists.yoctoproject.org wrote:
From: Chen Qi <[email protected]>
Fix textrel QA issue like below:
ERROR: QA Issue: docker-compose: ELF binary
/usr/lib/docker/cli-plugins/
docker-compose has relocations in .text [textrel]The problem could be fixed by adding -buildmode=pie, as this option has already been in GOBUILDFLAGS except for mips and riscv32, let's make use of GOBUILDFLAGS.
I tend to not use (or like) the defaults in the bbclass, but in this case, it is probably ok.
Quoted 2 lines
Also, make use of
GO_EXTRA_LDFLAGSto hold our this recipe's specific ldflags.
I much prefer the explicit GO_LDFLAGS on the build line, versus the internally consumed GO_EXTRA_LDFLAGS. So I'd prefer to keep that as-is.
Bruce
Quoted 51 lines
Signed-off-by Chen Qi <[email protected]>--- recipes-containers/docker-compose/docker-compose_git.bb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)recipes-containers/docker-compose/docker-compose_git.bb +3
-4@@ -40,6 +40,8 @@ PACKAGECONFIG ?= "" include relocation.inc +GOBUILDFLAGS:append = " -mod=vendor" +GO_EXTRA_LDFLAGS = "-s -w -X internal.Version=${PV} -X ${COMPOSE_PKG}/internal.Version=${PV}" do_compile() { cd ${S}/src/import@@ -52,17 +54,14 @@ do_compile() { export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}" export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" - export GOFLAGS="-mod=vendor -trimpath" - # our copied .go files are to be used for the build ln -sf vendor.copy vendor # inform go that we know what we are doing cp ${WORKDIR}/modules.txt vendor/ - GO_LDFLAGS="-s -w -X internal.Version=${PV} -X ${COMPOSE_PKG}/internal.Version=${PV}" GO_BUILDTAGS="" mkdir -p ./bin - ${GO} build $GOFLAGS -tags "$GO_BUILDTAGS" -ldflags "$GO_LDFLAGS" -o ./bin/docker-compose ./cmd + ${GO} build ${GOBUILDFLAGS} -tags "$GO_BUILDTAGS" -o ./bin/docker-compose ./cmd } do_install() {Signature · 11 lines
2.40.0 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#8312): https://lists.yoctoproject.org/g/meta-virtualization/message/8312 Mute This Topic: https://lists.yoctoproject.org/mt/101428849/1050810 Group Owner: [email protected] Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
Got it. I've sent out V2.
Regards,
Qi
Quoted 71 lines · Bruce Ashfield
In message: [meta-virtualization][PATCH] docker-compose: fix textrel QA issue
Quoted 10 lines · on 17/09/2023 Chen Qi via lists.yoctoproject.org wrote:
From: Chen Qi <[email protected]>
Fix textrel QA issue like below:
ERROR: QA Issue: docker-compose: ELF binary
/usr/lib/docker/cli-plugins/
docker-compose has relocations in .text [textrel]The problem could be fixed by adding -buildmode=pie, as this option has already been in GOBUILDFLAGS except for mips and riscv32, let's make use of GOBUILDFLAGS.
I tend to not use (or like) the defaults in the bbclass, but in this case, it is probably ok.
Quoted 1 line
Also, make use of
GO_EXTRA_LDFLAGSto hold our this recipe's specific ldflags.I much prefer the explicit
GO_LDFLAGSon the build line, versus the internally consumedGO_EXTRA_LDFLAGS. So I'd prefer to keep that as-is.Bruce
Quoted 48 lines
Signed-off-by Chen Qi <[email protected]>--- recipes-containers/docker-compose/docker-compose_git.bb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)recipes-containers/docker-compose/docker-compose_git.bb +3
-4@@ -40,6 +40,8 @@ PACKAGECONFIG ?= "" include relocation.inc +GOBUILDFLAGS:append = " -mod=vendor" +GO_EXTRA_LDFLAGS = "-s -w -X internal.Version=${PV} -X ${COMPOSE_PKG}/internal.Version=${PV}" do_compile() { cd ${S}/src/import@@ -52,17 +54,14 @@ do_compile() { export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}" export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" - export GOFLAGS="-mod=vendor -trimpath" - # our copied .go files are to be used for the build ln -sf vendor.copy vendor # inform go that we know what we are doing cp ${WORKDIR}/modules.txt vendor/ - GO_LDFLAGS="-s -w -X internal.Version=${PV} -X ${COMPOSE_PKG}/internal.Version=${PV}" GO_BUILDTAGS="" mkdir -p ./bin - ${GO} build $GOFLAGS -tags "$GO_BUILDTAGS" -ldflags "$GO_LDFLAGS" -o ./bin/docker-compose ./cmd + ${GO} build ${GOBUILDFLAGS} -tags "$GO_BUILDTAGS" -o ./bin/docker-compose ./cmd } do_install() {Signature · 9 lines
2.40.0 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#8312): https://lists.yoctoproject.org/g/meta-virtualization/message/8312 Mute This Topic: https://lists.yoctoproject.org/mt/101428849/1050810 Group Owner: [email protected] Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-