Skip to content

Compile using MSYS2 MinGW 64-bit #489

Description

@lieser

Describe the bug
Compiling unbound using the MinGW 64-bit shell included in MSYS2 does not work.

To reproduce
Steps to reproduce the behavior:

  1. Install MSYS2
  2. Open MinGW 64-bit shell
  3. With pacman install packages base-devel, mingw-w64-x86_64-toolchain, mingw-w64-x86_64-openssl, libexpat-devel mingw-w64-x86_64-expat
    • I know libexpat-devel is not really the correct package. But it silence the configure script complaining about not finding libexpat. And as I am only interested in building the libunbound library which as far as I can tell does not actually use libexpat, it does not seem to cause problems.
  4. ./configure --with-libunbound-only --with-ssl=/mingw64 --with-libexpat=/mingw64
  5. make

make fails, because the configure script failed to detect MinGW. It is therefore trying to build with pthread support, which does not work.

libtool: compile:  gcc -I. -DSRCDIR=. -g -O2 -flto -c util/edns.c -o edns.o >/dev/null 2>&1
util/locks.c: In function 'ub_thread_blocksigs':
util/locks.c:57:2: error: unknown type name 'sigset_t'; did you mean '_sigset_t'?
   57 |  sigset_t sigset;
      |  ^~~~~~~~
      |  _sigset_t
util/locks.c:58:2: warning: implicit declaration of function 'sigfillset' [-Wimplicit-function-declaration]
   58 |  sigfillset(&sigset);
      |  ^~~~~~~~~~
util/locks.c: In function 'ub_thread_sig_unblock':
util/locks.c:82:2: error: unknown type name 'sigset_t'; did you mean '_sigset_t'?
   82 |  sigset_t sigset;
      |  ^~~~~~~~
      |  _sigset_t
util/locks.c:83:2: warning: implicit declaration of function 'sigemptyset' [-Wimplicit-function-declaration]
   83 |  sigemptyset(&sigset);
      |  ^~~~~~~~~~~
util/locks.c:84:2: warning: implicit declaration of function 'sigaddset' [-Wimplicit-function-declaration]
   84 |  sigaddset(&sigset, sig);
      |  ^~~~~~~~~
make: *** [Makefile:308: locks.lo] Error 1

Expected behavior
The configure script should correctly detect also the 64-bit version of the MinGW shell.

System:

  • Unbound version: release-1.13.1 tag / master branch
  • OS: Windows

Additional information

The problem is that the check for MinGW is only looking for the string MINGW32:

unbound/configure

Lines 4206 to 4211 in 9aa072d

# are we on MinGW?
if uname -s 2>&1 | grep MINGW32 >/dev/null; then on_mingw="yes"
else
if echo $host $target | grep mingw32 >/dev/null; then on_mingw="yes"
else on_mingw="no"; fi
fi

unbound/configure.ac

Lines 149 to 154 in 9aa072d

# are we on MinGW?
if uname -s 2>&1 | grep MINGW32 >/dev/null; then on_mingw="yes"
else
if echo $host $target | grep mingw32 >/dev/null; then on_mingw="yes"
else on_mingw="no"; fi
fi

MinGW 32-bit shell:

$ uname -s
MINGW32_NT-10.0-19041

MinGW 64-bit shell:

$ uname -s
MINGW64_NT-10.0-19041

I locally changed the uname check to look for MINGW. Afterwards configure/make seem to work correctly (produces a dll that looks fine then viewed with objdump, but did not yet have time to actually test the dll).

Note that there exist another check that is searching for the string mingw32:

unbound/configure

Lines 15930 to 15931 in 9aa072d

if echo $target | grep mingw32 >/dev/null; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no (windows)" >&5

I did not find this check in configure.ac, and also did not change it for my test.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions