jart / bestline

ANSI Standard X3.64 Teletypewriter Command Session Library
Other
443 stars 29 forks source link

Cannot build: compatibility with glibc? #2

Closed alexey-milovidov closed 2 years ago

alexey-milovidov commented 2 years ago
milovidov@milovidov-desktop:~/work/bestline$ clang++ --version
clang version 11.0.0 (https://github.com/llvm/llvm-project.git f5df584a5077e726ad851ccfe8496deda3e5ef07)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin

milovidov@milovidov-desktop:~/work/bestline$ CC=clang make    
clang    -c -o bestline.o bestline.c
In file included from bestline.c:122:
In file included from /usr/include/termios.h:25:
/usr/include/features.h:314:53: error: invalid token at start of a preprocessor expression
     || (defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 1)       \
                                                    ^
/usr/include/features.h:319:48: error: invalid token at start of a preprocessor expression
#if defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 2 || defined _XOPEN_SOURCE
                                               ^
bestline.c:213:25: warning: tentative definition of variable with internal linkage has incomplete non-array type 'struct sigaction' [-Wtentative-definition-incomplete-type]
static struct sigaction orig_int;
                        ^
bestline.c:213:15: note: forward declaration of 'struct sigaction'
static struct sigaction orig_int;
              ^
bestline.c:214:25: warning: tentative definition of variable with internal linkage has incomplete non-array type 'struct sigaction' [-Wtentative-definition-incomplete-type]
static struct sigaction orig_quit;
                        ^
bestline.c:213:15: note: forward declaration of 'struct sigaction'
static struct sigaction orig_int;
              ^
bestline.c:215:25: warning: tentative definition of variable with internal linkage has incomplete non-array type 'struct sigaction' [-Wtentative-definition-incomplete-type]
static struct sigaction orig_cont;
                        ^
bestline.c:213:15: note: forward declaration of 'struct sigaction'
static struct sigaction orig_int;
              ^
bestline.c:216:25: warning: tentative definition of variable with internal linkage has incomplete non-array type 'struct sigaction' [-Wtentative-definition-incomplete-type]
static struct sigaction orig_winch;
                        ^
bestline.c:213:15: note: forward declaration of 'struct sigaction'
static struct sigaction orig_int;
              ^
bestline.c:1107:15: warning: implicit declaration of function 'getdelim' is invalid in C99 [-Wimplicit-function-declaration]
    if ((rc = getdelim(&p, &c, '\n', f)) != EOF) {
              ^
bestline.c:1652:22: error: variable has incomplete type 'struct sigaction'
    struct sigaction sa;
                     ^
bestline.c:213:15: note: forward declaration of 'struct sigaction'
static struct sigaction orig_int;
              ^
bestline.c:1665:13: warning: implicit declaration of function 'sigemptyset' is invalid in C99 [-Wimplicit-function-declaration]
            sigemptyset(&sa.sa_mask);
            ^
bestline.c:1666:13: warning: implicit declaration of function 'sigaction' is invalid in C99 [-Wimplicit-function-declaration]
            sigaction(SIGCONT,&sa,&orig_cont);
            ^
bestline.c:1681:9: warning: implicit declaration of function 'sigaction' is invalid in C99 [-Wimplicit-function-declaration]
        sigaction(SIGCONT,&orig_cont,0);
        ^
bestline.c:1875:43: warning: implicitly declaring library function 'strdup' with type 'char *(const char *)' [-Wimplicit-function-declaration]
    history[historylen - 1 - l->hindex] = strdup(l->buf);
                                          ^
bestline.c:1875:43: note: include the header <string.h> or explicitly provide a declaration for 'strdup'
bestline.c:2023:26: warning: implicitly declaring library function 'strndup' with type 'char *(const char *, unsigned long)' [-Wimplicit-function-declaration]
        ring.p[ring.i] = strndup(p, n);
                         ^
bestline.c:2023:26: note: include the header <string.h> or explicitly provide a declaration for 'strndup'
bestline.c:2742:5: error: unknown type name 'sigset_t'; did you mean '__sigset_t'?
    sigset_t omask;
    ^~~~~~~~
    __sigset_t                                                                                                                                                                                                                                        
/usr/include/x86_64-linux-gnu/bits/types/__sigset_t.h:8:3: note: '__sigset_t' declared here
} __sigset_t;
  ^
bestline.c:2744:22: error: variable has incomplete type 'struct sigaction'
    struct sigaction sa;
                     ^
bestline.c:213:15: note: forward declaration of 'struct sigaction'
static struct sigaction orig_int;
              ^
bestline.c:2748:5: warning: implicit declaration of function 'sigemptyset' is invalid in C99 [-Wimplicit-function-declaration]
    sigemptyset(&sa.sa_mask);
    ^
bestline.c:2749:5: warning: implicit declaration of function 'sigaddset' is invalid in C99 [-Wimplicit-function-declaration]
    sigaddset(&sa.sa_mask,SIGINT);
    ^
bestline.c:2751:5: warning: implicit declaration of function 'sigprocmask' is invalid in C99 [-Wimplicit-function-declaration]
    sigprocmask(SIG_BLOCK,&sa.sa_mask,&omask);
    ^
bestline.c:2751:17: error: use of undeclared identifier 'SIG_BLOCK'
    sigprocmask(SIG_BLOCK,&sa.sa_mask,&omask);
                ^
bestline.c:2752:19: error: use of undeclared identifier 'SA_NODEFER'
    sa.sa_flags = SA_NODEFER;
                  ^
bestline.c:2754:5: warning: implicit declaration of function 'sigaction' is invalid in C99 [-Wimplicit-function-declaration]
    sigaction(SIGINT,&sa,&orig_int);
    ^
bestline.c:2758:21: error: use of undeclared identifier 'SIG_UNBLOCK'
        sigprocmask(SIG_UNBLOCK,&sa.sa_mask,0);
                    ^
bestline.c:2766:17: error: use of undeclared identifier 'SIG_SETMASK'
    sigprocmask(SIG_SETMASK,&omask,0);
                ^
bestline.c:2797:18: warning: implicit declaration of function 'fileno' is invalid in C99 [-Wimplicit-function-declaration]
    if ((!isatty(fileno(stdin)) ||
                 ^
bestline.c:213:25: error: tentative definition has type 'struct sigaction' that is never completed
static struct sigaction orig_int;
                        ^
bestline.c:213:15: note: forward declaration of 'struct sigaction'
static struct sigaction orig_int;
              ^
bestline.c:214:25: error: tentative definition has type 'struct sigaction' that is never completed
static struct sigaction orig_quit;
                        ^
bestline.c:213:15: note: forward declaration of 'struct sigaction'
static struct sigaction orig_int;
              ^
bestline.c:215:25: error: tentative definition has type 'struct sigaction' that is never completed
static struct sigaction orig_cont;
                        ^
bestline.c:213:15: note: forward declaration of 'struct sigaction'
static struct sigaction orig_int;
              ^
bestline.c:216:25: error: tentative definition has type 'struct sigaction' that is never completed
static struct sigaction orig_winch;
                        ^
bestline.c:213:15: note: forward declaration of 'struct sigaction'
static struct sigaction orig_int;
              ^
15 warnings and 13 errors generated.
make: *** [<builtin>: bestline.o] Error 1
milovidov@milovidov-desktop:~/work/bestline$ ldd --version
ldd (Ubuntu GLIBC 2.31-0ubuntu9.2) 2.31
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
jart commented 2 years ago

I'm assuming this is fixed by the pull request you just sent?

alexey-milovidov commented 2 years ago

Yes.