Skip to contentSkip to conversation

docker/docker-registry issues

PATCH New Amy Fong 1 participant 8 messages Oct 6, 2015

lore
Share & tools
lore

Amy Fong

author
#0 lore raw

PATCH v2 1/1 docker/docker-registry issues

- go 1.4 has bugs in sqlite, forcing build with go 1.3
- upreving python-greenlet - instability issues

author
#1 lore raw

PATCH 1/7 docker: needs go 1.3

The current version of docker (1.6.2) requires go 1.3

See go 1.4 sqlite issue:
https://github.com/docker/docker/issues/9649

---
 .../go-cross/files/bsd_svid_source.patch           |  37 ++++++
 recipes-devtools/go-cross/files/ccache.patch       | 147 +++++++++++++++++++++
 recipes-devtools/go-cross/go-cross_1.3.bb          |  65 +++++++++
 3 files changed, 249 insertions(+)
 create mode 100644 recipes-devtools/go-cross/files/bsd_svid_source.patch
 create mode 100644 recipes-devtools/go-cross/files/ccache.patch
 create mode 100644 recipes-devtools/go-cross/go-cross_1.3.bb
recipes-devtools/go-cross/files/bsd_svid_source.patch new file +37 -0
new file mode 100644
index 0000000..21e1d4c
@@ -0,0 +1,37 @@
+golang-cross: do_compile fails cc1: all warnings being treated as errors
+
+glibc 2.20 deprecates _BSD_SOURCE and _SVID_SOURCE and emits an error
+message.  From patch 16632:
+	libc [PATCH] BZ #16632: Disable _SVID_SOURCE/_BSD_SOURCE warning
+	if _DEFAULT_SOURCE is defined
+
+Since we also need to support glibc before 2.20, from the release notes
+for glibc 2.20, the recommended fix is to define _DEFAULT_SOURCE
+
+(fixed upstream)
+https://groups.google.com/forum/#!topic/golang-codereviews/S4TARFCxu2k
+
+Signed-off-by: Amy Fong <[email protected]>
+---
+ include/u.h |   10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+--- a/include/u.h
++++ b/include/u.h
+@@ -38,6 +38,16 @@
+ #		define __MAKECONTEXT_V2_SOURCE 1
+ #	endif
+ #endif
++/**
++ * in glibc >= 2.20, _BSD_SOURCE and _SVID_SOURCE causes warning
++ * messages if _DEFAULT_SOURCE is not defined.
++ *
++ * From glibc 2.20 release notes, since this application needs _BSD_SOURCE
++ * and/or _SVID_SOURCE and we must support glibc < 2.19 and
++ * glibc >= 2.20, then define all 3 (_DEFAULT_SOURCE, _BSD_SOURCE,
++ * and _SVID_SOURCE) unconditionally
++ */
++#define _DEFAULT_SOURCE 1
+ #define _BSD_SOURCE 1
+ #define _NETBSD_SOURCE 1	/* NetBSD */
+ #define _SVID_SOURCE 1
recipes-devtools/go-cross/files/ccache.patch new file +147 -0

147 lines not on this page · raw message

recipes-devtools/go-cross/go-cross_1.3.bb new file +65 -0

65 lines not on this page · raw message

Signature · 1 line
2.5.3
author
#2 lore raw

PATCH 2/7 Backport go-cross: fix the bug of cross building error

In reply to Amy Fong

submitted to upstream https://github.com/errordeveloper/oe-meta-go

go-cross: fix the bug of cross building error

When a package's recipe inherit "cross" bbclass, its CC and CXX are defined as the host native gcc and g++ instead of the host cross toolchain, fot this case, CC_FOR_TARGET and CXX_FOR_TARGET should be defined the same with CC and CXX, instead they are should be define as host cross toolchain's CC and CXX, otherwise, it will build failed for target arm architecture as below:

| # Building packages and commands for linux/arm.
| + CC='gcc '
| + bitbake_build/tmp/work/x86_64-wrs-linux-gnueabi/go-cross/1.4-r0/go/pkg/tool/linux_amd64/go_bootstrap install -ccflags '' -gcflags '' -ldflags '' -v std | runtime
| errors
| sync/atomic
| unicode
| unicode/utf8
| math
| sort
| encoding
| unicode/utf16
| container/list
| crypto/subtle
| runtime/cgo
| container/ring
| image/color
| runtime/race
| # runtime/cgo
| gcc: error: unrecognized command line option '-marm'

