On 09/05/19 03:50, Osipov, Michael wrote: > Hi folks, > > please find a patch attached to properly compile and link GNU coreutils > 8.31 on HP-UX IA64. As of now, it does not compile out of the box. > > The patch includes these changes: > > * basenc.c: HP aCC does not allow anonymous unions inside structs, I > have named it otherwise the compilation fails > * blake2/blake2.h: __attribute__((packed)) does not exist in HP aCC, use > #pragma pack > * copy.c, mkfifo.c: disable SELinux code if it is not available > * system.h: use __attribute(x) on a GNU-style compiler only > * configure.ac, local.mk: use HP aCC-style linker options for libstdbuf > > Compile instructions: >> export PREFIX=/opt/ports/coreutils >> export LIBDIR=$PREFIX/lib/hpux32 >> export CONFIGURE="./configure --prefix=$PREFIX --libdir=$LIBDIR" >> export CPPFLAGS="-I$PREFIX/include -D_INCLUDE_STDC__SOURCE_199901" >> export LDFLAGS="-L$LIBDIR" >> autoreconf -fi >> FORCE_UNSAFE_CONFIGURE=1 gl_cv_have_include_next=no ac_cv_func_getacl=no >> ac_cv_func_aclsort=no ac_cv_header_sys_bitypes_h=no $CONFIGURE >> gmake install > The patch isn't perfect, some issues need to be discussion because I > don't know yet how to solve them: > * copy.c, mkfifo.c: for some reason the code compiles w/o changes > although SELinux is not available
These selinux interfaces are provided by gnulib, and so should automatically by ignored on HPUX. I.E. I'm not sure this part is needed at all. > * I have disabled the compilation of b2sum completely because gmake > repeatedly quits with: >> gmake[2]: *** No rule to make target '/var/tmp/AAA000546.i', needed by >> 'src/b2sum-md5sum.o'. Stop. >> gmake[2]: Leaving directory '/tmp/system-compile/gnu/coreutils-8.31' >> gmake[1]: *** [Makefile:12647: all-recursive] Error 1 >> gmake[1]: Leaving directory '/tmp/system-compile/gnu/coreutils-8.31' >> gmake: *** [Makefile:6827: all] Error 2 > diff -ur src/blake2/blake2.h src/blake2/blake2.h > --- src/blake2/blake2.h 2018-05-14 06:20:24 +0000 > +++ src/blake2/blake2.h 2019-05-08 15:08:42 +0000 > @@ -21,8 +21,12 @@ > #if defined(_MSC_VER) > #define BLAKE2_PACKED(x) __pragma(pack(push, 1)) x __pragma(pack(pop)) > #else > +#ifdef __hpux > +#define BLAKE2_PACKED(x) x > > +#else > #define BLAKE2_PACKED(x) x __attribute__((packed)) > #endif > +#endif > > #if defined(__cplusplus) > extern "C" { > @@ -86,6 +90,9 @@ > size_t outlen; > } blake2bp_state; > > +#ifdef __hpux > +#pragma pack 1 > +#endif > > BLAKE2_PACKED(struct blake2s_param__ > { > @@ -102,9 +109,15 @@ > uint8_t salt[BLAKE2S_SALTBYTES]; /* 24 */ > uint8_t personal[BLAKE2S_PERSONALBYTES]; /* 32 */ > }); > +#ifdef __hpux > +#pragma pack > +#endif That's a bit awkward, also this file comes from blake2 upstream source on github, so you might want to broach the change there. > diff -ur src/system.h src/system.h > --- src/system.h 2019-01-05 11:36:22 +0000 > +++ src/system.h 2019-05-08 15:19:29 +0000 > @@ -422,6 +422,10 @@ > # endif > #endif > > +#ifndef __GNUC__ > +#define __attribute(x) /* empty */ > +#endif The only use of __attribute is: src/libstdbuf.c:/* Use __attribute to avoid elision of __attribute__ on SUNPRO_C etc. */ src/libstdbuf.c:static void __attribute ((constructor)) So we should probably have special __hpux handling in that file rather than doing the above. This is all dependent on stdbuf actually working on your platform. Possibly the most appropriate change would be to use __attribute rather than __attribute__ in configure.ac > #ifndef ATTRIBUTE_NORETURN > # define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) > #endif > --- configure.ac 2019-03-04 08:40:55 +0000 > +++ configure.ac 2019-05-08 15:40:41 +0000 > @@ -481,8 +481,8 @@ > gl_WARN_ADD([-errwarn], [CFLAGS]) > # Put this message here, after gl_WARN_ADD's chatter. > AC_MSG_CHECKING([whether this system supports stdbuf]) > -CFLAGS="-fPIC $CFLAGS" > -LDFLAGS="-shared $LDFLAGS" > +CFLAGS="+z $CFLAGS" > +LDFLAGS="-b $LDFLAGS" This would need to be conditional, again if stdbuf does actually work on hpux. thanks, Pádraig