Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make distcheck fails on Github runner ubuntu-24.04 with clang compiler #3205

Closed
matt335672 opened this issue Aug 14, 2024 · 0 comments · Fixed by #3206
Closed

make distcheck fails on Github runner ubuntu-24.04 with clang compiler #3205

matt335672 opened this issue Aug 14, 2024 · 0 comments · Fixed by #3206

Comments

@matt335672
Copy link
Member

xrdp version

devel

Detailed xrdp version, build options

N/A

Operating system & version

Ubuntu 24.04 LTS

Installation method

other

Which backend do you use?

N/A

What desktop environment do you use?

N/A

Environment xrdp running on

N/A

What's your client?

N/A

Area(s) with issue?

Compile error

Steps to reproduce

Edit .github/workflows/build.yml and replace ubuntu-latest with ubuntu-24.04

✔️ Expected Behavior

Runner succeeds

❌ Actual Behavior

'max features with clang' fails the distcheck phase with these compilation errors:-

CC       base64.lo
  CC       fifo.lo
  CC       file.lo
  CC       guid.lo
../../../common/base64.c:196:24: error: initializing 'char *' with an expression of type 'const char[66]' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
  196 |     static const char *b64chr =
      |                        ^
  197 |         "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  198../../../common/guid.c | : 92 : 21 :   error:  passing 'const char[69]' to parameter of type 'char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers] 
"abcdefghijklmnopqrst   u92v | w x y z "g
_      s| p        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~r
int  f199( | d e s t ,   " % 0"20X1%20324X5%60728X9%+0/2=X"-;%
0      2| X        ~~~~~~~~~~~~~~~%
02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X",
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../common/os_calls.h:59:40: note: passing argument to parameter 'format' here
   59 | void g_sprintf(char *dest, const char *format, ...) \
      |                                        ^
1 error generated.
1 error generated.
make[3]: *** [Makefile:589: base64.lo] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: *** [Makefile:589: guid.lo] Error 1
../../../common/file.c:301:61: error: passing 'const char[1]' to parameter of type 'char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
  301 |                                     list_add_strdup(values, "");
      |                                                             ^~
../../../common/list.h:146:48: note: passing argument to parameter 'str' here
  146 | list_add_strdup(struct list *self, const char *str);
      |                                                ^
1 error generated.
make[3]: *** [Makefile:589: file.lo] Error 1
make[3]: Leaving directory '/home/runner/work/xrdp/xrdp/xrdp-0.10.80/_build/sub/common'
make[2]: *** [Makefile:511: all-recursive] Error 1
make[2]: Leaving directory '/home/runner/work/xrdp/xrdp/xrdp-0.10.80/_build/sub'
make[1]: *** [Makefile:443: all] Error 2
make[1]: Leaving directory '/home/runner/work/xrdp/xrdp/xrdp-0.10.80/_build/sub'
make: *** [Makefile:728: distcheck] Error 1
Error: Process completed with exit code 2.

Inspection shows that the 'const' qualifier is being ignored in all of these places.

Looking up the log file a little way shows this line when distcheck runs configure.

checking for an ANSI C-conforming const... no

As a result, const is redefined to be /* */!

This behaviour is caused by the m4 AC_C_CONST macro.

Running the clang make distcheck on a Ubuntu 24.04 VM shows that the test program used by the macro is failing with clang for unrelated reasons.

The test program is as follows:-

1:/* confdefs.h */
2:#define PACKAGE_NAME "xrdp"
3:#define PACKAGE_TARNAME "xrdp"
4:#define PACKAGE_VERSION "0.10.80"
5:#define PACKAGE_STRING "xrdp 0.10.80"
6:#define PACKAGE_BUGREPORT "xrdp-devel@googlegroups.com"
7:#define PACKAGE_URL ""
8:#define VERSION_YEAR 2024
9:#define PACKAGE "xrdp"
10:#define VERSION "0.10.80"
11:#define HAVE_STDIO_H 1
12:#define HAVE_STDLIB_H 1
13:#define HAVE_STRING_H 1
14:#define HAVE_INTTYPES_H 1
15:#define HAVE_STDINT_H 1
16:#define HAVE_STRINGS_H 1
17:#define HAVE_SYS_STAT_H 1
18:#define HAVE_SYS_TYPES_H 1
19:#define HAVE_UNISTD_H 1
20:#define HAVE_WCHAR_H 1
21:#define STDC_HEADERS 1
22:#define _ALL_SOURCE 1
23:#define _DARWIN_C_SOURCE 1
24:#define _GNU_SOURCE 1
25:#define _HPUX_ALT_XOPEN_SOCKET_API 1
26:#define _NETBSD_SOURCE 1
27:#define _OPENBSD_SOURCE 1
28:#define _POSIX_PTHREAD_SEMANTICS 1
29:#define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1
30:#define __STDC_WANT_IEC_60559_BFP_EXT__ 1
31:#define __STDC_WANT_IEC_60559_DFP_EXT__ 1
32:#define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1
33:#define __STDC_WANT_IEC_60559_TYPES_EXT__ 1
34:#define __STDC_WANT_LIB_EXT2__ 1
35:#define __STDC_WANT_MATH_SPEC_FUNCS__ 1
36:#define _TANDEM_SOURCE 1
37:#define __EXTENSIONS__ 1
38:/* end confdefs.h.  */
40:int
41:main (void)
42:{
44:#ifndef __cplusplus
45:  /* Ultrix mips cc rejects this sort of thing.  */
46:  typedef int charset[2];
47:  const charset cs = { 0, 0 };
48:  /* SunOS 4.1.1 cc rejects this.  */
49:  char const *const *pcpcc;
50:  char **ppc;
51:  /* NEC SVR4.0.2 mips cc rejects this.  */
52:  struct point {int x, y;};
53:  static struct point const zero = {0,0};
54:  /* IBM XL C 1.02.0.0 rejects this.
55:     It does not let you subtract one const X* pointer from another in
56:     an arm of an if-expression whose if-part is not a constant
57:     expression */
58:  const char *g = "string";
59:  pcpcc = &g + (g ? g-g : 0);
60:  /* HPUX 7.0 cc rejects these. */
61:  ++pcpcc;
62:  ppc = (char**) pcpcc;
63:  pcpcc = (char const *const *) ppc;
64:  { /* SCO 3.2v4 cc rejects this sort of thing.  */
65:    char tx;
66:    char *t = &tx;
67:    char const *s = 0 ? (char *) 0 : (char const *) 0;
69:    *t++ = 0;
70:    if (s) return 0;
71:  }
72:  { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
73:    int x[] = {25, 17};
74:    const int *foo = &x[0];
75:    ++foo;
76:  }
77:  { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
78:    typedef const int *iptr;
79:    iptr p = 0;
80:    ++p;
81:  }
82:  { /* IBM XL C 1.02.0.0 rejects this sort of thing, saying
83:       "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
84:    struct s { int j; const int *ap[3]; } bx;
85:    struct s *b = &bx; b->j = 5;
86:  }
87:  { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
88:    const int foo = 10;
89:    if (!foo) return 0;
90:  }
91:  return !cs[0] && !zero.x;
92:#endif
94:  ;
95:  return 0;
96:}

And the errors generated by clang are:-

conftest.c:74:16: error: variable 'foo' set but not used [-Werror,-Wunused-but-set-variable]
   74 |     const int *foo = &x[0];
      |                ^
conftest.c:79:10: error: variable 'p' set but not used [-Werror,-Wunused-but-set-variable]
   79 |     iptr p = 0;
      |          ^
2 errors generated.

Because the test program is failing, autoconf erroneously assumes that the compiler does not support const.

Solution is to remove AC_C_CONST macro which is no longer needed.

This also needs removing from the git submodule configure.ac files.

Anything else?

This is pretty complicated which is why I've raised a separate issue to cover it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant