[pkg-go] Bug#821454: dh-golang: Position-independent executables (PIE)

Peter Colberg peter at colberg.org
Mon Apr 18 19:06:11 UTC 2016


Package: dh-golang
Version: 1.15
Severity: normal

Dear Debian Go team,

In response to the lintian warning hardening-no-pie, I am trying to
build acmetool (#817091) as a position-independent executable (PIE).

The Go compiler supports a -buildmode=pie since version 1.5.

Building the package with this flag produces the following errror:

  dpkg-buildpackage: source package acmetool
  dpkg-buildpackage: source version 0.0.49-1
  dpkg-buildpackage: source distribution unstable
   dpkg-source --before-build acmetool-0.0.49
  dpkg-buildpackage: host architecture amd64
   fakeroot debian/rules clean
  dh clean --buildsystem=golang --with=golang
     dh_testdir -O--buildsystem=golang
     dh_auto_clean -O--buildsystem=golang
     dh_clean -O--buildsystem=golang
   dpkg-source -b acmetool-0.0.49
  dpkg-source: info: using source format '3.0 (quilt)'
  dpkg-source: info: building acmetool using existing ./acmetool_0.0.49.orig.tar.gz
  dpkg-source: info: building acmetool in acmetool_0.0.49-1.debian.tar.xz
  dpkg-source: info: building acmetool in acmetool_0.0.49-1.dsc
   debian/rules build
  dh build --buildsystem=golang --with=golang
     dh_testdir -O--buildsystem=golang
     dh_update_autotools_config -O--buildsystem=golang
     dh_auto_configure -O--buildsystem=golang
     debian/rules override_dh_auto_build
  make[1]: Entering directory '/<<PKGBUILDDIR>>'
  dh_auto_build -O--buildsystem=golang -- -buildmode=pie -ldflags "-X github.com/hlandau/acme/hooks.DefaultPath=/etc/ac
+me
          go install -v -buildmode=pie -ldflags "-X github.com/hlandau/acme/hooks.DefaultPath=/etc/acme/hooks -X github
+.ci github.com/hlandau/acme/acmeapi/acmeendpoints github.com/hlandau/acme/acmeapi/acmeutils
+github.com/hlandau/acme/cmd/a/acme/redirector github.com/hlandau/acme/responder github.com/hlandau/acme/solver
+github.com/hlandau/acme/storage githu
  runtime/internal/sys
  go install runtime/internal/sys: mkdir /usr/lib/go/pkg/linux_amd64_shared: permission denied
  dh_auto_build: go install -v -buildmode=pie -ldflags -X github.com/hlandau/acme/hooks.DefaultPath=/etc/acme/hooks -X
+gicmeapi github.com/hlandau/acme/acmeapi/acmeendpoints github.com/hlandau/acme/acmeapi/acmeutils
+github.com/hlandau/acme/andau/acme/redirector github.com/hlandau/acme/responder github.com/hlandau/acme/solver
+github.com/hlandau/acme/storage
  debian/rules:14: recipe for target 'override_dh_auto_build' failed
  make[1]: *** [override_dh_auto_build] Error 1
  make[1]: Leaving directory '/<<PKGBUILDDIR>>'
  debian/rules:11: recipe for target 'build' failed
  make: *** [build] Error 2
  dpkg-buildpackage: error: debian/rules build gave error exit status 2

Any ideas what is going wrong?

It works fine if I compile from upstream:

  git clone https://github.com/hlandau/acme github.com/hlandau/acme
  cd github.com/hlandau/acme/cmd/acmetool
  export GOPATH=$PWD
  go get -v
  go build -v -buildmode=pie

Regards,
Peter



More information about the Pkg-go-maintainers mailing list