building libgcrypt with --host x86_64-w64-mingw32

Daniel Kahn Gillmor dkg at fifthhorseman.net
Tue Feb 16 22:08:03 CET 2016


On Tue 2016-02-16 08:42:01 -0500, Werner Koch wrote:
> On Tue, 16 Feb 2016 04:27, dkg at fifthhorseman.net said:
>
>> i'm exploring building gcrypt 1.6.5 using mingw32 on debian, and i find
>
> This is how I build the GnuPG installer for Windows.

Great!  hopefully some of the work i've been doing in debian will be
able to automate parts of this process for you.

>> i can build it OK with i686-w64-mingw32-gcc (./configure --host
>> i686-w64-mingw32), but not with x86_64-w64-mingw32-gcc (./configure
>> --host x86_64-w64-mingw32).  In particular:
>
> I am actually using
>
>   x86_64-w64-mingw32-gcc (GCC) 4.9.1
>
> w/o any problems.  This is not Sid, though.  See also
> gnupg/build-aux/speedo.mk for details.   Note that the Windows code
> should be build with "./autogen.sh --build-w32" (or -w64) because that
> scripts tracks our knowledge of useful options.

hm, my current approach has been to build it with the same refreshed
autoreconf files as the non-windows ports, just to do an out-of-tree
build for each targeted platform.  The specific features that are
disabled or re-pointed to different prefixes during the builds are
selected during compilation in the same way.

 (this would likely be cleaner on debian if these packages were able to
 use pkg-config, but my understanding is that GnuPG and related tools
 are not going to be adopting pkg-config for platforms that support them
 any time soon)

At any rate, i've managed to build a functioning gpgv.exe (and gpg.exe)
using this approach :)

>>  * random/rndhw.c fails to build because it selects 32-bit assembler
>>    because __x86_64__ and __LP64__ are not #define'd
>
> Hmmm.  A mingw regression?

tc () { printf '#if defined(__%s__)\nhas "__%s__"\n#endif\n' "$1" "$1" ; }

for cc in gcc i686-w64-mingw32-gcc x86_64-w64-mingw32-gcc; do
  "$cc" --version | head -n1
  for x in x86_64 LP64; do
     tc "$x" | "$cc" -E - ;
  done | grep '^[^#]'
done

for me produces this on stretch/testing:

gcc (Debian 5.3.1-8) 5.3.1 20160205
has "__x86_64__"
has "__LP64__"
i686-w64-mingw32-gcc (GCC) 5.3.1 20151207
x86_64-w64-mingw32-gcc (GCC) 5.3.1 20151207
has "__x86_64__"


And i'm seeing the same thing on Jessie:

gcc (Debian 4.9.2-10) 4.9.2
has "__x86_64__"
has "__LP64__"
i686-w64-mingw32-gcc (GCC) 4.9.1
x86_64-w64-mingw32-gcc (GCC) 4.9.1
has "__x86_64__"

Are you seeing something different?

    --dkg



More information about the Gcrypt-devel mailing list