LFS_CFLAGS on 32bits architectures
Andreas Hasenack
andreas at canonical.com
Mon May 30 14:16:59 UTC 2022
Hi,
on a pi3 (armhf):
$ getconf LFS_CFLAGS
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
This only returns a value where it's needed, aka, 32bits (AFAIK).
Shouldn't this be part of our default set of CFLAGS on 32bits architectures?
The reason I ask is this old samba bug[1] ("64bits prototype not
precised")], which iterated over a few fixes:
- force-refine _LARGEFILE64_SOURCE and _FILE_OFFSET_BIGS in
libsmbclient.h[2] (it's been like this since 2011 in the package)
- it was replaced with [3], which uses a `static_assert(sizeof(off_t)
>= 8` check and fails the build on 32bit without LFS
- then it was replaced again with [4], which uses this one liner:
`typedef int smbc_off_t_should_be_at_least_64bits_use_LFS_CFLAGS[sizeof(off_t)-7];`,
which also fails the build because it becomes a very large array on
32bits if off_t is not 64bits.
In Ubuntu builds, only the first original patch was ever used. The
other iterations happened in debian unstable and I encountered them
while starting a new merge from debian for the kinetic cycle.
So far, only adsys is failing to build:
# github.com/ubuntu/adsys/vendor/github.com/mvo5/libsmbclient-go
In file included from
src/github.com/ubuntu/adsys/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];
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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
I'm trying a rebuild of all reverse dependencies of libsmbclient to
see if there are any other failures, but I am wondering if this is the
current approach we want to take, or revert to our old-and-tried patch
that just defines it for all apps including libsmbclient.h?
1. http://bugs.debian.org/221618
2. https://git.launchpad.net/ubuntu/+source/samba/tree/debian/patches/bug_221618_precise-64bit-prototype.patch?h=import/2%254.13.2%2bdfsg-1
3. https://salsa.debian.org/samba-team/samba/-/blob/b141e7178961404a9f9cca92d04e780c5f504878/debian/patches/libsmbclient-ensure-lfs-221618.patch
4. https://salsa.debian.org/samba-team/samba/-/blob/d0d8db5c6d6e8b5e26944031f6786031c1a389ca/debian/patches/libsmbclient-ensure-lfs-221618.patch
More information about the ubuntu-devel
mailing list