error building pinentry 0.9.2 with libsecret

Neal H. Walfield neal at
Wed May 13 21:47:48 CEST 2015

Hi Daniel,

At Wed, 13 May 2015 15:14:26 -0400,
Daniel Kahn Gillmor wrote:
> trying to build pinentry 0.9.2 with libsecret on a debian testing
> system, and i get the following error when linking
> pinentry/pinentry-curses.c:
> gcc  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wall -Wcast-align -Wshadow -Wstrict-prototypes -Wno-pointer-sign  -Wl,-z,relro -Wl,--as-needed -o pinentry-curses pinentry-curses.o -lsecret-1 -lgio-2.0 -lgobject-2.0 -lglib-2.0  ../pinentry/libpinentry.a ../pinentry/libpinentry-curses.a ../assuan/libassuan.a ../secmem/libsecmem.a  -lncursesw  

When I use your link command (replacing ncursesw with ncurses), I see
the same errors.

It appears to be cause by the linker option: --as-needed: removing it
causes it to link again.

The problem is that --as-need works from left to right.  When
libsecret is linked in, nothing has required any symbols from
libsecret.  (Only libpinentry.a needs it.)  Thus, it is deemed
irrelevant and ignored.  The solution is to include all of the .as
before the -ls.

I've just pushed a fix.  Please let me know if it is sufficient.

Thanks for the bug report.

:) Neal

More information about the Gnupg-devel mailing list