LFS_CFLAGS on 32bits architectures

Andreas Hasenack andreas at canonical.com
Thu Jun 2 19:36:08 UTC 2022


Hi,

On Mon, May 30, 2022 at 8:29 PM Steve Langasek
<steve.langasek at ubuntu.com> wrote:
>
> Hi Andreas,
>
> On Mon, May 30, 2022 at 02:16:59PM +0000, Andreas Hasenack wrote:
> > I experimented a few things, and this got it building again:
> > --- a/debian/rules
> > +++ b/debian/rules
> > @@ -10,6 +10,10 @@ export DH_GOLANG_INSTALL_ALL := 1
> >  # Skip integration tests when building package: they need docker images.
> >  export ADSYS_SKIP_INTEGRATION_TESTS=1
> >
> > +# be sure to set LFS_CFLAGS if needed, required for libsmbclient on 32bits
> > +CGO_CFLAGS  := $(shell getconf LFS_CFLAGS)
> > +export CGO_CFLAGS
> > +
> >  %:
> >         dh $@ --buildsystem=golang --with=golang,apport
>
> Would be interesting to know if 'export DEB_BUILD_MAINT_OPTIONS=future=+lfs'
> also fixed the build, as conceptually that's the same level of abstraction
> as fixing dpkg-buildflags per the above.

That works for the build, but fails later override_dh_auto_install
when d/rules does this:
override_dh_auto_install:
        dh_auto_install -- --no-source
...
        # run go generate to install assets, but don’t regenerate them
        GENERATE_ONLY_INSTALL_TO_DESTDIR=$(CURDIR)/debian/adsys go
generate -tags tools $(GOFLAGS) ./...

with:
# run go generate to install assets, but don’t regenerate them
GENERATE_ONLY_INSTALL_TO_DESTDIR=/home/ubuntu/git/packages/adsys/adsys/debian/adsys
go generate -tags tools
-ldflags=-X=github.com/ubuntu/adsys/internal/consts.Version=0.8.6~ppa5
--mod=vendor -buildmode=pie ./...
# github.com/mvo5/libsmbclient-go
In file included from
../../vendor/github.com/mvo5/libsmbclient-go/libsmbclient.go:17:
/usr/include/samba-4.0/libsmbclient.h:84:13: error: size of array
'smbc_off_t_should_be_at_least_64bits_use_LFS_CFLAGS' is too large
   84 | typedef int
smbc_off_t_should_be_at_least_64bits_use_LFS_CFLAGS[sizeof(off_t)-7];
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cmd/adsysd/main.go:17: running "go": exit status 2


I'm not sure what this step is doing, but it looks like the lfs flags
are lost. My other approach (with CFO_FLAGS) worked.

Isn't there a place in the golang buildsystem to inject this $(getconf
LFS_CFLASG)? Imagine users who just git clone that repo and build
adsys manually on armhf, against upstream samba (without the LFS patch
in libsmbclient.h). They would get a build with a 32bit off_t type
which would be broken. A plain upstream samba build will expect an
off_t of 64 bits[1].

Given [1], that samba will always be built with LFS, then I think the
LFS_CFLAGS change should be in adsys, somewhere in their build system.

1. https://github.com/samba-team/samba/blob/ac16351ff5a0c5b46f461c26516b85e8483bba83/buildtools/wafsamba/wscript#L611



More information about the ubuntu-devel mailing list