Skip to content

Compiler errors, no executeable on windows #25

@thegame4craft

Description

@thegame4craft

I cloned the repo today and started compiling on windows. i use MSYS2-MinGW64 and followed the instructions in the readme. but i get some syntax errors.
The full log

mkdir -p bin
gcc -o emu/libemu.o -c emu/libemu.c -std=c11 -O0 -g -Wall -Wextra -Wpedantic -Wstrict-aliasing -IC:/Users/Robin/AppData/Local/MSYS2/mingw64/include/ -IC:/Users/Robin/AppData/Local/MSYS2/usr/lib/ -v -Wno-pointer-arith -Wno-unused-parameter
Using built-in specs.
COLLECT_GCC=gcc
Target: x86_64-pc-msys
Configured with: /c/_/S/gcc/src/gcc-10.2.0/configure --build=x86_64-pc-msys --prefix=/usr --libexecdir=/usr/lib --enable-bootstrap --enable-shared --enable-shared-libgcc --enable-static --enable-version-specific-runtime-libs --with-arch=x86-64 --with-tune=generic --disable-multilib --enable-__cxa_atexit --with-dwarf2 --enable-languages=c,c++,fortran,lto --enable-graphite --enable-threads=posix --enable-libatomic --enable-libgomp --disable-libitm --enable-libquadmath --enable-libquadmath-support --disable-libssp --disable-win32-registry --disable-symvers --with-gnu-ld --with-gnu-as --disable-isl-version-check --enable-checking=release --without-libiconv-prefix --without-libintl-prefix --with-system-zlib --enable-linker-build-id --with-default-libstdcxx-abi=gcc4-compatible --enable-libstdcxx-filesystem-ts
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.2.0 (GCC)
COLLECT_GCC_OPTIONS='-o' 'emu/libemu.o' '-c' '-std=c11' '-O0' '-g' '-Wall' '-Wextra' '-Wpedantic' '-Wstrict-aliasing' '-I' 'C:/Users/Robin/AppData/Local/MSYS2/mingw64/include/' '-I' 'C:/Users/Robin/AppData/Local/MSYS2/usr/lib/' '-v' '-Wno-pointer-arith' '-Wno-unused-parameter' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-pc-msys/10.2.0/cc1.exe -quiet -v -I C:/Users/Robin/AppData/Local/MSYS2/mingw64/include/ -I C:/Users/Robin/AppData/Local/MSYS2/usr/lib/ -idirafter /usr/lib/gcc/x86_64-pc-msys/10.2.0/../../../../lib/../include/w32api -idirafter /usr/lib/gcc/x86_64-pc-msys/10.2.0/../../../../x86_64-pc-msys/lib/../lib/../../include/w32api emu/libemu.c -quiet -dumpbase libemu.c -mtune=generic -march=x86-64 -auxbase-strip emu/libemu.o -g -O0 -Wall -Wextra -Wpedantic -Wstrict-aliasing -Wno-pointer-arith -Wno-unused-parameter -std=c11 -version -o /tmp/ccTKThYJ.s
GNU C11 (GCC) version 10.2.0 (x86_64-pc-msys)
        compiled by GNU C version 10.2.0, GMP version 6.2.0, MPFR version 4.1.0, MPC version 1.1.0, isl version isl-0.22.1-GMP

warning: GMP header version 6.2.0 differs from library version 6.2.1.
warning: MPC header version 1.1.0 differs from library version 1.2.1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-msys/10.2.0/../../../../x86_64-pc-msys/include"
ignoring duplicate directory "/usr/lib/gcc/x86_64-pc-msys/10.2.0/../../../../x86_64-pc-msys/lib/../lib/../../include/w32api"
#include "..." search starts here:
#include <...> search starts here:
 C:/Users/Robin/AppData/Local/MSYS2/mingw64/include/
 C:/Users/Robin/AppData/Local/MSYS2/usr/lib/
 /usr/lib/gcc/x86_64-pc-msys/10.2.0/include
 /usr/lib/gcc/x86_64-pc-msys/10.2.0/include-fixed
 /usr/include
 /usr/lib/gcc/x86_64-pc-msys/10.2.0/../../../../lib/../include/w32api
End of search list.
GNU C11 (GCC) version 10.2.0 (x86_64-pc-msys)
        compiled by GNU C version 10.2.0, GMP version 6.2.0, MPFR version 4.1.0, MPC version 1.1.0, isl version isl-0.22.1-GMP

warning: GMP header version 6.2.0 differs from library version 6.2.1.
warning: MPC header version 1.1.0 differs from library version 1.2.1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 5dc831ba8ba50cc9f8b7e3207bc4f700
In file included from emu/../common/util.h:6,
                 from emu/emu.h:4,
                 from emu/libemu.c:3:
emu/../common/util.h: In function ‘strlstrip’:
emu/../common/util.h:88:20: warning: array subscript has type ‘char’ [-Wchar-subscripts]
   88 |     while (isspace(*str)) memmove(str, str + 1, --len);
      |                    ^~~~
emu/../common/util.h: In function ‘strrstrip’:
emu/../common/util.h:95:23: warning: array subscript has type ‘char’ [-Wchar-subscripts]
   95 |     while (isspace(str[len - 1])) str[--len] = '\0';
      |                    ~~~^~~~~~~~~
In file included from emu/emu.h:4,
                 from emu/libemu.c:3:
