scheme.c:875:33: error: expected ‘;’ before ‘abort’
Closed, DuplicatePublic

Description

I'm building GnuPG 2.2.12 from sources. I'm working on Fedora 29, x86_64 (fully patched). The build eventually fails.

gcc -DHAVE_CONFIG_H -I. -I../..  -I../../common -DLOCALEDIR=\"/usr/local/share/locale\" -DGNUPG_BINDIR="\"/usr/local/bin\"" -DGNUPG_LIBEXECDIR="\"/usr/local/libexec\"" -DGNUPG_LIBDIR="\"/usr/local/lib64/gnupg\"" -DGNUPG_DATADIR="\"/usr/local/share/gnupg\"" -DGNUPG_SYSCONFDIR="\"/usr/local/etc/gnupg\"" -DGNUPG_LOCALSTATEDIR="\"/usr/local/var\""       -I/usr/local/include -DNDEBUG -imacros scheme-config.h -I/usr/local/include -I/usr/local/include -I/usr/local/include -Wall -Wno-pointer-sign -Wpointer-arith -g2 -O2 -m64 -march=native -fPIC -MT gpgscm-scheme.o -MD -MP -MF .deps/gpgscm-scheme.Tpo -c -o gpgscm-scheme.o `test -f 'scheme.c' || echo './'`scheme.c
gcc -DHAVE_CONFIG_H -I. -I../..  -I../../common -DLOCALEDIR=\"/usr/local/share/locale\" -DGNUPG_BINDIR="\"/usr/local/bin\"" -DGNUPG_LIBEXECDIR="\"/usr/local/libexec\"" -DGNUPG_LIBDIR="\"/usr/local/lib64/gnupg\"" -DGNUPG_DATADIR="\"/usr/local/share/gnupg\"" -DGNUPG_SYSCONFDIR="\"/usr/local/etc/gnupg\"" -DGNUPG_LOCALSTATEDIR="\"/usr/local/var\""       -I/usr/local/include -DNDEBUG  -Wall -Wno-pointer-sign -Wpointer-arith -g2 -O2 -m64 -march=native -fPIC -MT t-child.o -MD -MP -MF .deps/t-child.Tpo -c -o t-child.o t-child.c
scheme.c: In function ‘gc_reservation_failure’:
scheme.c:875:33: error: expected ‘;’ before ‘abort’
    "insufficient reservation\n")
                                 ^
                                 ;
scheme.c:882:3:
   abort();
   ~~~~~
mv -f .deps/t-child.Tpo .deps/t-child.Po
gcc  -Wall -Wno-pointer-sign -Wpointer-arith -g2 -O2 -m64 -march=native -fPIC  -L/usr/local/lib64 -m64 -Wl,-R,/usr/local/lib64 -Wl,--enable-new-dtags -o t-child t-child.o
scheme.c: In function ‘new_slot_in_env’:
scheme.c:2841:11: warning: variable ‘slot’ set but not used [-Wunused-but-set-variable]
   pointer slot;
           ^~~~
ffi.c: In function ‘ffi_sprintf’:
ffi.c:1284:13: warning: variable ‘written’ set but not used [-Wunused-but-set-variable]
   int size, written;
             ^~~~~~~
ffi.c: In function ‘ffi_scheme_eval’:
ffi.c:1310:13: warning: variable ‘written’ set but not used [-Wunused-but-set-variable]
   int size, written;
             ^~~~~~~
scheme.c: In function ‘scheme_init_custom_alloc’:
scheme.c:5618:7: error: ‘scheme’ {aka ‘struct scheme’} has no member named ‘reserved_lineno’; did you mean ‘reserved_cells’?
   sc->reserved_lineno = 0;
       ^~~~~~~~~~~~~~~
       reserved_cells
scheme.c: In function ‘type_to_string’:
scheme.c:173:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
gmake[3]: *** [Makefile:625: gpgscm-scheme.o] Error 1
gmake[3]: *** Waiting for unfinished jobs....
mv -f .deps/gpgscm-main.Tpo .deps/gpgscm-main.Po
mv -f .deps/gpgscm-ffi.Tpo .deps/gpgscm-ffi.Po
gmake[3]: Leaving directory '/home/build/gnupg-2.2.12/tests/gpgscm'
gmake[2]: *** [Makefile:544: all-recursive] Error 1
gmake[2]: Leaving directory '/home/build/gnupg-2.2.12/tests'
gmake[1]: *** [Makefile:615: all-recursive] Error 1
gmake[1]: Leaving directory '/home/build/gnupg-2.2.12'
gmake: *** [Makefile:535: all] Error 2

Details

Version
2.2.12
JW created this task.Dec 29 2018, 9:50 PM
JW updated the task description. (Show Details)
JW added a comment.Dec 29 2018, 10:24 PM

Here's the patch:

$ cat gnupg.patch
--- tests/gpgscm/scheme.c       2018-12-29 16:14:06.149684202 -0500
+++ /dev/null   2018-12-29 16:13:33.242098576 -0500
@@ -872,7 +872,7 @@
 {
 #ifdef NDEBUG
   fprintf(stderr,
-         "insufficient reservation\n")
+         "insufficient reservation\n");
 #else
   fprintf(stderr,
          "insufficient %s reservation in line %d\n",
@@ -5615,7 +5615,9 @@
   sc->fcells = 0;
   sc->inhibit_gc = GC_ENABLED;
   sc->reserved_cells = 0;
+#ifndef NDEBUG
   sc->reserved_lineno = 0;
+#endif
   sc->no_memory=0;
   sc->inport=sc->NIL;
   sc->outport=sc->NIL;
werner triaged this task as Low priority.Dec 31 2018, 4:58 PM
werner added a subscriber: werner.

Please never ever define NDEBUG. This is a severe misfeature of the assert macro.

Anyway, we will consider your patch.

gniibe added a subscriber: gniibe.Jan 17 2019, 1:15 PM

BTW, did you manually define -DNDEBUG, or what caused -DNDEBUG?