Page MenuHome GnuPG

libgpg-error build issue: error: redefinition of 'msgstr'
Closed, InvalidPublic

Description

While check building libgpg-error 1.36 with the patch for gawk 5.0.0 https://dev.gnupg.org/T4459, I ran into another issue:

/usr/bin/clang -DHAVE_CONFIG_H -I. -I..  -DPKGDATADIR=\"/opt/local/share/libgpg-error\" -DLOCALEDIR=\"/opt/local/share/locale\"  -I/opt/local/include  -pipe -Os -arch x86_64 -Wall -Wpointer-arith -MT gpg_error-strsource-sym.o -MD -MP -MF .deps/gpg_error-strsource-sym.Tpo -c -o gpg_error-strsource-sym.o `test -f 'strsource-sym.c' || echo './'`strsource-sym.c
libtool: compile:  /usr/bin/clang -DHAVE_CONFIG_H -I. -I.. -DLOCALEDIR=\"/opt/local/share/locale\" -I/opt/local/include -pipe -Os -arch x86_64 -Wall -Wpointer-arith -MT libgpg_error_la-argparse.lo -MD -MP -MF .deps/libgpg_error_la-argparse.Tpo -c argparse.c  -fno-common -DPIC -o .libs/libgpg_error_la-argparse.o
mv -f .deps/libgpg_error_la-visibility.Tpo .deps/libgpg_error_la-visibility.Plo
/usr/bin/clang -DHAVE_CONFIG_H -I. -I..  -DPKGDATADIR=\"/opt/local/share/libgpg-error\" -DLOCALEDIR=\"/opt/local/share/locale\"  -I/opt/local/include  -pipe -Os -arch x86_64 -Wall -Wpointer-arith -MT gpg_error-strerror-sym.o -MD -MP -MF .deps/gpg_error-strerror-sym.Tpo -c -o gpg_error-strerror-sym.o `test -f 'strerror-sym.c' || echo './'`strerror-sym.c
mv -f .deps/gpg_error-strsource-sym.Tpo .deps/gpg_error-strsource-sym.Po
/usr/bin/clang -DHAVE_CONFIG_H -I. -I..  -DPKGDATADIR=\"/opt/local/share/libgpg-error\" -DLOCALEDIR=\"/opt/local/share/locale\"  -I/opt/local/include  -pipe -Os -arch x86_64 -Wall -Wpointer-arith -MT gpg_error-gpg-error.o -MD -MP -MF .deps/gpg_error-gpg-error.Tpo -c -o gpg_error-gpg-error.o `test -f 'gpg-error.c' || echo './'`gpg-error.c
mv -f .deps/libgpg_error_la-b64dec.Tpo .deps/libgpg_error_la-b64dec.Plo
In file included from strerror-sym.c:30:
./errnos-sym.h:28:19: error: redefinition of 'msgstr'
static const char msgstr[] = 
                  ^
./err-codes-sym.h:27:19: note: previous definition is here
static const char msgstr[] = 
                  ^
In file included from strerror-sym.c:30:
./errnos-sym.h:171:18: error: redefinition of 'msgidx'
static const int msgidx[] =
                 ^
./err-codes-sym.h:433:18: note: previous definition is here
static const int msgidx[] =
                 ^
In file included from strerror-sym.c:30:
./errnos-sym.h:318:1: error: redefinition of 'msgidxof'
msgidxof (int code)
^
./err-codes-sym.h:842:1: note: previous definition is here
msgidxof (int code)
^
strerror-sym.c:45:13: warning: implicit declaration of function 'errnos_msgidxof' is invalid in C99 [-Wimplicit-function-declaration]
      idx = errnos_msgidxof (code);
            ^
Confirm gpg-error-config works... mv -f .deps/libgpg_error_la-b64enc.Tpo .deps/libgpg_error_la-b64enc.Plo
strerror-sym.c:47:9: error: use of undeclared identifier 'errnos_msgstr'; did you mean 'errnos_msgidxof'?
        return errnos_msgstr + errnos_msgidx[idx];
               ^~~~~~~~~~~~~
               errnos_msgidxof
strerror-sym.c:45:13: note: 'errnos_msgidxof' declared here
      idx = errnos_msgidxof (code);
            ^
strerror-sym.c:47:25: error: use of undeclared identifier 'errnos_msgidx'
        return errnos_msgstr + errnos_msgidx[idx];
                               ^
1 warning and 5 errors generated.
make[3]: *** [gpg_error-strerror-sym.o] Error 1

I'm building under macOS 10.13.6 (High Sierra) using MacPorts.

PS: I'm the MacPorts port maintainer for libgpg-error.

Event Timeline

The patch touches src/Makefile.am. You need to run automake to update src/Makefile.in.
In the patch, it uses pkg_namespace variable to have prefix 'errnos_'.

gniibe triaged this task as Normal priority.