Any suggestions to fix “In function ‘GetLocalClientCreds’ error = storage size of ‘peercred’ isn’t known error during make?
Dear Alpine Community,
I’m writing the community back to ask if anyone had any suggestions to fix an “In function ‘GetLocalClientCreds’ error = storage size of ‘peercred’ isn’t known during make build of TurboVNC from source for Alpine Linux. I was previously stuck on the Cmake part of the build, and the community graciously helped suggest where I could get the additional header file needed for the Cmake part of the build. I then moved on to the make part of the build and received the above error approximately 85% of the way through the make build as noted in the VERBOSE debug output snippet below:
[84%] Built target sync make -f unix/Xvnc/programs/Xserver/os/CMakeFiles/os.dir/build.make unix/Xvnc/programs/Xserver/os/CMakeFiles/os.dir/depend make[2]: Entering directory '/root/turbovnc-2.2.6' cd /root/turbovnc-2.2.6 && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /root/turbovnc-2.2.6 /root/turbovnc-2.2.6/unix/Xvnc/programs/Xserver/os /root/turbovnc-2.2.6 /root/turbovnc-2.2.6/unix/Xvnc/programs/Xserver/os /root/turbovnc-2.2.6/unix/Xvnc/programs/Xserver/os/CMakeFiles/os.dir/DependInfo.cmake --color= make[2]: Leaving directory '/root/turbovnc-2.2.6' make -f unix/Xvnc/programs/Xserver/os/CMakeFiles/os.dir/build.make unix/Xvnc/programs/Xserver/os/CMakeFiles/os.dir/build make[2]: Entering directory '/root/turbovnc-2.2.6' [ 84%] Building C object unix/Xvnc/programs/Xserver/os/CMakeFiles/os.dir/access.c.o cd /root/turbovnc-2.2.6/unix/Xvnc/programs/Xserver/os && /usr/bin/cc -DCLIENTIDS -DCOMPOSITE -DDAMAGE -DDPMSExtension -DGLXEXT -DHASXDMAUTH -DHAS_SHM -DHAVE_DIX_CONFIG_H -DHAVE_SHA1_IN_LIBSHA1 -DHAVE_XSHMFENCE -DIPv6 -DMITSHM -DMONOTONIC_CLOCK -DNVCONTROL -DPANORAMIX -DPRESENT -DRANDR -DRENDER -DRES -DSCREENSAVER -DSHAPE -DTCPCONN -DTURBOVNC -DUNIXCONN -DUSE_POLL -DXACE -DXCSECURITY -DXDMCP -DXF86BIGFONT -DXFIXES -DXINPUT -DXRECORD -DXTEST -DXV -I/root/turbovnc-2.2.6/unix/include -I/root/turbovnc-2.2.6/unix/Xvnc/X_include -I/root/turbovnc-2.2.6/common/zlib -I/root/turbovnc-2.2.6/unix/Xvnc/programs/Xserver/Xext -I/root/turbovnc-2.2.6/unix/Xvnc/programs/Xserver/include -I/root/turbovnc-2.2.6/unix/Xvnc/programs/Xserver/miext/damage -I/root/turbovnc-2.2.6/unix/Xvnc/programs/Xserver/present -I/root/turbovnc-2.2.6/unix/Xvnc/programs/Xserver/../../lib/pixman/pixman -I/root/turbovnc-2.2.6/unix/Xvnc/programs/Xserver/os/../render -I/root/turbovnc-2.2.6/unix/Xvnc/programs/Xserver/os/../../../lib/libsha1 -w -O3 -DNDEBUG -fno-strict-aliasing -o CMakeFiles/os.dir/access.c.o -c /root/turbovnc-2.2.6/unix/Xvnc/programs/Xserver/os/access.c /root/turbovnc-2.2.6/unix/Xvnc/programs/Xserver/os/access.c: In function 'GetLocalClientCreds': /root/turbovnc-2.2.6/unix/Xvnc/programs/Xserver/os/access.c:1178:18: error: storage size of 'peercred' isn't known 1178 | struct ucred peercred; | ^~~~~~~~ make[2]: *** [unix/Xvnc/programs/Xserver/os/CMakeFiles/os.dir/build.make:96: unix/Xvnc/programs/Xserver/os/CMakeFiles/os.dir/access.c.o] Error 1 make[2]: Leaving directory '/root/turbovnc-2.2.6' make[1]: *** [CMakeFiles/Makefile2:2834: unix/Xvnc/programs/Xserver/os/CMakeFiles/os.dir/all] Error 2 make[1]: Leaving directory '/root/turbovnc-2.2.6' make: *** [Makefile:150: all] Error 2
I wrote to the TurboVNC help community who thought the error was likely related to Alpine Linux as other versions seemed to build without that error and suggested the error might be due to Alpine Linux not utilizing _GNU_SOURCE as stated by the TurboVNC community comment below:
“I think this is also a distribution-specific issue. I verified that my build is using the same code path in access.c that your build is using. If sys/socket.h defines SO_PEERCRED, then access.c will try to use 'struct ucred'. (NOTE: access.c is X.org code, not TurboVNC code.) However, 'struct ucred' is apparently only defined if _GNU_SOURCE is defined, so the first thing I would do is 'make VERBOSE=1' and verify whether _GNU_SOURCE is defined on the command line that builds access.c. If it isn't, then it's probably because this build system check failed: https://github.com/TurboVNC/turbovnc/blob/main/unix/Xvnc/CMakeLists.txt#L4-L9, which would happen if features.h doesn't define GLIBC on your system. It could also be that, for whatever reason, your system doesn't define 'struct ucred'.“
My question then from the Alpine Linux community is whether there is something straightforward I can now do within Alpine Linux to define _GNU_SOURCE that would allow me to continue with the make build of the TurboVNC from its source? I tried doing “make CFLAGS=-D_GNU_SOURCE” but that did not work (same error). I do also have glibc installed.
I apologize that as a novice Linux user, I am not able to figure out any further how I could do this (or if it possible to do this and perhaps I can’t build TurboVNC from source on Alpine Linux because of this issue). I could modify the Cmake of makefile scripts if that would be the solution, but do not know how to program in C.
I appreciate any further assistance or advice you could provide in this matter. If I’m able to successfully build TurboVNC in Alpine Linux from source, I’d be happy to share with the community what worked to see if the community might want to add it to the Alpine repository in the future.
Thank you.
Sincerely,