Page MenuHome GnuPG

libgcrypt: make check fails on mingw64 build
Closed, ResolvedPublic

Description

Symptom: after a successful make half of the make check testsuites are failing, mainly MPI related:

PASS: version.exe
FAIL: mpitests.exe
PASS: t-sexp.exe
PASS: t-convert.exe
FAIL: t-mpi-bit.exe
FAIL: t-mpi-point.exe
FAIL: curves.exe
PASS: t-lock.exe
FAIL: prime.exe
FAIL: basic.exe
/bin/sh: line 5: 48560 Segmentation fault      GCRYPT_IN_REGRESSION_TEST=1 ${dir}$tst
FAIL: keygen.exe
FAIL: pubkey.exe

libgcrypt: 1.7.6
OS: Windows 10 64-bit
Using the binaries from: MSYS2/MINGW64 build. You can find the build output for 1.7.5 here to see how it has been built.

I have reported the issue as well there for more insights, but so far no reply.

I have tried to debug the reason for failure in mpitest.exe, and was able to figure out the following:

  1. First failure is at test_add which results a SIGSEGV upon calling gcry_mpi_release (result);
  2. If you comment out gcry_mpi_add, no SIGSEGV at gcry_mpi_release (result);
  3. The call to _gcry_mpih_add returns 0, which seems to me odd
  4. The subsequent asm code (in mpih-add1-asm.S) I was not able to debug - lack of knowledge, unfortunately

Details

Event Timeline

Sorry, I can't access the build output (probably JS riddled paged). Please attach the config.log here.
In case you are building _on_ Windows: We do not support this - it may or may not work. All builds need to be done using a cross compiler from a Unix system.

Hi werner, I have just managed to find a solution and its really weird.
I have seen that on this platform, the mpi-asm-defs.h is being linked from the generic folder and not from the AMD64 folder. All other asm files are nicely linked fro the AMD64 folder. Here is the relevant part from the build log:

config.status: linking mpi/amd64/mpih-add1.S to mpi/mpih-add1-asm.S
config.status: linking mpi/amd64/mpih-sub1.S to mpi/mpih-sub1-asm.S
config.status: linking mpi/amd64/mpih-mul1.S to mpi/mpih-mul1-asm.S
config.status: linking mpi/amd64/mpih-mul2.S to mpi/mpih-mul2-asm.S
config.status: linking mpi/amd64/mpih-mul3.S to mpi/mpih-mul3-asm.S
config.status: linking mpi/amd64/mpih-lshift.S to mpi/mpih-lshift-asm.S
config.status: linking mpi/amd64/mpih-rshift.S to mpi/mpih-rshift-asm.S
config.status: linking mpi/generic/mpi-asm-defs.h to mpi/mpi-asm-defs.h
config.status: executing depfiles commands
config.status: executing libtool commands
config.status: executing gcrypt-conf commands

The reason is that the build is using the official source tarball, which surprisingly does not contain the mpi/amd64/mpi-asm-defs.h and hence falls back to the generic folder

If I have copied manually the missing file to the amd64 folder, re-run configure and build the library, ALL make check testsuites are properly running with PASS!

Can you help adding mpi/amd64/mpi-asm-defs.h source file to the official tarball?

werner claimed this task.
werner added a subscriber: jukivili.

Good catch. Only on Windows64 sizeof(int)==sizeof(long) and thus the generic definition does not work.
Fixed in master and 1.7: rC7a339b1fc94cbda738cf7712830e783faa0e325e

While fixing this I also realized that we don't distributed aarch64 and arm asm files. Thus only Git builds take advantage from the speedups. Also fixed. I guess that is a reason to make a new 1.7 release.

Thank you werner for the quick reply!

werner, a quick question: what is the ETA of the new realease? I'm asking to see whether should I apply a temporary patch for the Windows64 build, or rather wait for the new release?