building util-linux-2.40.2

Mark Geisert mark@maxrnd.com
Fri Feb 7 02:28:04 GMT 2025


Hi Jeremy,

On 2/6/2025 1:22 PM, Jeremy Drake via Cygwin wrote:
> We were attempting to build util-linux 2.40.2 for MSYS2, based on the
> source package of util-linux-2.40.2-2 from Cygwin [1].  We were scratching
> our heads as to why it wasn't building tasksel for us, when it did in your
> package.  I evenutally saw in the cygport that it tests for sys/syscall.h
> and warns if it is not present.  I could not find a package that provides
> this header.  Can you explain where it comes from, so that we can also
> build util-linux?  (For now, I added a couple extra patches to
> configure.ac to make it look for functions instead of syscall numbers [2])
> 
> 1: https://github.com/msys2/MSYS2-packages/pull/5194
> 2:
> https://github.com/msys2/MSYS2-packages/compare/bbc219480a47d1f0ab87b99302627815390f4ee1..e00b44ad67481a8ad1c490d2b5475d3500dac436

Apologies for the inconvenience.  It's an unsettled matter if/whether 
Cygwin should supply a sys/syscall.h.  I cobbled together something to 
allow the util-linux, and something else maybe FUSE-related, to complete 
build without angst.

The following script creates on stdout something that works.  Direct 
stdout to /usr/include/sys/syscall.h if you dare ;-).
HTH,

..mark
---------------------------

#!/bin/sh
#
#       gen-syscall-h.sh
#       Generates #defines for a plausible Cygwin <sys/syscall.h> on stdout
#       2023/12/30 Original version by Mark A. Geisert <mark@maxrnd.com>
#
#       This currently works by creating a list of all symbols exported
#       by libcygwin.a and subtracting out the symbols also exported
#       by libm.a.  After that, a symbol is kept only if it starts with
#       a lowercase letter and does not start with "cygwin_" or "main".
#
TMPF=/tmp/.$$.
trap 'rm -f $TMPF' EXIT
nm /usr/lib/libm.a | awk '/ T [a-z]/    {print $3}' | sort > $TMPF
nm /usr/lib/libcygwin.a | awk '/ T [a-z]/       {print $3}' | \
         grep -vE '^cygwin_|^main' | sort | \
         diff --suppress-common-lines -y - $TMPF | \
         awk '/^[a-z]/   {printf "#define SYS_%s %d\n", $1, ++RECNO}'
exit $?



More information about the Cygwin mailing list