Subject: Issue with gnulib while packaging licenseutils, GuixSD

From: Aria <[email-masked]>
Date: Wed, 22 Jan 2025 02:32:57 +0000

I'm currently having issues with gnulib trying to package licenseutils
on GuixSD:
fseterr.c: In function ‘fseterr’:
fseterr.c:77:3: error: #error "Please port gnulib fseterr.c to your
platform! Look at the definitions of ferror and clearerr on your system,
then report this to bug-gnulib."
   77 |  #error "Please port gnulib fseterr.c to your platform! Look at
the definitions of ferror and clearerr on your system, then report this
to bug-gnulib."
      |   ^~~~~

I haven't found many other sources on this issue, and the ones I have
are on specific projects and don't apply currently. Looking at fseterr
itself I found the following:

#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__
== 1
  /* GNU libc, BeOS, Haiku, Linux libc5 */
...
#else
 #error "Please port gnulib fseterr.c to your platform! Look at the
definitions of ferror and clearerr on your system, then report this to
bug-gnulib."
#endif

I am currently using glibc, and am confused why __GNU_LIBRARY__ would
not be equal to 1. To add to my confusion the following C program:

#include <stdio.h>

int
main(void)
{
  printf("%d\n", _IO_EOF_SEEN);
  printf("%d\n", __GNU_LIBRARY__);

  return 0;
}

outputs this when compiled:

16
6

meaning that _IO_EOF_SEEN *is* in fact defined (I later checked if it
was a macro or not by trying to redefine it, which gave me a compiler
error. I am using GCC.)

My package file is as follows:

(define-module (packages licenseutils)
  #:use-module (guix packages)
  #:use-module (gnu packages image)
  #:use-module (gnu packages curl)
  #:use-module (gnu packages bash)
  #:use-module (gnu packages base)
  #:use-module (gnu packages autotools)
  #:use-module (gnu packages gettext)
  #:use-module (gnu packages texinfo)
  #:use-module (gnu packages man)
  #:use-module (gnu packages m4)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages glib)
  #:use-module (gnu packages pretty-print)
  #:use-module (gnu packages build-tools)
  #:use-module (guix download)
  #:use-module (guix build-system gnu)
  #:use-module (guix licenses))

(define-public licenseutils
  (package
   (name "licenseutils")
   (version "0.0.9")
   (source (origin
            (method url-fetch)
            (uri (string-append
"http://download.savannah.nongnu.org/releases/licenseutils/licenseutils-"
version
				".tar.gz"))
            (sha256
             (base32
              "1k0jp7g42lfbz5qzcdd3xcj97drrimjsr8m9166cwpya0zi5bi6f"))))
   (build-system gnu-build-system)
   (arguments '(#:configure-flags '("--enable-silent-rules")))
   (inputs (list libpng curl bash coreutils
		 autoconf automake libtool gettext-minimal texinfo help2man m4
pkg-config
		 glib source-highlight gnulib))
   (synopsis '())
   (description '())
   (home-page "https://sv.gnu.org/p/licenseutils")
   (license gpl3+)))