Mailing List Archive

[patch] Don't add PTH include path to gpgme's CFLAGS globally
In FreeBSD 6 and later, sys/types.h now also defines the basic pthread types
in order to
comply with IEEE Std 1003.1-2004.

This causes a compile error in gpgme due to conflicting types for pthread_* if
pth-support is enabled, since the pth include directory is globally added to
CFLAGS and ath-pthread.c picks up the pth-supplied pthread.h header instead
of the system include.

The attached patch changes gpgme's global configure template and the Makefile
template in gpgme/gpgme so that PTH_CFLAGS are only added to the include path
where needed. The patch should apply to both the latest gpgme in CVS and gpgme
1.0.x.

Cheers,
--
,_, | Michael Nottebrock | lofi@freebsd.org
(/^ ^\) | FreeBSD - The Power to Serve | http://www.freebsd.org
\u/ | K Desktop Environment on FreeBSD | http://freebsd.kde.org
Re: [patch] Don't add PTH include path to gpgme's CFLAGS globally [ In reply to ]
Hi,

thanks for your report.

At Mon, 8 Aug 2005 19:54:11 +0200,
Michael Nottebrock <lofi@freebsd.org> wrote:
> This causes a compile error in gpgme due to conflicting types for pthread_* if
> pth-support is enabled, since the pth include directory is globally added to
> CFLAGS and ath-pthread.c picks up the pth-supplied pthread.h header instead
> of the system include.

Can you give more details about the compile error, just to know what
the actual problem is? (Reports should always include such
information).

> The attached patch changes gpgme's global configure template and the Makefile
> template in gpgme/gpgme so that PTH_CFLAGS are only added to the include path
> where needed. The patch should apply to both the latest gpgme in CVS and gpgme
> 1.0.x.

Does the patch work? From your interpretation of the problem, a
compile error should occur in ath-pthread-compat.c, because it will
pick up the pth supplied header file rather than the system header
file.

It seems to me that the pth include directory should only be added to
the ath-pth.c and ath-pth-compat.c compilation.

Also, $(AM_CFLAGS) should be used instead of ${CFLAGS}, but that is a
minor detail.

Thanks,
Marcus


>
> Cheers,
> --
> ,_, | Michael Nottebrock | lofi@freebsd.org
> (/^ ^\) | FreeBSD - The Power to Serve | http://www.freebsd.org
> \u/ | K Desktop Environment on FreeBSD | http://freebsd.kde.org
> [2 gpgme-pth-cflags.diff <text/plain; us-ascii (7bit)>]
> Index: configure.ac
> ===================================================================
> RCS file: /cvs/gnupg/gpgme/configure.ac,v
> retrieving revision 1.98
> diff -u -r1.98 configure.ac
> --- configure.ac 24 Mar 2005 13:09:54 -0000 1.98
> +++ configure.ac 8 Aug 2005 14:37:09 -0000
> @@ -120,7 +120,6 @@
> AC_CHECK_PTH(1.2.0,,,no,have_pth=yes)
> if test "$have_pth" = yes; then
> AC_DEFINE(HAVE_PTH, ,[Define if we have Pth.])
> - CFLAGS="$CFLAGS $PTH_CFLAGS"
> fi
> AC_CHECK_LIB(pthread,pthread_create,have_pthread=yes)
> if test "$have_pthread" = yes; then
> Index: gpgme/Makefile.am
> ===================================================================
> RCS file: /cvs/gnupg/gpgme/gpgme/Makefile.am,v
> retrieving revision 1.56
> diff -u -r1.56 Makefile.am
> --- gpgme/Makefile.am 24 Mar 2005 13:05:12 -0000 1.56
> +++ gpgme/Makefile.am 8 Aug 2005 14:37:10 -0000
> @@ -99,6 +99,7 @@
>
> AM_CPPFLAGS = $(assuan_cppflags) @GPG_ERROR_CFLAGS@
>
> +libgpgme_la_CFLAGS= ${CFLAGS} @PTH_CFLAGS@
> libgpgme_la_LDFLAGS = $(libgpgme_version_script_cmd) -version-info \
> @LIBGPGME_LT_CURRENT@:@LIBGPGME_LT_REVISION@:@LIBGPGME_LT_AGE@
> libgpgme_la_DEPENDENCIES = libgpgme-real.la $(assuan_libobjs) \
> @@ -113,6 +114,7 @@
> libgpgme_pthread_la_LIBADD = libgpgme-real.la $(assuan_libobjs) @LTLIBOBJS@ \
> -lpthread @GPG_ERROR_LIBS@
>
> +libgpgme_pth_la_CFLAGS = ${CFLAGS} @PTH_CFLAGS@
> libgpgme_pth_la_CPPFLAGS = $(AM_CPPFLAGS) @PTH_CPPFLAGS@
> libgpgme_pth_la_LDFLAGS = @PTH_LDFLAGS@ \
> $(libgpgme_version_script_cmd) -version-info \
> [3 <text/plain; us-ascii (7bit)>]
> _______________________________________________
> Gpa-dev mailing list
> Gpa-dev@gnupg.org
> http://lists.gnupg.org/mailman/listinfo/gpa-dev
Re: [patch] Don't add PTH include path to gpgme's CFLAGS globally [ In reply to ]
On Monday, 29. August 2005 14:02, Marcus Brinkmann wrote:
> Hi,
>
> thanks for your report.
>
> At Mon, 8 Aug 2005 19:54:11 +0200,
>
> Michael Nottebrock <lofi@freebsd.org> wrote:
> > This causes a compile error in gpgme due to conflicting types for
> > pthread_* if pth-support is enabled, since the pth include directory is
> > globally added to CFLAGS and ath-pthread.c picks up the pth-supplied
> > pthread.h header instead of the system include.
>
> Can you give more details about the compile error, just to know what
> the actual problem is? (Reports should always include such
> information).

 cc -DHAVE_CONFIG_H -I. -I. -I.. -I../assuan -I/usr/local/include -O2 -pipe
