guzba / zippy

Pure Nim implementation of deflate, zlib, gzip and zip.
MIT License
246 stars 29 forks source link

Fix arm64 type mismatch build error #54

Closed apsun closed 1 year ago

apsun commented 1 year ago

uint8x8_t is imported as uint32x2. Not sure if this is just a typo or if there was some deeper reasoning behind it, but this fixes the build for me. I'm running Debian 11 on an ARM EC2 instance.

Original error I was seeing:

/home/nitter/.cache/nim/nitter_r/@m..@s..@s.nimble@spkgs@szippy-@hc51399f@szippy@sadler32_simd.nim.c: In function ‘adler32_neon__OOZOOZOnimbleZpkgsZzippy4535c5349515757fZzippyZadler515095simd_63’:
/home/nitter/.cache/nim/nitter_r/@m..@s..@s.nimble@spkgs@szippy-@hc51399f@szippy@sadler32_simd.nim.c:525:4: note: use ‘-flax-vector-conversions’ to permit conversions between vectors with differing element types or numbers of subparts
  525 |    T41_ = vget_low_u32(vecS1);
      |    ^~~~
/home/nitter/.cache/nim/nitter_r/@m..@s..@s.nimble@spkgs@szippy-@hc51399f@szippy@sadler32_simd.nim.c:525:11: error: incompatible types when assigning to type ‘uint8x8_t’ from type ‘uint32x2_t’
  525 |    T41_ = vget_low_u32(vecS1);
      |           ^~~~~~~~~~~~
/home/nitter/.cache/nim/nitter_r/@m..@s..@s.nimble@spkgs@szippy-@hc51399f@szippy@sadler32_simd.nim.c:526:11: error: incompatible types when assigning to type ‘uint8x8_t’ from type ‘uint32x2_t’
  526 |    T42_ = vget_high_u32(vecS1);
      |           ^~~~~~~~~~~~~
/home/nitter/.cache/nim/nitter_r/@m..@s..@s.nimble@spkgs@szippy-@hc51399f@szippy@sadler32_simd.nim.c:527:21: error: incompatible type for argument 1 of ‘vpadd_u32’
  527 |    sum1 = vpadd_u32(T41_, T42_);
      |                     ^~~~
      |                     |
      |                     uint8x8_t
In file included from /home/nitter/.cache/nim/nitter_r/@m..@s..@s.nimble@spkgs@szippy-@hc51399f@szippy@sadler32_simd.nim.c:9:
/usr/lib/gcc/aarch64-linux-gnu/10/include/arm_neon.h:23265:23: note: expected ‘uint32x2_t’ but argument is of type ‘uint8x8_t’
23265 | vpadd_u32 (uint32x2_t __a, uint32x2_t __b)
      |            ~~~~~~~~~~~^~~
compilation terminated due to -fmax-errors=3.
Error: execution of an external compiler program 'gcc -c  -w -fmax-errors=3 -O3 -fno-strict-aliasing -fno-ident   -I/usr/lib/nim -I/home/nitter/nitter/src -o /home/nitter/.cache/nim/nitter_r/@m..@s..@s.nimble@spkgs@szippy-@hc51399f@szippy@sadler32_simd.nim.c.o /home/nitter/.cache/nim/nitter_r/@m..@s..@s.nimble@spkgs@szippy-@hc51399f@szippy@sadler32_simd.nim.c' failed with exit code: 1
guzba commented 1 year ago

Ah thanks for the PR! This is just a typo and I'm eager to get it fixed now that I'm aware of it.

guzba commented 1 year ago

It is interesting that I had no issue compiling on Raspberry Pi 4 or my M1 when working on this. Something for another day though. I have just confirmed things still work as expected on my hardware with this change so I'll have this tagged soon.

guzba commented 1 year ago

This has been tagged in release https://github.com/guzba/zippy/releases/tag/0.10.6