[master][kirkstone][PATCH 2/3] docker-distribution: fix build error on new hosts


Chen Qi
 

The CGO_CFLAGS and other related variables have already been set
appropriately by the go.bbclass in oe-core. Setting them in this
recipe is not only unncessary but also error prone.

For example CGO_CFLAGS is set to use BUILDSDK_CFLAGS, and this is
incorrect. We need target flags instead of SDK related flags. Such
setting happens to work for some hosts. However, when building on
newer hosts, we get QA error like below:

ERROR: docker-distribution-v2.7.1-r0 do_package_qa:
QA Issue: /usr/sbin/registry contained in package docker-registry requires
libc.so.6(GLIBC_2.34)(64bit), but no providers found in RDEPENDS_docker-registry? [file-rdeps]

The above error was found on hardknott on host Fedora 35.
Tracking down the error and I found it's using host stuff which is likely
to be caused by using incorrect CGO_CFLAGS. As the master branch is
using the same settings, it has the same issue.

Signed-off-by: Chen Qi <Qi.Chen@...>
---
.../docker-distribution/docker-distribution_git.bb | 9 ---------
1 file changed, 9 deletions(-)

diff --git a/recipes-containers/docker-distribution/docker-distribution_git.bb b/recipes-containers/docker-distribution/docker-distribution_git.bb
index 1d074bf3..679bcf8b 100644
--- a/recipes-containers/docker-distribution/docker-distribution_git.bb
+++ b/recipes-containers/docker-distribution/docker-distribution_git.bb
@@ -23,17 +23,8 @@ inherit go systemd
EXTRA_OEMAKE="BUILDTAGS=''"

