tavianator/bfs

Build failures on kfreebsd

lamby opened this issue · 9 comments

lamby commented

Hi, bfs currently fails on the kfreebsd architectures in Debian:

c -D__EXTENSIONS__ -D_ATFILE_SOURCE -D_BSD_SOURCE -D_DARWIN_C_SOURCE -D_DEFAULT_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DBFS_VERSION=\"1.6\" -Wdate-time -D_FORTIFY_SOURCE=2 -std=c99 -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -MD -MP -MF spawn.d -c spawn.c -o spawn.o
cc -D__EXTENSIONS__ -D_ATFILE_SOURCE -D_BSD_SOURCE -D_DARWIN_C_SOURCE -D_DEFAULT_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DBFS_VERSION=\"1.6\" -Wdate-time -D_FORTIFY_SOURCE=2 -std=c99 -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -MD -MP -MF stat.d -c stat.c -o stat.o
cc -D__EXTENSIONS__ -D_ATFILE_SOURCE -D_BSD_SOURCE -D_DARWIN_C_SOURCE -D_DEFAULT_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DBFS_VERSION=\"1.6\" -Wdate-time -D_FORTIFY_SOURCE=2 -std=c99 -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -MD -MP -MF time.d -c time.c -o time.o
cc -D__EXTENSIONS__ -D_ATFILE_SOURCE -D_BSD_SOURCE -D_DARWIN_C_SOURCE -D_DEFAULT_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DBFS_VERSION=\"1.6\" -Wdate-time -D_FORTIFY_SOURCE=2 -std=c99 -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -MD -MP -MF trie.d -c trie.c -o trie.o
cc -D__EXTENSIONS__ -D_ATFILE_SOURCE -D_BSD_SOURCE -D_DARWIN_C_SOURCE -D_DEFAULT_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DBFS_VERSION=\"1.6\" -Wdate-time -D_FORTIFY_SOURCE=2 -std=c99 -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -MD -MP -MF typo.d -c typo.c -o typo.o
cc -D__EXTENSIONS__ -D_ATFILE_SOURCE -D_BSD_SOURCE -D_DARWIN_C_SOURCE -D_DEFAULT_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DBFS_VERSION=\"1.6\" -Wdate-time -D_FORTIFY_SOURCE=2 -std=c99 -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -MD -MP -MF util.d -c util.c -o util.o
cc -D__EXTENSIONS__ -D_ATFILE_SOURCE -D_BSD_SOURCE -D_DARWIN_C_SOURCE -D_DEFAULT_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DBFS_VERSION=\"1.6\" -Wdate-time -D_FORTIFY_SOURCE=2 -std=c99 -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -MD -MP -MF bfs  -Wl,-z,relro -Wl,-z,now bftw.o color.o darray.o diag.o dstring.o eval.o exec.o fsade.o main.o mtab.o opt.o parse.o printf.o spawn.o stat.o time.o trie.o typo.o util.o   -o bfs
/usr/bin/ld: fsade.o: in function `bfs_check_xattrs':
./fsade.c:288: undefined reference to `extattr_list_file'
/usr/bin/ld: ./fsade.c:288: undefined reference to `extattr_list_link'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:96: bfs] Error 1
make[1]: Leaving directory '/<<PKGBUILDDIR>>'
dh_auto_build: error: make -j2 "INSTALL=install --strip-program=true" returned exit code 2
make: *** [debian/rules:6: binary-arch] Error 25

https://buildd.debian.org/status/package.php?p=bfs

I see that we have a BFS_HAS_SYS_EXTATTR macro already, but I think the setup for this is wrong in kFreeBSD which is a weird hybrid (eg. perhaps the && !__FreeBSD__ logic is wrong here.)

These bug reports are related:

Basically the header and prototypes are there for the extattr* functions, but they're not actually implemented in the libc. There's no configure step for the bfs build so it can't easily detect that. I could hardcode a __FreeBSD_kernel__ && !__FreeBSD__ check to detect Debian kFreeBSD, but I didn't want to assume it would have that bug forever.

Any chance of that bug getting fixed, either by removing the header or implementing the libc functions?

lamby commented

Ah, was not aware of those bug reports and, unfortunately, this is not something within my core competancy so I cannot really comment on their status.. But thanks for your quick reply. :)

No problem! A quick workaround would be to add -DBFS_HAS_SYS_EXTATTR=0 to CFLAGS on kFreeBSD builds, if you want.

That patch says -DDBFS_HAS_SYS_EXTATTR=0 where it should say -DBFS_HAS_SYS_EXTATTR=0 (extra D). But even still I don't see that the flag got added in https://buildd.debian.org/status/fetch.php?pkg=bfs&arch=kfreebsd-amd64&ver=1.6-2&stamp=1583468613&raw=0

lamby commented

Doh. Fixed and uploaded!

lamby commented

Ah, yes I think you right. On my linux/amd64 system my DEB_HOST_ARCH_OS is linux and DEB_HOST_ARCH is amd64. I was hoping that DEB_HOST_ARCH was kfreebsd-am64 or somesuch on kfreebsd... uploading again now.

Looks like the latest kFreeBSD builds worked!