compiling libhxcfe for Windows x64

General discussion forum - for all that doesn't fit in any other category.
Post Reply
sockmonkey
Posts: 5
Joined: Fri Mar 12, 2021 2:17 pm

compiling libhxcfe for Windows x64

Post by sockmonkey »

Hi, I'm trying to compile libhxcfe on Windows using mingw64 and am running into a number of problems. Some headers (sysexits.h, for instance) cannot be found in mingw64 -- that particular one is present in msys2, but not in the ming64 build environment, and adding the msys2 include folder gets me pretty far, but then things begin failing a la:

Code: Select all

gcc -o gzlib.o -c ../sources/thirdpartylibs/zlib/gzlib.c -O3 -I../sources/ -I ../../../libhxcadaptor/trunk/sources -Wall -DNO_VIZ
In file included from C:/msys64/usr/include/sys/fcntl.h:3,
                 from C:/msys64/usr/include/fcntl.h:12,
                 from ../sources/thirdpartylibs/zlib/gzguts.h:32,
                 from ../sources/thirdpartylibs/zlib/gzlib.c:6:
C:/msys64/usr/include/sys/_default_fcntl.h:186:8: error: redefinition of 'struct flock'
  186 | struct flock {
      |        ^~~~~
In file included from C:/msys64/usr/include/sys/types.h:224,
                 from C:/msys64/usr/include/stdio.h:61,
                 from ../sources/thirdpartylibs/zlib/gzguts.h:21,
                 from ../sources/thirdpartylibs/zlib/gzlib.c:6:
C:/msys64/usr/include/machine/types.h:46:8: note: originally defined here
   46 | struct flock {
      |        ^~~~~
../sources/thirdpartylibs/zlib/gzlib.c: In function 'gz_open':
../sources/thirdpartylibs/zlib/gzlib.c:244:20: warning: implicit declaration of function '_wopen'; did you mean 'fwopen'? [-Wimplicit-function-declaration]
  244 |         fd == -2 ? _wopen(path, oflag, 0666) :
      |                    ^~~~~~
      |                    fwopen
make: *** [Makefile:748: gzlib.o] Error 1
Which is to say, mingw64 with development tools and a complete dev environment doesn't appear to build the software out of the box. Does anyone have any hints as to what additional steps need to be taken to get the software building?

My goal is just to get a 64-bit dll (ideally with a def file so I can create a MSVC import lib, but I think I can extract a .def file using dumpbin). The supplied libs which I found are 32-bit only, so I am imagining that I need to build this myself. I may be missing some critical package, but AFAICT my toolchain is complete.

Thank you!

sockmonkey
Posts: 5
Joined: Fri Mar 12, 2021 2:17 pm

Re: compiling libhxcfe for Windows x64

Post by sockmonkey »

LOL, OK, it was as easy as copying that single header (sysexits.h) from the msys2 includes directory into mingw64's toolchain includes directory. OK, I'm chastened. Leaving for the next person.

EDIT: For the .dll, I needed to additionally hack on the Makefile a little bit in order to ensure that mingw64 was correctly identified (shell uname doesn't report mingw64, at least not on newer versions -- mine reports 'MINGW64_NT-10.0-19041' for instance). Also the full names of gcc and windres don't work on newer builds. Anyway, got it working.

Post Reply