ghaerr / microwindows

The Nano-X Window System
Other
648 stars 91 forks source link

endian.h #74

Closed ghost closed 1 year ago

ghost commented 1 year ago

On macOS, it's <machine/endian.h> but on other platforms it's simply <endian.h>. To cover both of them, please include <sys/types.h> instead.

This is the error message on MSYS2 MINGW64:

In file included from C:/msys64/home/Administrator/microwindows/src/engine/devdraw.c:15:
C:/msys64/home/Administrator/microwindows/src/include/swap.h:30:10: fatal error: 'machine/endian.h' file not found
#include <machine/endian.h>
         ^~~~~~~~~~~~~~~~~~
1 error generated.
make[1]: *** [/home/Administrator/microwindows/src/Makefile.rules:556: /home/Administrator/microwindows/src/obj/engine/devdraw.o] Error 1
make[1]: Leaving directory '/home/Administrator/microwindows/src/mwin'
make: *** [/home/Administrator/microwindows/src/Makefile.rules:481: subdir-/home/Administrator/microwindows/src/mwin] Error 2

This is my proposed solution's source: https://stackoverflow.com/questions/27073837/fatal-error-endian-h-file-not-found

ghaerr commented 1 year ago

Thanks, should be fixed in cb5cc9c42d91bed7fe2f06bbe1fbb09aa7e768d0.

ghost commented 1 year ago

@ghaerr Your library seems to require POSIX. The problem with endian.h was fixed but now it's failed to build on MSYS2 MINGW64 Shell because missing of <sys/mman.h>. This is a POSIX header. MSYS2 MINGW64 Shell targets native Win32 so it doesn't have that header.

C:/msys64/home/Administrator/microwindows/src/engine/devimage.c:28:10: fatal error: 'sys/mman.h' file not found
#include <sys/mman.h>
         ^~~~~~~~~~~~
1 error generated.
ghaerr commented 1 year ago

Your library seems to require POSIX.

Actually it does not, there are however quite a few configuration settings.

Take a look at include/mwconfig.h and edit that file directly. There you can turn off HAVE_MMAP which should fix this problem. There are quite a few other settings as well for which you might determine what to do based on a compilation error.

For Windows ports, the following section is worth looking at:

/* temp settings for Visual Studio 2008 MSC Windows compile*/
#if _MSC_VER == 1500
#define WIN64_PORT      0           /* =1 for compiling on 64-bit Windows*/
#if !WIN64_PORT
#pragma warning( disable: 4311 )    /* Win64 pointer truncation*/
#pragma warning( disable: 4312 )    /* Win64 pointer conversion to greater size*/
#endif
#pragma warning( disable: 4996 )    /* unsafe functions*/
#define inline
#define DEBUG           1       /* =1 for debug output*/
#define NONETWORK       1       /* =1 to link Nano-X apps with server for standalone*/
#define SCREEN_WIDTH    640
#define SCREEN_HEIGHT   480
#define HAVE_MMAP       0       /* =1 has mmap system call*/
#define HAVE_FILEIO     1       /* =1 to include libc stdio and image reading routines*/
#define HAVE_BMP_SUPPORT 1      /* BMP image support*/
#define HAVE_FNT_SUPPORT 1      /* Microwindows FNT font support*/
#define HAVE_PCF_SUPPORT 1      /* PCF font support*/
#endif
ghost commented 1 year ago

Please add MinGW64 support. You only checked for MSVC. The macro to detect MinGW64 is __MINGW32__.