~lattis/muon#96: 
muon doesn't compile on old distro

I get this error on slackware 14.0, glibc headers 2.15

In file included from /usr/include/sys/stat.h:107:0,
                 from ../subprojects/bestline/bestline.c:149:
/usr/include/bits/stat.h:73:21: error: field ‘st_atim’ has incomplete type
     struct timespec st_atim;  /* Time of last access.  */
                     ^
/usr/include/bits/stat.h:74:21: error: field ‘st_mtim’ has incomplete type
     struct timespec st_mtim;  /* Time of last modification.  */
                     ^
/usr/include/bits/stat.h:75:21: error: field ‘st_ctim’ has incomplete type
     struct timespec st_ctim;  /* Time of last status change.  */
                     ^
In file included from ../subprojects/bestline/bestline.c:149:0:
/usr/include/sys/stat.h:374:56: error: array type has incomplete element type ‘struct timespec’
 extern int futimens (int __fd, __const struct timespec __times[2]) __THROW;
                                                        ^
In file included from ../subprojects/bestline/bestline.c:157:0:
/usr/include/signal.h:155:31: error: unknown type name ‘siginfo_t’
 extern void psiginfo (__const siginfo_t *__pinfo, __const char *__s);
                               ^
samu: subcommand failed
Status
RESOLVED CLOSED
Submitter
~wdlkmpx
Assigned to
No-one
Submitted
1 year, 7 months ago
Updated
1 year, 7 months ago
Labels
No labels applied.

~wdlkmpx 1 year, 7 months ago · edit

This patch fixes the issue for me.. 1 is a really bad value for _POSIX_C_SOURCE... 200112L also works

diff --git a/subprojects/bestline/bestline.c b/subprojects/bestline/bestline.c
index 5361f8b4..cda6f101 100644
--- a/subprojects/bestline/bestline.c
+++ b/subprojects/bestline/bestline.c
@@ -132,7 +132,7 @@
 #include "bestline.h"
 
 #ifndef __COSMOPOLITAN__
-#define _POSIX_C_SOURCE  1 /* so GCC builds in ANSI mode */
+#define _POSIX_C_SOURCE  200809L /* so GCC builds in ANSI mode */
 #define _XOPEN_SOURCE  700 /* so GCC builds in ANSI mode */
 #define _DARWIN_C_SOURCE 1 /* so SIGWINCH / IUTF8 on XNU */
 #ifdef __sun

~eschwartz 1 year, 7 months ago

That subproject is vendored from https://github.com/jart/bestline so probably it's best to make the fix there and then import a new version into muon.

~eschwartz 1 year, 7 months ago

~wdlkmpx 1 year, 7 months ago · edit

jart/bestline throws just 1 error: /usr/include/signal.h:155:31: error: unknown type name ‘siginfo_t’

This is fixed only if _POSIX_C_SOURCE >= 199309L .. I guess

/usr/include/signal.h from GLIBC 2.15

#ifdef __USE_POSIX199309
/* We need `struct timespec' later on.  */
# define __need_timespec
# include <time.h>

/* Get the `siginfo_t' type plus the needed symbols.  */
# include <bits/siginfo.h>
#endif

~wdlkmpx 1 year, 7 months ago · edit

This is not a problem with GLIBC 2.27

At some point glibc started to evaluate _POSIX_C_SOURCE.. in glibc 2.27 _POSIX_C_SOURCE can't be lower than 199506L (undef + define)

This can be closed, it's one of issues and patches I can keep to myself, glibc 2.15 is really old by now

~lattis REPORTED CLOSED 1 year, 7 months ago

I also feel like bestline should be disabled by default... its only use is for the repl, which most people probably don't use at all.

Register here or Log in to comment, or comment via email.