Bug 1411465 - etcd fails to build from source
Summary: etcd fails to build from source
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: etcd
Version: 7.3
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: Jan Chaloupka
QA Contact: atomic-bugs@redhat.com
Depends On:
Blocks: 1405448
TreeView+ depends on / blocked
Reported: 2017-01-09 19:40 UTC by D. Marlin
Modified: 2017-01-17 13:22 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2017-01-17 13:22:01 UTC
Target Upstream Version:

Attachments (Terms of Use)

Description D. Marlin 2017-01-09 19:40:33 UTC
Description of problem:

etcd fails to build from source with the newer (1.7.4) version of golang.  The previous build was performed with golang-1.6.2-2.  It appears that between these versions a warning became an error, which now causes the build to fail.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.  curl -O http://download.eng.bos.redhat.com/brewroot/packages/etcd/3.0.15/1.el7/src/etcd-3.0.15-1.el7.src.rpm
2.  rhpkg scratch-build --target extras-rhel-7.3-candidate --srpm=etcd-3.0.15-1.el7.src.rpm

Actual results:

/usr/lib/golang/pkg/tool/linux_amd64/link -o $WORK/github.com/coreos/etcd/cmd/_obj/exe/a.out -L $WORK -L /builddir/build/BUILD/etcd-fc00305a2e59b4c2d4a53c9fbb4d30741a96ea67/pkg/linux_amd64 -L /builddir/build/BUILD/etcd-fc00305a2e59b4c2d4a53c9fbb4d30741a96ea67/Godeps/_workspace/pkg/linux_amd64 -extld=gcc -buildmode=exe -buildid=3c6ef890335db7dffadd631d938520c8311f469e -X github.com/coreos/etcd/version.GitSHA fc00305 -B 0x1500b28ec30c4b53b54ffae67e16bb53d81a86d5 -B 0x024eefd6c6666277230ece69745ba0dc62de8a95 $WORK/github.com/coreos/etcd/cmd.a
# github.com/coreos/etcd/cmd
/usr/lib/golang/pkg/tool/linux_amd64/link: -X flag requires argument of the form importpath.name=value
error: Bad exit status from /var/tmp/rpm-tmp.68RBmt (%build)

Expected results:

Builds without error.

Additional info:

This was only flagged as a warning in the previous build:  

link: warning: option -X github.com/coreos/etcd/version.GitSHA fc00305 may not work in future releases; use -X github.com/coreos/etcd/version.GitSHA=fc00305

Changing the "-X" flag definition in the spec file allows the build to complete without errors, i.e., 

 %if ! 0%{?with_debug}
-export LDFLAGS="-X %{import_path}/version.GitSHA %{shortcommit}"
+export LDFLAGS="-X %{import_path}/version.GitSHA=%{shortcommit}"
-export LDFLAGS="-X %{import_path}/version.GitSHA %{shortcommit} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n')"
+export LDFLAGS="-X %{import_path}/version.GitSHA=%{shortcommit} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n')"

Comment 2 Jan Chaloupka 2017-01-17 13:22:01 UTC
Just a spec file fix. No need to include the issue in errata.

Thanks for patching the spec.

Note You need to log in before you can comment on or make changes to this bug.