-march=athlon-xp -I/usr/local/include/pth -Wall -Wcast-align -Wshadow
-Wstrict-prototypes -MT ath-pthread.lo -MD -MP -MF .deps/ath-pthread.Tpo -c
ath-pthread.c  -fPIC -DPIC -o .libs/ath-pthread.o
In file included from ath-pthread.c:36:
/usr/local/include/pth/pthread.h:285: error: conflicting types for 'pthread_t'
/usr/include/sys/_pthreadtypes.h:64: error: previous declaration of
'pthread_t' was here
/usr/local/include/pth/pthread.h:286: error: conflicting types for
'pthread_attr_t'
/usr/include/sys/_pthreadtypes.h:65: error: previous declaration of
'pthread_attr_t' was here
/usr/local/include/pth/pthread.h:288: error: conflicting types for
'pthread_once_t'
/usr/include/sys/_pthreadtypes.h:71: error: previous declaration of
'pthread_once_t' was here
/usr/local/include/pth/pthread.h:289: error: conflicting types for
'pthread_mutexattr_t'
/usr/include/sys/_pthreadtypes.h:67: error: previous declaration of
'pthread_mutexattr_t' was here
/usr/local/include/pth/pthread.h:290: error: conflicting types for
'pthread_mutex_t'
/usr/include/sys/_pthreadtypes.h:66: error: previous declaration of
'pthread_mutex_t' was here
/usr/local/include/pth/pthread.h:291: error: conflicting types for
'pthread_condattr_t'
/usr/include/sys/_pthreadtypes.h:69: error: previous declaration of
'pthread_condattr_t' was here
/usr/local/include/pth/pthread.h:292: error: conflicting types for
'pthread_cond_t'
/usr/include/sys/_pthreadtypes.h:68: error: previous declaration of
'pthread_cond_t' was here
/usr/local/include/pth/pthread.h:293: error: conflicting types for
'pthread_rwlockattr_t'
/usr/include/sys/_pthreadtypes.h:73: error: previous declaration of
'pthread_rwlockattr_t' was here
/usr/local/include/pth/pthread.h:294: error: conflicting types for
'pthread_rwlock_t'
/usr/include/sys/_pthreadtypes.h:72: error: previous declaration of
'pthread_rwlock_t' was here
ath-pthread.c: In function `_gpgme_ath_connect':
ath-pthread.c:161: warning: passing arg 2 of `__pthread_connect' discards
qualifiers from pointer target type

> > The attached patch changes gpgme's global configure template and the
> > Makefile template in gpgme/gpgme so that PTH_CFLAGS are only added to the
> > include path where needed. The patch should apply to both the latest
> > gpgme in CVS and gpgme 1.0.x.
>
> Does the patch work?
> From your interpretation of the problem, a
> compile error should occur in ath-pthread-compat.c, because it will
> pick up the pth supplied header file rather than the system header
> file.

It's been a while - I tend to agree that ath-pthread-compat.c should fail as
well, but for some reason it apparently doesn't.

Then again, I didn't (and still don't) have access to a FreeBSD 6 system
myself, but the the patches to gpgme/Makefile.in of the 1.0.2 distribution
tarball which I produced with the patch against CVS I were confirmed to be
working by the person who reported the error to me. Fun.

> It seems to me that the pth include directory should only be added to
> the ath-pth.c and ath-pth-compat.c compilation.

Yes, that would probably be best.

--
,_, | Michael Nottebrock | lofi@freebsd.org
(/^ ^\) | FreeBSD - The Power to Serve | http://www.freebsd.org
\u/ | K Desktop Environment on FreeBSD | http://freebsd.kde.org
Re: [patch] Don't add PTH include path to gpgme's CFLAGS globally [ In reply to ]
At Mon, 29 Aug 2005 20:49:54 +0200,
Michael Nottebrock <lofi@freebsd.org> wrote:
> > > The attached patch changes gpgme's global configure template and the
> > > Makefile template in gpgme/gpgme so that PTH_CFLAGS are only added to the
> > > include path where needed. The patch should apply to both the latest
> > > gpgme in CVS and gpgme 1.0.x.
> >
> > Does the patch work?
> > From your interpretation of the problem, a
> > compile error should occur in ath-pthread-compat.c, because it will
> > pick up the pth supplied header file rather than the system header
> > file.
>
> It's been a while - I tend to agree that ath-pthread-compat.c should fail as
> well, but for some reason it apparently doesn't.

Yeah, ok :)

I have now killed the whole ath*-compat.c stuff, which was deprecated
since version 0.4.3 anyway, and put the PTH CFLAGS for the pth version
of the library only. This should fix the problem once and for all.
Let me know if there are still any glitches with it.

Thanks,
Marcus