do_compile() {
- export GOARCH="${TARGET_GOARCH}"
export GOPATH="${WORKDIR}/git/"
- export GOROOT="${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go"
- # Pass the needed cflags/ldflags so that cgo
- # can find the needed headers files and libraries
- export CGO_ENABLED="1"
- export CFLAGS=""
- export LDFLAGS=""
- export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
export GO_GCFLAGS=""
- export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
export GO111MODULE=off

cd ${S}
--
2.36.0


Bruce Ashfield
 

On Fri, Jun 10, 2022 at 12:21 AM Chen Qi <Qi.Chen@...> wrote:

The CGO_CFLAGS and other related variables have already been set
appropriately by the go.bbclass in oe-core. Setting them in this
recipe is not only unncessary but also error prone.

For example CGO_CFLAGS is set to use BUILDSDK_CFLAGS, and this is
incorrect. We need target flags instead of SDK related flags. Such
setting happens to work for some hosts. However, when building on
newer hosts, we get QA error like below:

ERROR: docker-distribution-v2.7.1-r0 do_package_qa:
QA Issue: /usr/sbin/registry contained in package docker-registry requires
libc.so.6(GLIBC_2.34)(64bit), but no providers found in RDEPENDS_docker-registry? [file-rdeps]

The above error was found on hardknott on host Fedora 35.
Tracking down the error and I found it's using host stuff which is likely
to be caused by using incorrect CGO_CFLAGS. As the master branch is
using the same settings, it has the same issue.
And as I mentioned, feel free to adjust the flags and explicit
settings, but I won't be dropping them.

I've been through 6 years of getting these recipes working, and
continually being broken by changes in the core classes, so I'm not
going to drop the explicit settings.

Bruce


Signed-off-by: Chen Qi <Qi.Chen@...>
---
.../docker-distribution/docker-distribution_git.bb | 9 ---------
1 file changed, 9 deletions(-)

diff --git a/recipes-containers/docker-distribution/docker-distribution_git.bb b/recipes-containers/docker-distribution/docker-distribution_git.bb
index 1d074bf3..679bcf8b 100644
--- a/recipes-containers/docker-distribution/docker-distribution_git.bb
+++ b/recipes-containers/docker-distribution/docker-distribution_git.bb
@@ -23,17 +23,8 @@ inherit go systemd
EXTRA_OEMAKE="BUILDTAGS=''"

do_compile() {
- export GOARCH="${TARGET_GOARCH}"
export GOPATH="${WORKDIR}/git/"
- export GOROOT="${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go"
- # Pass the needed cflags/ldflags so that cgo
- # can find the needed headers files and libraries
- export CGO_ENABLED="1"
- export CFLAGS=""
- export LDFLAGS=""
- export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
export GO_GCFLAGS=""
- export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
export GO111MODULE=off

cd ${S}
--
2.36.0




--
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II


Chen Qi
 

Hi Bruce,

Got it. I'll adjust these CGO_XXX settings and send out V2 next week.

Regards,
Qi

-----Original Message-----
From: Bruce Ashfield <bruce.ashfield@...>
Sent: Friday, June 10, 2022 9:01 PM
To: Chen, Qi <Qi.Chen@...>
Cc: meta-virtualization@...
Subject: Re: [meta-virtualization][master][kirkstone][PATCH 2/3] docker-distribution: fix build error on new hosts

On Fri, Jun 10, 2022 at 12:21 AM Chen Qi <Qi.Chen@...> wrote:

The CGO_CFLAGS and other related variables have already been set
appropriately by the go.bbclass in oe-core. Setting them in this
recipe is not only unncessary but also error prone.

For example CGO_CFLAGS is set to use BUILDSDK_CFLAGS, and this is
incorrect. We need target flags instead of SDK related flags. Such
setting happens to work for some hosts. However, when building on
newer hosts, we get QA error like below:

ERROR: docker-distribution-v2.7.1-r0 do_package_qa:
QA Issue: /usr/sbin/registry contained in package docker-registry requires
libc.so.6(GLIBC_2.34)(64bit), but no providers found in
RDEPENDS_docker-registry? [file-rdeps]

The above error was found on hardknott on host Fedora 35.
Tracking down the error and I found it's using host stuff which is
likely to be caused by using incorrect CGO_CFLAGS. As the master
branch is using the same settings, it has the same issue.
And as I mentioned, feel free to adjust the flags and explicit settings, but I won't be dropping them.

I've been through 6 years of getting these recipes working, and continually being broken by changes in the core classes, so I'm not going to drop the explicit settings.

Bruce


Signed-off-by: Chen Qi <Qi.Chen@...>
---
.../docker-distribution/docker-distribution_git.bb | 9 ---------
1 file changed, 9 deletions(-)

diff --git
a/recipes-containers/docker-distribution/docker-distribution_git.bb
b/recipes-containers/docker-distribution/docker-distribution_git.bb
index 1d074bf3..679bcf8b 100644
---
a/recipes-containers/docker-distribution/docker-distribution_git.bb
+++ b/recipes-containers/docker-distribution/docker-distribution_git.b
+++ b
@@ -23,17 +23,8 @@ inherit go systemd
EXTRA_OEMAKE="BUILDTAGS=''"

do_compile() {
- export GOARCH="${TARGET_GOARCH}"
export GOPATH="${WORKDIR}/git/"
- export GOROOT="${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go"
- # Pass the needed cflags/ldflags so that cgo
- # can find the needed headers files and libraries
- export CGO_ENABLED="1"
- export CFLAGS=""
- export LDFLAGS=""
- export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
export GO_GCFLAGS=""
- export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
export GO111MODULE=off

cd ${S}
--
2.36.0




--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end
- "Use the force Harry" - Gandalf, Star Trek II


Bruce Ashfield
 

On Fri, Jun 10, 2022 at 9:58 AM Chen, Qi <Qi.Chen@...> wrote:

Hi Bruce,

Got it. I'll adjust these CGO_XXX settings and send out V2 next week.
Sounds good to me. Thanks for adjusting them!

I will merge your docker-distribution fix though, since it is
unrelated to the flags.

I'm doing some upgrades to the packages right now, but will make sure
to not impact the changes I know you are making.

Bruce

Regards,
Qi

-----Original Message-----
From: Bruce Ashfield <bruce.ashfield@...>
Sent: Friday, June 10, 2022 9:01 PM
To: Chen, Qi <Qi.Chen@...>
Cc: meta-virtualization@...
Subject: Re: [meta-virtualization][master][kirkstone][PATCH 2/3] docker-distribution: fix build error on new hosts

On Fri, Jun 10, 2022 at 12:21 AM Chen Qi <Qi.Chen@...> wrote:

The CGO_CFLAGS and other related variables have already been set
appropriately by the go.bbclass in oe-core. Setting them in this
recipe is not only unncessary but also error prone.

For example CGO_CFLAGS is set to use BUILDSDK_CFLAGS, and this is
incorrect. We need target flags instead of SDK related flags. Such
setting happens to work for some hosts. However, when building on
newer hosts, we get QA error like below:

ERROR: docker-distribution-v2.7.1-r0 do_package_qa:
QA Issue: /usr/sbin/registry contained in package docker-registry requires
libc.so.6(GLIBC_2.34)(64bit), but no providers found in
RDEPENDS_docker-registry? [file-rdeps]

The above error was found on hardknott on host Fedora 35.
Tracking down the error and I found it's using host stuff which is
likely to be caused by using incorrect CGO_CFLAGS. As the master
branch is using the same settings, it has the same issue.
And as I mentioned, feel free to adjust the flags and explicit settings, but I won't be dropping them.

I've been through 6 years of getting these recipes working, and continually being broken by changes in the core classes, so I'm not going to drop the explicit settings.

Bruce


Signed-off-by: Chen Qi <Qi.Chen@...>
---
.../docker-distribution/docker-distribution_git.bb | 9 ---------
1 file changed, 9 deletions(-)

diff --git
a/recipes-containers/docker-distribution/docker-distribution_git.bb
b/recipes-containers/docker-distribution/docker-distribution_git.bb
index 1d074bf3..679bcf8b 100644
---
a/recipes-containers/docker-distribution/docker-distribution_git.bb
+++ b/recipes-containers/docker-distribution/docker-distribution_git.b
+++ b
@@ -23,17 +23,8 @@ inherit go systemd
EXTRA_OEMAKE="BUILDTAGS=''"

do_compile() {
- export GOARCH="${TARGET_GOARCH}"
export GOPATH="${WORKDIR}/git/"
- export GOROOT="${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go"
- # Pass the needed cflags/ldflags so that cgo
- # can find the needed headers files and libraries
- export CGO_ENABLED="1"
- export CFLAGS=""
- export LDFLAGS=""
- export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
export GO_GCFLAGS=""
- export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
export GO111MODULE=off

cd ${S}
--
2.36.0




--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end
- "Use the force Harry" - Gandalf, Star Trek II


--
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II