sahlberg / libnfs

NFS client library
Other
532 stars 204 forks source link

libnfs-5.0.3 fails to build with GCC14 with [-Wimplicit-function-declaration] #473

Closed tgurr closed 4 months ago

tgurr commented 4 months ago

With GCC 14 I'm experiencing the following error trying to build libnfs 5.0.3:

[ 92%] Building C object lib/CMakeFiles/nfs.dir/pdu.c.o
cd /var/tmp/paludis/build/net-fs-libnfs-5.0.3/work/build/lib && /usr/bin/x86_64-pc-linux-gnu-cc -DHAVE_CONFIG_H -D_U_="__attribute__((unused))" -Dnfs_EXPORTS -I/var/tmp/paludis/build/net-fs-libnfs-5.0.3/work/build -I/var/tmp/paludis/build/net-fs-libnfs-5.0.3/work/libnfs-libnfs-5.0.3/include -I/var/tmp/paludis/build/net-fs-libnfs-5.0.3/work/libnfs-libnfs-5.0.3/include/nfsc -I/var/tmp/paludis/build/net-fs-libnfs-5.0.3/work/libnfs-libnfs-5.0.3/rquota -I/var/tmp/paludis/build/net-fs-libnfs-5.0.3/work/libnfs-libnfs-5.0.3/portmap -I/var/tmp/paludis/build/net-fs-libnfs-5.0.3/work/libnfs-libnfs-5.0.3/nsm -I/var/tmp/paludis/build/net-fs-libnfs-5.0.3/work/libnfs-libnfs-5.0.3/nlm -I/var/tmp/paludis/build/net-fs-libnfs-5.0.3/work/libnfs-libnfs-5.0.3/nfs4 -I/var/tmp/paludis/build/net-fs-libnfs-5.0.3/work/libnfs-libnfs-5.0.3/nfs -I/var/tmp/paludis/build/net-fs-libnfs-5.0.3/work/libnfs-libnfs-5.0.3/mount -march=native -O2 -pipe -fPIC -fdiagnostics-color=always   -Wall -MD -MT lib/CMakeFiles/nfs.dir/pdu.c.o -MF CMakeFiles/nfs.dir/pdu.c.o.d -o CMakeFiles/nfs.dir/pdu.c.o -c /var/tmp/paludis/build/net-fs-libnfs-5.0.3/work/libnfs-libnfs-5.0.3/lib/pdu.c
/var/tmp/paludis/build/net-fs-libnfs-5.0.3/work/libnfs-libnfs-5.0.3/lib/pdu.c: In function 'rpc_queue_pdu':
/var/tmp/paludis/build/net-fs-libnfs-5.0.3/work/libnfs-libnfs-5.0.3/lib/pdu.c:322:29: error: implicit declaration of function 'writev'; did you mean 'fwrite'? [-Wimplicit-function-declaration]
  322 |                         if (writev(rpc->fd, &iov[1], niov - 1) < 0) {
      |                             ^~~~~~
      |                             fwrite
make[2]: *** [lib/CMakeFiles/nfs.dir/build.make:174: lib/CMakeFiles/nfs.dir/pdu.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....

This is with GCC 14.1.0, switching to GCC 13.2.0 instead allows the build to succeed.

Complete build log: libnfs-5.0.3.log.txt

sahlberg commented 4 months ago

writev is defined in sys/uio.h. Autotools have had checks for sys/uio.h for a long time but CMake only got a check for this header file in mid february. very shortly after 5.0.3.

There are two ways you can solve this: 1, build using autotools instead of cmake 2, switch to current master. Note that the API has changed since 5.0.3, see README for details on all symbols that have changed.