Page MenuHome GnuPG

Build problem due to lock header on Windows
Closed, ResolvedPublic

Description

Before: i assigned bug in libgpg-error to libgcrypt because I not found appropriate
category in list.

Abort() is executed in libgpg-error (1.15) i think in comparison

if (sizeof (gpgrt_lock_t) < sizeof (_gpgrt_lock_t))

abort ();

Env: x86_64 build under msys2.
To check is that expression is executed i added code to configure.ac (attached).
Also i have not good stack trace, but can provide next:
http://dump.bitcheese.net/images/ywemece/fail.png

Details

Version
1.15

Event Timeline

I guess that problem because gpgrt_lock_t is generates using gen-posix, but
used win32 lock objects (critical sections). I tried to patch generation
using gen-w32 and looks like that generator is unfinished just now. i made
ugly "fix" which will generate gpgrt_lock_t like in posix. patch in attach.
But i worried that alignment should be rechecked and initialization with
GPGRT_LOCK_INITIALIZER

Sorry, cross-compiling from Windows to Windows is not supported. You need a
POSIX platform and mingw to build for Windows.
Changing this is probably possible but I do not have the time to care about this.

As a starting point, look at src/mkheader.c .

I will add a category for libgpg-error

Werner, we (I'm and Alexpux) was made fix for windows build (x86_64 and i686)
and seems like it works. Patches in attachment. If you want to look at msys2's
libgpg-error package you may use this link https://github.com/Alexpux/MINGW-
packages/tree/master/mingw-w64-libgpg-error

This is additional patch for previous message, you'r tracker not allow to
attach more than one file.

Can you please paste the generated file?

werner renamed this task from abort() on application exit to Build problem due to lock header on Windows.Oct 2 2014, 7:34 PM

yes, i can. this is a gpg-error.h for x86_64 build.

werner added a project: Restricted Project.

The generated header file is, as expected, identical to the one we use
when cross-compling (modulo that we put both versions into one file).
Thus I came up with a simpler solution (see below). I'll commit it soon and a
release will also follow today.

+force_use_syscfg=no
if test "$have_w32_system" = yes; then

AC_DEFINE(HAVE_W32_SYSTEM,1,[Defined if we run on a W32 API based system])
if test "$have_w64_system" = yes; then

@@ -461,11 +462,17 @@ if test "$have_w32_system" = yes; then

  AC_DEFINE(HAVE_W32CE_SYSTEM,1,[Defined if we run on WindowsCE])
  GPG_ERROR_CONFIG_ISUBDIRAFTER="gpg-extra"
fi

+ force_use_syscfg=yes
fi
+if test x$cross_compiling = xyes; then
+ force_use_syscfg=yes
+fi
+
AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
AM_CONDITIONAL(HAVE_W64_SYSTEM, test "$have_w64_system" = yes)
AM_CONDITIONAL(HAVE_W32CE_SYSTEM, test "$have_w32ce_system" = yes)
AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
+AM_CONDITIONAL(FORCE_USE_SYSCFG, test x$force_use_syscfg = xyes)

AC_DEFINE_UNQUOTED(HOST_TRIPLET_STRING, "$host", [The host triplet])

Modified src/Makefile.am
diff --git a/src/Makefile.am b/src/Makefile.am
index 65f8513..efc5970 100644

  • a/src/Makefile.am

+++ b/src/Makefile.am
@@ -262,9 +262,9 @@ parts_of_gpg_error_h = \

 	w32ce-add.h      	\
 	$(lock_obj_pub)
  • If we are cross-compiling we better make sure that no stale native
  • lock include file will be found by mkheader.

-if CROSS_COMPILING
+# If we are cross-compiling or building on Windows we better make sure
+# that no stale native lock include file will be found by mkheader.
+if FORCE_USE_SYSCFG
pre_mkheader_cmds = -rm lock-obj-pub.native.h 2>/dev/null

werner claimed this task.
werner removed a project: Restricted Project.