Page MenuHome GnuPG

Libgpg-Error compilation fails if grep_options are enabled
Closed, WontfixPublic

Description

OS: Mac
Source version: 1.38/1.37

When we try to build Libgpg-Error with grep_options enabled, the compilation fails with below error

/Library/Developer/CommandLineTools/usr/bin/make all-recursive
Making all in m4
make[2]: Nothing to be done for `all'.
Making all in src
/usr/bin/awk -f ./mkerrnos.awk ./errnos.in >code-to-errno.h
/usr/bin/awk -f ./mkerrcodes1.awk ./errnos.in >mkerrcodes.h
/usr/bin/awk -f ./mkstrtable.awk -v textidx=2 -v nogettext=1 
./err-sources.h.in >err-sources-sym.h
/usr/bin/awk -f ./mkstrtable.awk -v textidx=2 -v nogettext=1 
./err-codes.h.in >err-codes-sym.h
/usr/bin/awk -f ./mkstrtable.awk -v textidx=2 -v nogettext=1 
-v prefix=GPG_ERR -v pkg_namespace=errnos_ 
./errnos.in >errnos-sym.h
clang 
-g -I. -I. -o mkheader ./mkheader.c
clang -DHAVE_CONFIG_H -I. -I.. -fPIC -Wall -Wpointer-arith -MT gen-posix-lock-obj.o -MD -MP -MF .deps/gen-posix-lock-obj.Tpo -c -o gen-posix-lock-obj.o gen-posix-lock-obj.c
cat ./gpg-error.def.in >gpg-error.def.h
echo "/dummy/" > mkw32errmap.map.c
clang -E -P mkerrcodes.h | grep GPG_ERR | 
/usr/bin/awk -f ./mkerrcodes.awk >mkerrcodes.h
clang -E -I. -I.. gpg-error.def.h | 
grep -v '^#' >gpg-error.def
rm mkerrcodes.h
clang 
-I. -I. -o mkerrcodes ./mkerrcodes.c
rm gpg-error.def.h
mv -f .deps/gen-posix-lock-obj.Tpo .deps/gen-posix-lock-obj.Po
/bin/sh ../libtool --tag=CC --mode=link clang -fPIC -Wall -Wpointer-arith -o gen-posix-lock-obj gen-posix-lock-obj.o
In file included from ./mkerrcodes.c:26:
./mkerrcodes.h:9:7: error: expected '}'
{ 7 <U+001B>[1;32;40m<U+001B>[KGPG_ERR<U+001B>[m<U+001B>[KE2BIG, "GPG_ERR" },
^
./mkerrcodes.h:9:3: note: to match this '{'
{ 7 <U+001B>[1;32;40m<U+001B>[KGPG_ERR<U+001B>[m<U+001B>[KE2BIG, "GPG_ERR" },
^
./mkerrcodes.h:10:8: error: expected '}'
{ 13 <U+001B>[1;32;40m<U+001B>[KGPG_ERR_<U+001B>[m<U+001B>[KEACCES, "GPG_ERR_" },
^
./mkerrcodes.h:10:3: note: to match this '{'
{ 13 <U+001B>[1;32;40m<U+001B>[KGPG_ERR_<U+001B>[m<U+001B>[KEACCES, "GPG_ERR_" },
^
./mkerrcodes.h:11:8: error: expected '}'
{ 48 <U+001B>[1;32;40m<U+001B>[KGPG_ERR_<U+001B>[m<U+001B>[KEADDRINUSE, "GPG_ERR_" },
^
./mkerrcodes.h:11:3: note: to match this '{'
{ 48 <U+001B>[1;32;40m<U+001B>[KGPG_ERR_<U+001B>[m<U+001B>[KEADDRINUSE, "GPG_ERR_" },
^
./mkerrcodes.h:12:8: error: expected '}'
{ 49 <U+001B>[1;32;40m<U+001B>[KGPG_ERR_<U+001B>[m<U+001B>[KEADDRNOTAVAIL, "GPG_ERR_" },
^
./mkerrcodes.h:12:3: note: to match this '{'
{ 49 <U+001B>[1;32;40m<U+001B>[KGPG_ERR_<U+001B>[m<U+001B>[KEADDRNOTAVAIL, "GPG_ERR_" },
^
./mkerrcodes.h:13:8: error: expected '}'
{ 47 <U+001B>[1;32;40m<U+001B>[KGPG_ERR_<U+001B>[m<U+001B>[KEAFNOSUPPORT, "GPG_ERR_" },
^
./mkerrcodes.h:13:3: note: to match this '{'
{ 47 <U+001B>[1;32;40m<U+001B>[KGPG_ERR_<U+001B>[m<U+001B>[KEAFNOSUPPORT, "GPG_ERR_" },
^
./mkerrcodes.h:14:8: error: expected '}'
{ 35 <U+001B>[1;32;40m<U+001B>[KGPG_ERR_<U+001B>[m<U+001B>[KEAGAIN, "GPG_ERR_" },
^
./mkerrcodes.h:14:3: note: to match this '{'
{ 35 <U+001B>[1;32;40m<U+001B>[KGPG_ERR_<U+001B>[m<U+001B>[KEAGAIN, "GPG_ERR_" },
^
./mkerrcodes.h:15:8: error: expected '}'
{ 37 <U+001B>[1;32;40m<U+001B>[KGPG_ERR_<U+001B>[m<U+001B>[KEALREADY, "GPG_ERR_" },
^
./mkerrcodes.h:15:3: note: to match this '{'
{ 37 <U+001B>[1;32;40m<U+001B>[KGPG_ERR_<U+001B>[m<U+001B>[KEALREADY, "GPG_ERR_" },
^
./mkerrcodes.h:16:8: error: expected '}'
{ 80 <U+001B>[1;32;40m<U+001B>[KGPG_ERR_<U+001B>[m<U+001B>[KEAUTH, "GPG_ERR_" },
^
./mkerrcodes.h:16:3: note: to match this '{'
{ 80 <U+001B>[1;32;40m<U+001B>[KGPG_ERR_<U+001B>[m<U+001B>[KEAUTH, "GPG_ERR_" },
^
./mkerrcodes.h:17:7: error: expected '}'
{ 9 <U+001B>[1;32;40m<U+001B>[KGPG_ERR_<U+001B>[m<U+001B>[KEBADF, "GPG_ERR_" },
^
./mkerrcodes.h:17:3: note: to match this '{'
{ 9 <U+001B>[1;32;40m<U+001B>[KGPG_ERR_<U+001B>[m<U+001B>[KEBADF, "GPG_ERR_" },
^
./mkerrcodes.h:18:8: error: expected '}'
{ 94 <U+001B>[1;32;40m<U+001B>[KGPG_ERR_<U+001B>[m<U+001B>[KEBADMSG, "GPG_ERR_" },
^
./mkerrcodes.h:18:3: note: to match this '{'
{ 94 <U+001B>[1;32;40m<U+001B>[KGPG_ERR_<U+001B>[m<U+001B>[KEBADMSG, "GPG_ERR_" },
^
./mkerrcodes.h:19:8: error: expected '}'
{ 72 <U+001B>[1;32;40m<U+001B>[KGPG_ERR_<U+001B>[m<U+001B>[KEBADRPC, "GPG_ERR_" },
^
./mkerrcodes.h:19:3: note: to match this '{'
{ 72 <U+001B>[1;32;40m<U+001B>[KGPG_ERR_<U+001B>[m<U+001B>[KEBADRPC, "GPG_ERR_" },
^
./mkerrcodes.h:20:8: error: expected '}'
{ 16 <U+001B>[1;32;40m<U+001B>[KGPG_ERR_<U+001B>[m<U+001B>[KEBUSY, "GPG_ERR_" },
^
./mkerrcodes.h:20:3: note: to match this '{'
{ 16 <U+001B>[1;32;40m<U+001B>[KGPG_ERR_<U+001B>[m<U+001B>[KEBUSY, "GPG_ERR_" },
^
./mkerrcodes.h:21:8: error: expected '}'
{ 89 <U+001B>[1;32;40m<U+001B>[KGPG_ERR_<U+001B>[m<U+001B>[KECANCELED, "GPG_ERR_" },
^
./mkerrcodes.h:21:3: note: to match this '{'
{ 89 <U+001B>[1;32;40m<U+001B>[KGPG_ERR_<U+001B>[m<U+001B>[KECANCELED, "GPG_ERR_" },
^
./mkerrcodes.h:22:8: error: expected '}'
{ 10 <U+001B>[1;32;40m<U+001B>[KGPG_ERR_<U+001B>[m<U+001B>[KECHILD, "GPG_ERR_" },
^
./mkerrcodes.h:22:3: note: to match this '{'
{ 10 <U+001B>[1;32;40m<U+001B>[KGPG_ERR_<U+001B>[m<U+001B>[KECHILD, "GPG_ERR_" },
^
./mkerrcodes.h:23:8: error: expected '}'
{ 53 <U+001B>[1;32;40m<U+001B>[KGPG_ERR_<U+001B>[m<U+001B>[KECONNABORTED, "GPG_ERR_" },
^
./mkerrcodes.h:23:3: note: to match this '{'
{ 53 <U+001B>[1;32;40m<U+001B>[KGPG_ERR_<U+001B>[m<U+001B>[KECONNABORTED, "GPG_ERR_" },
^
./mkerrcodes.h:24:8: error: expected '}'
{ 61 <U+001B>[1;32;40m<U+001B>[KGPG_ERR_<U+001B>[m<U+001B>[KECONNREFUSED, "GPG_ERR_" },
^
./mkerrcodes.h:24:3: note: to match this '{'
{ 61 <U+001B>[1;32;40m<U+001B>[KGPG_ERR_<U+001B>[m<U+001B>[KECONNREFUSED, "GPG_ERR_" },
^
./mkerrcodes.h:25:8: error: expected '}'
{ 54 <U+001B>[1;32;40m<U+001B>[KGPG_ERR_<U+001B>[m<U+001B>[KECONNRESET, "GPG_ERR_" },
^
./mkerrcodes.h:25:3: note: to match this '{'
{ 54 <U+001B>[1;32;40m<U+001B>[KGPG_ERR_<U+001B>[m<U+001B>[KECONNRESET, "GPG_ERR_" },
^
./mkerrcodes.h:26:8: error: expected '}'
{ 11 <U+001B>[1;32;40m<U+001B>[KGPG_ERR_<U+001B>[m<U+001B>[KEDEADLK, "GPG_ERR_" },
^
./mkerrcodes.h:26:3: note: to match this '{'
{ 11 <U+001B>[1;32;40m<U+001B>[KGPG_ERR_<U+001B>[m<U+001B>[KEDEADLK, "GPG_ERR_" },
^
./mkerrcodes.h:27:8: error: expected '}'
{ 39 <U+001B>[1;32;40m<U+001B>[KGPG_ERR_<U+001B>[m<U+001B>[KEDESTADDRREQ, "GPG_ERR_" },
^
./mkerrcodes.h:27:3: note: to match this '{'
{ 39 <U+001B>[1;32;40m<U+001B>[KGPG_ERR_<U+001B>[m<U+001B>[KEDESTADDRREQ, "GPG_ERR_" },
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [mkerrcodes] Error 1
make[2]: *** Waiting for unfinished jobs....
libtool: link: clang -fPIC -Wall -Wpointer-arith -o gen-posix-lock-obj gen-posix-lock-obj.o
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Similar issues reported here: https://github.com/ueno/ruby-gpgme/issues/55#issuecomment-89778468

Details

Version
1.38

Event Timeline

What do you mean by grep_options?

Add this option in bash/zsh before start compiling
export GREP_OPTIONS='--color=always'

This is essentially a customization option to colorify grep search

I don't know about macOS but the commonly used GNU tools state:

GREP_OPTIONS
This  variable specifies default options to be placed in front of any explicit options.  As this causes problems when writing portable scripts, this feature will be removed in a future  release of grep, and grep warns if it is used.  Please use an alias or script instead.

Given this I don't think it makes sense to explicitly clear that envvar; you better do it yourself.

werner claimed this task.
werner added projects: MacOS, toolchain.