Page MenuHome GnuPG

gpgme: time_t's definition and non generic header (w32)
Closed, ResolvedPublic

Description

I found two problems when I compiled by Visual C++.
Would you fix these?

1.gpgme.h

time_t is defined in time.h. But time_t is used in gpgme.h without time.h.
It may be enough just to include stdio.h or sys/types.h in some systems.
But time.h is needed on Visual C++.

2.Non generic header

There are not unistd.h and sys/time.h in Visual C++.
I think that these should be surrounded with "#ifdef HAVE_*_H" and "#endif".
For example,

#ifdef HAVE_UNISTD_H

include <unistd.h>

#endif

#ifdef HAVE_SYS_TIME_H

include <sys/time.h>

#endif

Details

Version
1.1.2

Event Timeline

iwm set Version to 1.1.2.
iwm added a subscriber: iwm.
werner added a subscriber: werner.

Marcus can you please check whether we should use AC_HEADER_TIME and see what
header to include for time.h. Our requirement for unistd.h is just fine: any
toolkit aiming for at least a bit of POSIX compliance should come with one.

AC_HEADER_TIME is only useful if sys/time.h and time.h shall both be included,
but sys/time.h includes time.h already *and* time.h is not protected against
double inclusion.

GPGME uses timeval, timeval is a POSIX feature and not defined in the C
standard. Thus, including time.h while not including sys/time.h won't do any good.

iwm: Did GPGME compile and run on your platform after making the changes you
propose? I propose that, if you really want to go down that road, you submit a
complete patch after doing a full port that passes "make check", and then we can
look at what changes need to be done to the code base.

Hi iwm,

unfortunately, we can not support your target platform build configuration[1].
GPGME supports building for Windows targets using the MingW32 cross-compilation
infrastructure. I am not sure if that is accessible from the Windows system,
but it might be via Cygwin. Otherwise, there are also live-systems for
GNU/Linux out there, or one can install GNU/Linux on a memory stick or extra
partition.

I will leave this bug report at status "deferred", so that other people can find
it and the enclosed information.

Thank you,
Marcus
[1] g10 Code GmbH does offer support contracts, though, if you really need it.

Oops, I accidentially deleted iwm's message accompanying the attachment when
trying to remove my own duplicate. Sorry for that. Here is his original
message in full, you can also find it at:

https://bugs.g10code.com/gnupg/msg1876

I made Makefile.msc for compiling by MSVC. I referred to gpgme/Makefile.am.
The application worked with a binary made by Makefile.msc.

There is not sys/time.h on MSVC.
But timeval is defined at other file which is not sys/time.h.
timeval is defined at WinSock.h or WinSock2.h on MSVC.

Please run 'nmake /f Makefile.msc' for making libgpgme-11.dll.

Closing the report about porting to a non-supported target.

marcus removed a project: Stalled.