[tlbuild] texlive 2011 build on aix 4.3 - strnlen(3) is used by lcdf-typetools but it is missing or broken on AIX

Vladimir Volovich vvv at vsu.ru
Mon Jun 13 20:37:29 CEST 2011


Hi!

on AIX 4.3, I had to apply the following (quick and dirty) patch to
compile lcdf-typetools:

===============================
--- texk/lcdf-typetools/liblcdf/error.cc.orig
+++ texk/lcdf-typetools/liblcdf/error.cc
@@ -34,6 +34,12 @@
 # endif
 #endif
 
+		static size_t strnlen(const char *s, size_t n)
+		{
+			const char *p = (const char *)memchr(s, 0, n);
+			return p ? p - s : n;
+		}
+
 /** @file error.hh
  * @brief Flexible error handling classes.
  */
===============================

Without the patch, i was getting compile error:

source='../../../../texk/lcdf-typetools/liblcdf/error.cc' object='error.o' libtool=no \
        DEPDIR=.deps depmode=aix /bin/bash ../../../../texk/lcdf-typetools/../../build-aux/depcomp \
        xlC  -DHAVE_CONFIG_H -I. -I../../../../texk/lcdf-typetools/liblcdf -I.. -I../../../../texk/lcdf-typetools/include  -I/opt/freeware/include -DUSE_STDLIB_WORKAROUNDS  -O2 -qmaxmem=262144 -qarch=com -qlanglvl=extended -c -o error.o ../../../../texk/lcdf-typetools/liblcdf/error.cc
"../../../../texk/lcdf-typetools/liblcdf/error.cc", line 491.23: 1540-0274 (S) The name lookup for "strnlen" did not find a declaration.
gmake[5]: *** [error.o] Error 1
gmake[5]: Leaving directory `/usr/local/vvv/src/source/Work/texk/lcdf-typetools/liblcdf'

The following pages contain information that strnlen is missing or
broken on AIX 4.3:

https://bugzilla.samba.org/show_bug.cgi?id=1097
https://attachments.samba.org/attachment.cgi?id=416

and they provide some autoconf checks for this, and use the following
replacement when it is missing or broken:

#if !defined(HAVE_STRNLEN) || defined(HAVE_BROKEN_STRNLEN)
		static size_t strnlen(const char *s, size_t n)
		{
			const char *p = (const char *)memchr(s, 0, n);
			return p ? p - s : n;
		}
#endif /* HAVE_STRNLEN */

Best wishes,
v.


More information about the tlbuild mailing list