11.26 - compilation issue - zen/serialize.h error: '::sysconf' has not been de

Get help for specific problems
Posts: 35
Joined: 14 Aug 2022

daviank

Another build issue with 11.26
../../zen/serialize.h: In function 'void zen::unbufferedStreamCopy(Function1, size_t, Function2, size_t)':
../../zen/serialize.h:316:32: error: '::sysconf' has not been declared; did you mean 'swscanf'?
  316 |     const size_t alignment = ::sysconf(_SC_PAGESIZE); //-1 on error => posix_memalign() will fail
      |                                ^~~~~~~
      |                                swscanf
compilation terminated due to -Wfatal-errors.
Fix might be:
--- a/zen/serialize.h
+++ b/zen/serialize.h
@@ -10,6 +10,7 @@
 //#include <bit>
 #include <functional>
 #include "sys_error.h"
+#include <unistd.h>
 //keep header clean from specific stream implementations! (e.g.file_io.h)! used by abstract.h!