---
 recipes-devtools/go-cross/go-cross_1.3.bb | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
recipes-devtools/go-cross/go-cross_1.3.bb +4 -2
index 8723142..9ecc295 100644
@@ -5,6 +5,8 @@ DESCRIPTION = "\
 HOMEPAGE = "https://golang.org/"
 LICENSE = "BSD-3-Clause"
 
+DEPENDS = "virtual/${TARGET_PREFIX}gcc"
+
 SRC_URI = "http://golang.org/dl/go${PV}.src.tar.gz"
 
 S = "${WORKDIR}/go/"
@@ -44,8 +46,8 @@ do_compile() {
 	## TODO: consider setting GO_EXTLINK_ENABLED
 
 	export CC="${BUILD_CC}"
-	export CC_FOR_TARGET="${CC}"
-	export CXX_FOR_TARGET="${CXX}"
+	export CC_FOR_TARGET="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}"
+	export CXX_FOR_TARGET="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}"
 	export GO_CCFLAGS="${HOST_CFLAGS}"
 	export GO_LDFLAGS="${HOST_LDFLAGS}"
 
Signature · 1 line
2.5.3
author
#3 lore raw

PATCH 3/7 Backport go-cross: fix the building failed for quark bsp

In reply to Amy Fong

submitted to upstream https://github.com/errordeveloper/oe-meta-go

go-cross: fix the building failed for quark bsp

Quark used i586 architecture, and golang dealt intel 32bit architecture as 386, so export GOARCH = "386" when the TARGET_ARCH is i586 to support quark bsp.

---
 recipes-devtools/go-cross/go-cross_1.3.bb | 3 +++
 1 file changed, 3 insertions(+)
recipes-devtools/go-cross/go-cross_1.3.bb +3 -0
index 9ecc295..d689e61 100644
@@ -30,8 +30,11 @@ do_compile() {
 	export GOOS="linux"
 
 	export GOARCH="${TARGET_ARCH}"
+	# golang only support 386, amd64 and arm architecture.
 	if [ "${TARGET_ARCH}" = "x86_64" ]; then
 		export GOARCH="amd64"
+	elif [ "${TARGET_ARCH}" = "i586" ]; then
+		export GOARCH="386"
 	fi
 	if [ "${TARGET_ARCH}" = "arm" ]
 	then
Signature · 1 line
2.5.3
author
#4 lore raw

PATCH 4/7 Backport go-cross: set alignment for the .rel.plt section on 32-bit architectures

In reply to Amy Fong

submitted to upstream https://github.com/errordeveloper/oe-meta-go

go-cross: set alignment for the .rel.plt section on 32-bit architectures

This patch is cherry picked from golang's upstream, and this patch will fix the package of etcd's following build error:

ERROR: debugedit failed with exit code 256 (cmd was 'bitbake_build/tmp/sysroots/x86_64-linux/usr/lib/rpm/bin/debugedit' -b 'bitbake_build/tmp/work/cortexa7t2hf-vfp-neon-wrs-linux-gnueabi' -d '/usr/src/debug' -i -l 'bitbake_build/tmp/work/cortexa7t2hf-vfp-neon-wrs-linux-gnueabi/etcd/git-r0/debugsources.list' 'bitbake_build/tmp/work/cortexa7t2hf-vfp-neon-wrs-linux-gnueabi/etcd/git-r0/package/usr/bin/etcd'):
bitbake_build/tmp/sysroots/x86_64-linux/usr/lib/rpm/bin/debugedit: elf_update: invalid section alignment
ERROR: Function failed: split_and_strip_files
ERROR: Logfile of failure stored in: bitbake_build/tmp/work/cortexa7t2hf-vfp-neon-wrs-linux-gnueabi/etcd/git-r0/temp/do_package/log.do_package.109414
ERROR: Task 12 (layers/meta-overc/meta-pod/recipes-connectivity/etcd/etcd_git.bb, do_package) failed with exit code '1'

---
 ...alignment-for-the-.rel.plt-section-on-32-.patch | 30 ++++++++++++++++++++++
 recipes-devtools/go-cross/go-cross_1.3.bb          |  1 +
 2 files changed, 31 insertions(+)
 create mode 100644 recipes-devtools/go-cross/files/0001-cmd-ld-set-alignment-for-the-.rel.plt-section-on-32-.patch
recipes-devtools/go-cross/files/0001-cmd-ld-set-alignment-for-the-.rel.plt-section-on-32-.patch new file +30 -0
new file mode 100644
index 0000000..4cfa9d1
@@ -0,0 +1,30 @@
+From 855145d5c03c4b4faf60736c38d7a299c682af4a Mon Sep 17 00:00:00 2001
+From: Shenghou Ma <[email protected]>
+Date: Sat, 7 Feb 2015 14:06:02 -0500
+Subject: [PATCH] cmd/ld: set alignment for the .rel.plt section on 32-bit
+ architectures
+
+Fixes #9802.
+
+Change-Id: I22c52a37bdb23a14cc4615c9519431bb14ca81ca
+Reviewed-on: https://go-review.googlesource.com/4170
+Reviewed-by: Ian Lance Taylor <[email protected]>
+---
+ src/cmd/ld/elf.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/cmd/ld/elf.c b/src/cmd/ld/elf.c
+index 12ced98..97ed4bd 100644
+--- a/src/cmd/ld/elf.c
++++ b/src/cmd/ld/elf.c
+@@ -1363,6 +1363,7 @@ asmbelf(vlong symo)
+ 			sh->type = SHT_REL;
+ 			sh->flags = SHF_ALLOC;
+ 			sh->entsize = ELF32RELSIZE;
++			sh->addralign = 4;
+ 			sh->link = elfshname(".dynsym")->shnum;
+ 			shsym(sh, linklookup(ctxt, ".rel.plt", 0));
+ 
+-- 
+1.9.1
+
recipes-devtools/go-cross/go-cross_1.3.bb +1 -0
index d689e61..1fb4870 100644
@@ -20,6 +20,7 @@ SRC_URI[sha256sum] = "eb983e6c5b2b9838f482c5442b1ac1856f610f2b21f3c123b3fedb48ff
 SRC_URI += "\
         file://bsd_svid_source.patch \
         file://ccache.patch \
+        file://0001-cmd-ld-set-alignment-for-the-.rel.plt-section-on-32-.patch \
         "
 
 do_compile() {
Signature · 1 line
2.5.3
author
#5 lore raw

PATCH 5/7 Enable go-cross 1.3 to coexist with later versions

In reply to Amy Fong

Since we need go 1.3 to co-exist with later versions (ie 1.4), package go-cross_1.3 as go-cross-1.3_1.3.

go 1.3 will be installed to a different path than go-cross, this requires go packages needing go 1.3 to set its PATH to:

        export PATH=${STAGING_BINDIR_NATIVE}/${HOST_SYS}/go-1.3:$PATH
---
 recipes-containers/docker/docker_git.bb       |  4 +-
 recipes-devtools/go-cross/go-cross-1.3_1.3.bb | 72 +++++++++++++++++++++++++++
 recipes-devtools/go-cross/go-cross_1.3.bb     | 71 --------------------------
 3 files changed, 75 insertions(+), 72 deletions(-)
 create mode 100644 recipes-devtools/go-cross/go-cross-1.3_1.3.bb
 delete mode 100644 recipes-devtools/go-cross/go-cross_1.3.bb
recipes-containers/docker/docker_git.bb +3 -1
index aa125a3..165b319 100644
@@ -36,7 +36,7 @@ S = "${WORKDIR}/git"
 DOCKER_VERSION = "1.6.2"
 PV = "${DOCKER_VERSION}+git${SRCREV}"
 
-DEPENDS = "go-cross \
+DEPENDS = "go-cross-1.3 \
     go-cli \
     go-pty \
     go-context \
@@ -65,6 +65,8 @@ do_configure() {
 }
 
 do_compile() {
+	export PATH=${STAGING_BINDIR_NATIVE}/${HOST_SYS}/go-1.3:$PATH
+
 	export GOARCH="${TARGET_ARCH}"
 	# supported amd64, 386, arm
 	if [ "${TARGET_ARCH}" = "x86_64" ]; then
recipes-devtools/go-cross/go-cross-1.3_1.3.bb new file +72 -0

72 lines not on this page · raw message

recipes-devtools/go-cross/go-cross_1.3.bb deleted +0 -71

71 lines not on this page · raw message

Signature · 1 line
2.5.3
author
#6 lore raw

PATCH 6/7 docker: fix paths for cross compile

In reply to Amy Fong

Some of the cgo variables were pointing to host paths and not target Fix install rules - binaries can be installed to a subdirectory.

---
 recipes-containers/docker/docker_git.bb | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
recipes-containers/docker/docker_git.bb +9 -3
index 165b319..0127baf 100644
@@ -83,10 +83,12 @@ do_compile() {
 	export GOPATH="${S}/.gopath:${S}/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go"
 	cd -
 
+	export CGO_ENABLED="1"
+
 	# Pass the needed cflags/ldflags so that cgo
 	# can find the needed headers files and libraries
-	export CGO_CFLAGS="${BUILD_CFLAGS}"
-	export CGO_LDFLAGS="${BUILD_LDFLAGS}"
+	export CGO_CFLAGS="${BUILDSDK_CFLAGS}"
+	export CGO_LDFLAGS="${BUILDSDK_LDFLAGS}"
 
 	# this is the unsupported built structure
 	# that doesn't rely on an existing docker
@@ -124,7 +126,11 @@ do_install() {
             install -m 0755 ${WORKDIR}/docker.init ${D}${sysconfdir}/init.d/docker.init
 	fi
 
-	cp ${S}/vendor/bin/nsinit ${D}/${bindir}
+	if [ -d ${S}/vendor/bin/linux_* ]; then
+		cp ${S}/vendor/bin/linux_*/* ${D}/${bindir}
+	else
+		cp ${S}/vendor/bin/* ${D}/${bindir}
+	fi
 
 	mkdir -p ${D}/usr/share/docker/
 	cp ${WORKDIR}/hi.Dockerfile ${D}/usr/share/docker/
Signature · 1 line
2.5.3
author
#7 lore raw

PATCH 7/7 python-greenlet: uprev to 0.4.9

In reply to Amy Fong

python-greenlet bugfixes from 0.3.4 - unstable issues. This resulted in the docker-registry (in some build scenarios) crashing repeatedly.

Traceback (most recent call last):
File "/usr/lib64/python2.7/site-packages/gunicorn/arbiter.py", line 507, in spawn_worker
worker.init_process()
File "/usr/lib64/python2.7/site-packages/gunicorn/workers/ggevent.py", line 193, in init_process
super(GeventWorker, self).init_process()
File "/usr/lib64/python2.7/site-packages/gunicorn/workers/base.py", line 120, in init_process
self.run()
File "/usr/lib64/python2.7/site-packages/gunicorn/workers/ggevent.py", line 117, in run
gevent.sleep(1.0)
File "/usr/lib64/python2.7/site-packages/gevent/hub.py", line 75, in sleep
hub.wait(loop.timer(seconds, ref=ref))
File "/usr/lib64/python2.7/site-packages/gevent/hub.py", line 341, in wait
result = waiter.get()
File "/usr/lib64/python2.7/site-packages/gevent/hub.py", line 568, in get
return self.hub.switch()
File "/usr/lib64/python2.7/site-packages/gevent/hub.py", line 331, in switch
return greenlet.switch(self)
SystemError: NULL result without error in PyObject_Call

<repeat>

---
 recipes-devtools/python/python-greenlet_0.4.9.bb | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 recipes-devtools/python/python-greenlet_0.4.9.bb
recipes-devtools/python/python-greenlet_0.4.9.bb new file +14 -0
new file mode 100644
index 0000000..fa35fa8
@@ -0,0 +1,14 @@
+SUMMARY = "Python lightweight in-process concurrent programming"
+HOMEPAGE = "http://pypi.python.org/pypi/greenlet"
+SECTION = "devel/python"
+LICENSE = "MIT & PSF"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=03143d7a1a9f5d8a0fee825f24ca9c36 \
+                    file://LICENSE.PSF;md5=c106931d9429eda0492617f037b8f69a"
+SRC_URI = "http://pypi.python.org/packages/source/g/greenlet/greenlet-${PV}.tar.gz"
+SRC_URI[md5sum] = "00bb1822d8511cc85f052e89d1fd919b"
+SRC_URI[sha256sum] = "79f9b8bbbb1c599c66aed5e643e8b53bae697cae46e0acfc4ee461df48a90012"
+
+S = "${WORKDIR}/greenlet-${PV}"
+
+inherit distutils
+
Signature · 1 line
2.5.3