Page MenuHome GnuPG

gpgme 1.8 build failure: strdup undeclared on MacOSX Sierra
Closed, ResolvedPublic

Description

Copying this issue from the ML so it doesn't get lost.

Build environment: macOS Sierra, XCode 8.1.

quorra:gpgme-1.8.0 rjh$ make
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-recursive
Making all in src
make[2]: Nothing to be done for `all'.
Making all in tests
Making all in gpg
make[3]: Nothing to be done for `all'.
Making all in gpgsm
make[3]: Nothing to be done for `all'.
Making all in opassuan
make[3]: Nothing to be done for `all'.
make[3]: Nothing to be done for `all-am'.
Making all in doc
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-am
make[3]: Nothing to be done for `all-am'.
Making all in lang
Making all in cl
make[3]: Nothing to be done for `all'.
Making all in cpp
Making all in src
/bin/sh ../../../libtool --tag=CXX --mode=compile g++ -std=c++11
-DHAVE_CONFIG_H -I. -I../../.. -I../../../src -I/usr/local/include
-I/usr/local/include -DBUILDING_GPGMEPP -g -O2 -MT
keygenerationresult.lo -MD -MP -MF .deps/keygenerationresult.Tpo -c -o
keygenerationresult.lo keygenerationresult.cpp
libtool: compile: g++ -std=c++11 -DHAVE_CONFIG_H -I. -I../../..
-I../../../src -I/usr/local/include -I/usr/local/include
-DBUILDING_GPGMEPP -g -O2 -MT keygenerationresult.lo -MD -MP -MF
.deps/keygenerationresult.Tpo -c keygenerationresult.cpp -fno-common
-DPIC -o .libs/keygenerationresult.o
keygenerationresult.cpp:43:23: error: use of undeclared identifier 'strdup'

res.fpr = strdup(res.fpr);
          ^

1 error generated.

Details

Version
1.8.0

Event Timeline

neal set Version to 1.8.0.
neal added subscribers: neal, rjh.

We don't see that on our Sierra box.

We configure the build with -D_DARWIN_C_SOURCE=900000L on our macOs box. Not
sure if this is the proper thing to do, and/or if we should just always set that
when we build on Darwin in configure.

FWIW: In GnuPG we have for example this in the configure script

*-*-hpux*)
    if test -z "$GCC" ; then
        CFLAGS="-Ae -D_HPUX_SOURCE $CFLAGS"
    fi

IF it makes things easier we may add a simlar case for macOS. But we need to do
this for many packages, I think.

I addressed this for GPGME in 60273e8b2c11d42215a5707bc55e3e0d8f350e07 but
apparently forgot to mention that here.

I'll keep the bug open until I fixed this in all packages.