Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile using MSYS2 MinGW 64-bit #489

Closed
lieser opened this issue May 14, 2021 · 2 comments
Closed

Compile using MSYS2 MinGW 64-bit #489

lieser opened this issue May 14, 2021 · 2 comments

Comments

@lieser
Copy link

lieser commented May 14, 2021

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.

@wcawijngaards
Copy link
Member

The libunbound library does not use the functions from libexpat, those are used by the unbound-anchor tool. The fixes you suggest, I made, including the one you note that you did not find; it is the nonblocking socket check crosscompile function. Thanks for the detailed report!

@lieser
Copy link
Author

lieser commented May 18, 2021

Thanks for the quick fix and the explanation about libexpat.
Did a very quick test just now, and can confirm that building works now without any local changes.

jedisct1 added a commit to jedisct1/unbound that referenced this issue May 31, 2021
* nlnet/master:
  - zonemd-check: yesno option, default no, enables the processing   of ZONEMD records for that zone.
  - Merge NLnetLabs#496 from banburybill: Use build system endianness if   available, otherwise try to work it out.
  Use build system endianness if available, otherwise try to work it out.
  - For NLnetLabs#492: Fix font highlighting for the man page on emacs.
  - Fix NLnetLabs#492: module-config respip missing in unbound.conf.5.in man   page. Merges NLnetLabs#494 from he32. Remove comment line (?) from man page.
  Transplant parts of the contributed RPZ documentation.
  - Move the NSEC3 max iterations count in line with the 150 value   used by BIND, Knot and PowerDNS. This sets the default value   for it in the configuration to 150 for all key sizes.
  - Test code has -q option for quiet output.
  - Fix for NLnetLabs#411, NLnetLabs#439, NLnetLabs#469: Reset the DNS message ID when moving queries   between TCP streams. - Refactor for uniform way to produce random DNS message IDs.
  Fix date in changelog.
  - Fix NLnetLabs#489: Compile using MSYS2 MinGW 64-bit.
  - Fix that auth-zone zonefiles use last TTL if no TTL is specified.
  Changelog note for NLnetLabs#487 - Merge PR NLnetLabs#487: ifdef RLIMIT_AS in recently added check.
  ifdef RLIMIT_AS in recently added check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants