threerings / openvpn-auth-ldap

Implements username/password authentication via LDAP for OpenVPN 2.x.
Other
135 stars 62 forks source link

Build fails on Ubuntu 24.04 #93

Open m4caque opened 3 weeks ago

m4caque commented 3 weeks ago

Building latest source fails on Ubuntu with errors:

TRObject.m:51:1: warning: class ‘TRObject’ defined without specifying a base class [-Wobjc-root-class]
   51 | + (id) alloc {
      | ^
TRObject.m: In function ‘-[TRObject isKindOfClass:]’:
TRObject.m:106:5: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
  106 |     for (Class superClass = selfClass; superClass != NULL; superClass = class_getSuperclass(superClass)) {
      |     ^~~
TRObject.m:106:5: note: use option ‘-std=c99’, ‘-std=gnu99’, ‘-std=c11’ or ‘-std=gnu11’ to compile your code
make[1]: *** [../Mk/compile.mk:6: TRObject.o] Error 1

And later in the build:

PXTestCaseRunner.m: In function ‘-[PXTestCaseRunner runAllCases]’:
PXTestCaseRunner.m:82:5: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
   82 |     for (int i = 0; i < numClasses; i++) {
      |     ^~~
PXTestCaseRunner.m:82:5: note: use option ‘-std=c99’, ‘-std=gnu99’, ‘-std=c11’ or ‘-std=gnu11’ to compile your code
PXTestCaseRunner.m: In function ‘-[PXTestCaseRunner runCase:]’:
PXTestCaseRunner.m:132:5: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
  132 |     for (unsigned int i = 0; i < methodCount; i++) {
      |     ^~~
make[1]: *** [../Mk/compile.mk:6: PXTestCaseRunner.o] Error 1

Appending the flag "-std=gnu99" to OBJCFLAGS in both src/Makefile and tests/Makefile allows the build to finish successfully, e.g.: OBJCFLAGS+= $(LDAP_CFLAGS) $(OPENVPN_CFLAGS) -std=gnu99