samurai fails to compile with uclibc
stefson opened this issue · 6 comments
hey there, I learned about your project and wanted to give it a go on my rpi since it's lean and presumably better than ninja.
there is a bit of a showstopper here:
* samurai-1.0.tar.gz BLAKE2B SHA512 size ;-) ... [ ok ]
* checking ebuild checksums ;-) ... [ ok ]
>>> Unpacking source...
>>> Unpacking samurai-1.0.tar.gz to /var/tmp/portage/dev-util/samurai-1.0/work
>>> Source unpacked in /var/tmp/portage/dev-util/samurai-1.0/work
>>> Preparing source in /var/tmp/portage/dev-util/samurai-1.0/work/samurai-1.0 ...
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/dev-util/samurai-1.0/work/samurai-1.0 ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/dev-util/samurai-1.0/work/samurai-1.0 ...
make -j4
c99 -O2 -pipe -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard -Wall -Wextra -std=c99 -pedantic -c -o build.o build.c
c99 -O2 -pipe -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard -Wall -Wextra -std=c99 -pedantic -c -o deps.o deps.c
c99 -O2 -pipe -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard -Wall -Wextra -std=c99 -pedantic -c -o env.o env.c
c99 -O2 -pipe -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard -Wall -Wextra -std=c99 -pedantic -c -o graph.o graph.c
graph.c: In function 'nodestat':
graph.c:96:26: error: 'struct stat' has no member named 'st_mtim'; did you mean 'st_mtime'?
96 | n->mtime = (int64_t)st.st_mtim.tv_sec * 1000000000 + st.st_mtim.tv_nsec;
| ^~~~~~~
| st_mtime
graph.c:96:59: error: 'struct stat' has no member named 'st_mtim'; did you mean 'st_mtime'?
96 | n->mtime = (int64_t)st.st_mtim.tv_sec * 1000000000 + st.st_mtim.tv_nsec;
| ^~~~~~~
| st_mtime
make: *** [Makefile:34: graph.o] Error 1
make: *** Waiting for unfinished jobs....
this is with uclibc on armv7a-unknown-linux-uclibceabihf, the compile is working with glibc based armv7 system.
What version of uclibc are you using? Does uclibc not support st_mtim
? That is necessary to get sub-second granularity timestamps. What does the struct stat
look like on your system?
ok, so I think the problem is here: https://github.com/michaelforney/samurai/blob/master/graph.c#L93
adding uclibc to that exclusion should make the compile work.
here's a list of the most important libs and compilers:
emerge --info
Portage 2.3.79 (python 3.6.9-final-0, default/linux/arm/17.0/uclibc/armv7a, gcc-9.2.0, uclibc-ng-1.0.31, 4.14.160-raspberrypi-v7+ armv7l)
=================================================================
System uname: Linux-4.14.160-raspberrypi-v7+-armv7l-ARMv7_Processor_rev_5_-v7l-with-gentoo-2.6
KiB Mem: 961276 total, 283908 free
KiB Swap: 0 total, 0 free
Timestamp of repository gentoo: Mon, 13 Jan 2020 17:15:01 +0000
Head commit of repository gentoo: 800eb4146cfe655ca8962d7fb692bae138bdfeb1
sh bash 4.4_p23-r1
ld GNU ld (Gentoo 2.32 p2a) 2.32.0
app-shells/bash: 4.4_p23-r1::gentoo
dev-lang/perl: 5.30.1::gentoo
dev-lang/python: 3.6.9::gentoo
sys-apps/baselayout: 2.6-r1::gentoo
sys-apps/openrc: 0.42.1::gentoo
sys-apps/sandbox: 2.13::gentoo
sys-devel/autoconf: 2.69-r4::gentoo
sys-devel/automake: 1.16.1-r1::gentoo
sys-devel/binutils: 2.32-r1::gentoo
sys-devel/gcc: 9.2.0-r2::gentoo
sys-devel/gcc-config: 2.1::gentoo
sys-devel/libtool: 2.4.6-r3::gentoo
sys-devel/make: 4.2.1-r4::gentoo
sys-kernel/linux-headers: 4.19::gentoo (virtual/os-headers)
sys-libs/uclibc-ng: 1.0.31::gentoo
Looks like building with -D _DEFAULT_SOURCE
fixes the issue. This sounds like a bug in uclibc. It should expose the st_mtim
field since we define _POSIX_C_SOURCE=200809L
.
I'm going to try again with uclibc-1.0.32, will post results.
I'm closing this, since samurai already requires POSIX.1-2008 (stated in README). It is up to you to pass any additional flags necessary for your libc to expose these interfaces.