buserror / mii_emu

MII Apple //e Emulator for Linux
MIT License
143 stars 7 forks source link

Error when compiling on ARM #22

Closed IvanExpert closed 1 hour ago

IvanExpert commented 1 day ago

Using freshly installed Debian 12 on amd64, I am able to compile MII (the 1.9.7 release) without issue, per the instructions provided. I install the required dependencies, type make, and off we go.

Using freshly installed Debian 12 on arm64, identical setup, I get the following:

src/mii_video.c:27:10: fatal error: emmintrin.h: No such file or directory
   27 | #include <emmintrin.h>
      |          ^~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:150: build-aarch64-linux-gnu/obj/mii_video.o] Error 1

Any thoughts on how to proceed?

Thanks for your work on this fine emulator.

buserror commented 1 day ago

Good catch! Heres a small patch to fix it; I'll push that with the next version:

@@ -23,7 +23,7 @@
 typedef uint32_t u32_v __attribute__((vector_size(32)));
 #define VEC_ALIGN 31
 #define VEC_ECOUNT 8
-#else
+#elif defined(__SSE2__)
 #include <emmintrin.h>
 typedef uint32_t u32_v __attribute__((vector_size(16)));
 #define VEC_ALIGN 15
IvanExpert commented 1 day ago

Applied! Alas, now I get this:

(If it matters, I'm running in a Parallels VM containing Debian 12 on an ARM Mac.)

src/mii_video.c: In function ‘mii_video_timer_cb’:
src/mii_video.c:751:31: error: unknown type name ‘u32_v’
  751 |                         const u32_v mask = C_SCANLINE_MASK - (u32_v){}; // broadcast
      |                               ^~~~~
src/mii_video.c:751:63: error: ‘u32_v’ undeclared (first use in this function)
  751 |                       const u32_v mask = C_SCANLINE_MASK - (u32_v){}; // broadcast
      |                                                             ^~~~~

src/mii_video.c:751:63: note: each undeclared identifier is reported only once for each function it appears in
src/mii_video.c:751:69: error: expected ‘,’ or ‘;’ before ‘{’ token
  751 |                 const u32_v mask = C_SCANLINE_MASK - (u32_v){}; // broadcast
      |                                                             ^

src/mii_video.c:752:67: error: ‘VEC_ECOUNT’ undeclared (first use in this function)
  752 |                   for (int i = 0; i < MII_VIDEO_WIDTH; i += VEC_ECOUNT,
      |                                                             ^~~~~~~~~~

src/mii_video.c:752:77: warning: left-hand operand of comma expression has no effect [-Wunused-value]
  752 |                   for (int i = 0; i < MII_VIDEO_WIDTH; i += VEC_ECOUNT,
      |                                                                       ^

src/mii_video.c:753:77: warning: left-hand operand of comma expression has no effect [-Wunused-value]
  753 |                                         screen += VEC_ECOUNT, l2 += VEC_ECOUNT) {
      |                                                             ^

src/mii_video.c:754:38: error: expected ‘;’ before ‘s’
  754 |                                 u32_v s = *(u32_v *)screen;
      |                                      ^~
      |                                      ;
src/mii_video.c:755:33: error: ‘s’ undeclared (first use in this function)
  755 |                                 s &= mask;
      |                                 ^
src/mii_video.c:756:42: error: expected expression before ‘)’ token
  756 |                                 *(u32_v *)l2 = s;
      |                                          ^
src/mii_video.c:731:36: warning: variable ‘l2’ set but not used [-Wunused-but-set-variable]
  731 |                         uint32_t * l2 = screen + MII_VIDEO_WIDTH;
      |                                    ^~
make: *** [Makefile:150: build-aarch64-linux-gnu/obj/mii_video.o] Error 1
buserror commented 1 hour ago

Just pushed a 'proper' fix for this, hope this help ;-)