emu/../common/util.h: In function ‘strtou32’:
emu/../common/util.h:134:22: warning: comparison of unsigned expression in ‘>= 0’ is always true [-Wtype-limits]
  134 |         } else if (r >= (_min) && r <= (_max)) {                    \
      |                      ^~
emu/../common/util.h:142:1: note: in expansion of macro ‘_DECL_STRTOX’
  142 | _DECL_STRTOX(u, u32, u32, 0, UINT_MAX)
      | ^~~~~~~~~~~~
emu/../common/util.h: In function ‘strtou16’:
emu/../common/util.h:134:22: warning: comparison of unsigned expression in ‘>= 0’ is always true [-Wtype-limits]
  134 |         } else if (r >= (_min) && r <= (_max)) {                    \
      |                      ^~
emu/../common/util.h:144:1: note: in expansion of macro ‘_DECL_STRTOX’
  144 | _DECL_STRTOX(u, u16, u16, 0, USHRT_MAX)
      | ^~~~~~~~~~~~
emu/../common/util.h: In function ‘strtou8’:
emu/../common/util.h:134:22: warning: comparison of unsigned expression in ‘>= 0’ is always true [-Wtype-limits]
  134 |         } else if (r >= (_min) && r <= (_max)) {                    \
      |                      ^~
emu/../common/util.h:146:1: note: in expansion of macro ‘_DECL_STRTOX’
  146 | _DECL_STRTOX(u, u8, u8, 0, INT_MAX)
      | ^~~~~~~~~~~~
emu/libemu.c: In function ‘simulate’:
emu/libemu.c:10:21: error: ‘_CLOCK_MONOTONIC_RAW’ undeclared (first use in this function); did you mean ‘CLOCK_MONOTONIC’?
   10 |  #define MONO_CLOCK _CLOCK_MONOTONIC_RAW
      |                     ^~~~~~~~~~~~~~~~~~~~
emu/../common/util.h:175:31: note: in definition of macro ‘assert’
  175 | #define assert(_e) ( _assert((_e), false, __FILE__, __LINE__))
      |                               ^~
emu/libemu.c:15:31: note: in expansion of macro ‘MONO_CLOCK’
   15 |         assert(!clock_gettime(MONO_CLOCK, &ts));            \
      |                               ^~~~~~~~~~
emu/libemu.c:45:17: note: in expansion of macro ‘NOW’
   45 |     u64 start = NOW(),
      |                 ^~~
emu/libemu.c:10:21: note: each undeclared identifier is reported only once for each function it appears in
   10 |  #define MONO_CLOCK _CLOCK_MONOTONIC_RAW
      |                     ^~~~~~~~~~~~~~~~~~~~
emu/../common/util.h:175:31: note: in definition of macro ‘assert’
  175 | #define assert(_e) ( _assert((_e), false, __FILE__, __LINE__))
      |                               ^~
emu/libemu.c:15:31: note: in expansion of macro ‘MONO_CLOCK’
   15 |         assert(!clock_gettime(MONO_CLOCK, &ts));            \
      |                               ^~~~~~~~~~
emu/libemu.c:45:17: note: in expansion of macro ‘NOW’
   45 |     u64 start = NOW(),
      |                 ^~~
emu/libemu.c:26:43: warning: statement with no effect [-Wunused-value]
   26 |             ((rem.tv_sec * NS_PER_SECOND) + rem.tv_nsec);   \
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
emu/libemu.c:86:9: note: in expansion of macro ‘SLEEP’
   86 |         SLEEP(sleep_time);
      |         ^~~~~
emu/libemu.c:27:18: warning: statement with no effect [-Wunused-value]
   27 |         } else { 0; }                                       \
      |                  ^
emu/libemu.c:86:9: note: in expansion of macro ‘SLEEP’
   86 |         SLEEP(sleep_time);
      |         ^~~~~
emu/libemu.c: In function ‘pop16’:
emu/libemu.c:203:29: warning: operation on ‘state->special.<U43b0>.pc’ may be undefined [-Wsequence-point]
  203 |         (((u16) peek(state, ++state->special.pc)) << 0) |
      |                             ^~~~~~~~~~~~~~~~~~~
emu/libemu.c: In function ‘step’:
emu/libemu.c:320:42: warning: operation on ‘state->special.<U43b0>.pc’ may be undefined [-Wsequence-point]
  320 |     (((u16) peek(state, state->special.pc++)) << 8))\
      |                         ~~~~~~~~~~~~~~~~~^~
emu/libemu.c:329:51: note: in expansion of macro ‘IMM16’
  329 |                 pc0 & 0x8 ? state->registers.hl : IMM16()
      |                                                   ^~~~~
emu/libemu.c:320:42: warning: operation on ‘state->special.<U43b0>.pc’ may be undefined [-Wsequence-point]
  320 |     (((u16) peek(state, state->special.pc++)) << 8))\
      |                         ~~~~~~~~~~~~~~~~~^~
emu/libemu.c:335:51: note: in expansion of macro ‘IMM16’
  335 |                 pc0 & 0x8 ? state->registers.hl : IMM16(),
      |                                                   ^~~~~
emu/libemu.c:319:41: warning: operation on ‘state->special.<U43b0>.pc’ may be undefined [-Wsequence-point]
  319 |     ((u16) peek(state, state->special.pc++)) |      \
      |                        ~~~~~~~~~~~~~~~~~^~
emu/libemu.c:346:18: note: in expansion of macro ‘IMM16’
  346 |             hl = IMM16();
      |                  ^~~~~
emu/libemu.c:377:23: warning: this statement may fall through [-Wimplicit-fallthrough=]
  377 |                     r += !!(state->registers.f & (1 << F_CARRY));
      |                     ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
emu/libemu.c:378:17: note: here
  378 |                 case I_ADD:
      |                 ^~~~
make: *** [Makefile:57: emu/libemu.o] Error 1

What should i do?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions