creationix / dukluv

LibUV bindings for duktape JS engine
http://dukluv.io
MIT License
266 stars 36 forks source link

Cross compiling to windows using mingw fails #25

Closed avih closed 8 years ago

avih commented 8 years ago

I found some issues when cross compiling for windows on linux using MINGW (specifically, using MXE):

  1. At duv.h some of the S_ISDIR, S_ISREG etc are already defined in MINGW, so probably best to define each of those only if it's not defined already.
  2. At uv.cmake, there's Userenv.lib. While this is the correct windows name, MINGW has a convention to use lower-case only file names and so on linux it fails to find it. I suggest to change that to userenv.lib. This will work on linux, and on windows it won't matter since on windows the names are case-insensitive.
  3. At miniz.c there are some functions which are static __forceinline, which is apparently bad in MINGW since it defines forceinline to also be extern. This is the same as this: https://github.com/nothings/stb/issues/116 and apparently for now it's not being fixed in upstream MINGW.

Since miniz.c is not an upstream git repo, this seems to solve it. At line 888 add these (undefine forceinline on anything windows. Regardless, I think the compiler should be able to decide itself what to inline):

#else
  #define __forceinline
avih commented 8 years ago

Fixed by f02103bcadd5a5b9280b7a07064649d0a465f70c .