Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libdeflate v1.20.0 broke building with cargo-zigbuild #41

Open
paolobarbolini opened this issue Jan 14, 2025 · 3 comments
Open

libdeflate v1.20.0 broke building with cargo-zigbuild #41

paolobarbolini opened this issue Jan 14, 2025 · 3 comments

Comments

@paolobarbolini
Copy link

paolobarbolini commented Jan 14, 2025

This issue is probably for upstream libdeflate but I'll open it here first while I try to create reproduction instructions for them.


After upgrading libdeflate-sys to v1.20 building via cargo-zigbuild broke completely with:

warning: [email protected]: In file included from libdeflate/lib/adler32.c:128:
warning: [email protected]: In file included from libdeflate/lib/x86/adler32_impl.h:93:
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:197:21: error: always_inline function '_mm512_set1_epi8' requires target feature 'evex512', but would be inlined into function 'adler32_x86_avx512_vl512_vnni' that is compiled without support for 'evex512'
warning: [email protected]:   197 |         const vec_t ones = VSET1_8(1);
warning: [email protected]:       |                            ^
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:116:23: note: expanded from macro 'VSET1_8'
warning: [email protected]:   116 | #  define VSET1_8(a)            _mm512_set1_epi8(a)
warning: [email protected]:       |                                 ^
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:197:21: error: AVX vector return of type '__m512i' (vector of 8 'long long' values) without 'evex512' enabled changes the ABI
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:116:23: note: expanded from macro 'VSET1_8'
warning: [email protected]:   116 | #  define VSET1_8(a)            _mm512_set1_epi8(a)
warning: [email protected]:       |                                 ^
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:224:23: error: always_inline function '_mm512_setzero_si512' requires target feature 'evex512', but would be inlined into function 'adler32_x86_avx512_vl512_vnni' that is compiled without support for 'evex512'
warning: [email protected]:   224 |         const vec_t zeroes = VSETZERO();
warning: [email protected]:       |                              ^
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:118:23: note: expanded from macro 'VSETZERO'
warning: [email protected]:   118 | #  define VSETZERO()            _mm512_setzero_si512()
warning: [email protected]:       |                                 ^
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:224:23: error: AVX vector return of type '__m512i' (vector of 8 'long long' values) without 'evex512' enabled changes the ABI
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:118:23: note: expanded from macro 'VSETZERO'
warning: [email protected]:   118 | #  define VSETZERO()            _mm512_setzero_si512()
warning: [email protected]:       |                                 ^
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:259:17: error: always_inline function '_mm512_load_si512' requires target feature 'evex512', but would be inlined into function 'adler32_x86_avx512_vl512_vnni' that is compiled without support for 'evex512'
warning: [email protected]:   259 |                 vec_t mults = VLOAD(raw_mults);
warning: [email protected]:       |                               ^
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:110:21: note: expanded from macro 'VLOAD'
warning: [email protected]:   110 | #  define VLOAD(p)              _mm512_load_si512((const void *)(p))
warning: [email protected]:       |                                 ^
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:259:17: error: AVX vector return of type '__m512i' (vector of 8 'long long' values) without 'evex512' enabled changes the ABI
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:110:21: note: expanded from macro 'VLOAD'
warning: [email protected]:   110 | #  define VLOAD(p)              _mm512_load_si512((const void *)(p))
warning: [email protected]:       |                                 ^
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:280:20: error: always_inline function '_mm512_loadu_si512' requires target feature 'evex512', but would be inlined into function 'adler32_x86_avx512_vl512_vnni' that is compiled without support for 'evex512'
warning: [email protected]:   280 |                                 vec_t data_a = VLOADU(p + 0*VL);
warning: [email protected]:       |                                                ^
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:111:22: note: expanded from macro 'VLOADU'
warning: [email protected]:   111 | #  define VLOADU(p)             _mm512_loadu_si512((const void *)(p))
warning: [email protected]:       |                                 ^
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:280:20: error: AVX vector return of type '__m512i' (vector of 8 'long long' values) without 'evex512' enabled changes the ABI
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:111:22: note: expanded from macro 'VLOADU'
warning: [email protected]:   111 | #  define VLOADU(p)             _mm512_loadu_si512((const void *)(p))
warning: [email protected]:       |                                 ^
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:281:20: error: always_inline function '_mm512_loadu_si512' requires target feature 'evex512', but would be inlined into function 'adler32_x86_avx512_vl512_vnni' that is compiled without support for 'evex512'
warning: [email protected]:   281 |                                 vec_t data_b = VLOADU(p + 1*VL);
warning: [email protected]:       |                                                ^
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:111:22: note: expanded from macro 'VLOADU'
warning: [email protected]:   111 | #  define VLOADU(p)             _mm512_loadu_si512((const void *)(p))
warning: [email protected]:       |                                 ^
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:281:20: error: AVX vector return of type '__m512i' (vector of 8 'long long' values) without 'evex512' enabled changes the ABI
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:111:22: note: expanded from macro 'VLOADU'
warning: [email protected]:   111 | #  define VLOADU(p)             _mm512_loadu_si512((const void *)(p))
warning: [email protected]:       |                                 ^
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:282:20: error: always_inline function '_mm512_loadu_si512' requires target feature 'evex512', but would be inlined into function 'adler32_x86_avx512_vl512_vnni' that is compiled without support for 'evex512'
warning: [email protected]:   282 |                                 vec_t data_c = VLOADU(p + 2*VL);
warning: [email protected]:       |                                                ^
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:111:22: note: expanded from macro 'VLOADU'
warning: [email protected]:   111 | #  define VLOADU(p)             _mm512_loadu_si512((const void *)(p))
warning: [email protected]:       |                                 ^
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:282:20: error: AVX vector return of type '__m512i' (vector of 8 'long long' values) without 'evex512' enabled changes the ABI
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:111:22: note: expanded from macro 'VLOADU'
warning: [email protected]:   111 | #  define VLOADU(p)             _mm512_loadu_si512((const void *)(p))
warning: [email protected]:       |                                 ^
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:283:20: error: always_inline function '_mm512_loadu_si512' requires target feature 'evex512', but would be inlined into function 'adler32_x86_avx512_vl512_vnni' that is compiled without support for 'evex512'
warning: [email protected]:   283 |                                 vec_t data_d = VLOADU(p + 3*VL);
warning: [email protected]:       |                                                ^
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:111:22: note: expanded from macro 'VLOADU'
warning: [email protected]:   111 | #  define VLOADU(p)             _mm512_loadu_si512((const void *)(p))
warning: [email protected]:       |                                 ^
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:283:20: error: AVX vector return of type '__m512i' (vector of 8 'long long' values) without 'evex512' enabled changes the ABI
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:111:22: note: expanded from macro 'VLOADU'
warning: [email protected]:   111 | #  define VLOADU(p)             _mm512_loadu_si512((const void *)(p))
warning: [email protected]:       |                                 ^
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:295:14: error: always_inline function '_mm512_dpbusd_epi32' requires target feature 'evex512', but would be inlined into function 'adler32_x86_avx512_vl512_vnni' that is compiled without support for 'evex512'
warning: [email protected]:   295 |                                 v_s2   = VDPBUSD(v_s2,   data_a, mults);
warning: [email protected]:       |                                          ^
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:109:28: note: expanded from macro 'VDPBUSD'
warning: [email protected]:   109 | #  define VDPBUSD(a, b, c)      _mm512_dpbusd_epi32((a), (b), (c))
warning: [email protected]:       |                                 ^
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:295:14: error: AVX vector argument of type '__m512i' (vector of 8 'long long' values) without 'evex512' enabled changes the ABI
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:109:28: note: expanded from macro 'VDPBUSD'
warning: [email protected]:   109 | #  define VDPBUSD(a, b, c)      _mm512_dpbusd_epi32((a), (b), (c))
warning: [email protected]:       |                                 ^
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:296:14: error: always_inline function '_mm512_dpbusd_epi32' requires target feature 'evex512', but would be inlined into function 'adler32_x86_avx512_vl512_vnni' that is compiled without support for 'evex512'
warning: [email protected]:   296 |                                 v_s2_b = VDPBUSD(v_s2_b, data_b, mults);
warning: [email protected]:       |                                          ^
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:109:28: note: expanded from macro 'VDPBUSD'
warning: [email protected]:   109 | #  define VDPBUSD(a, b, c)      _mm512_dpbusd_epi32((a), (b), (c))
warning: [email protected]:       |                                 ^
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:296:14: error: AVX vector argument of type '__m512i' (vector of 8 'long long' values) without 'evex512' enabled changes the ABI
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:109:28: note: expanded from macro 'VDPBUSD'
warning: [email protected]:   109 | #  define VDPBUSD(a, b, c)      _mm512_dpbusd_epi32((a), (b), (c))
warning: [email protected]:       |                                 ^
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:297:14: error: always_inline function '_mm512_dpbusd_epi32' requires target feature 'evex512', but would be inlined into function 'adler32_x86_avx512_vl512_vnni' that is compiled without support for 'evex512'
warning: [email protected]:   297 |                                 v_s2_c = VDPBUSD(v_s2_c, data_c, mults);
warning: [email protected]:       |                                          ^
warning: [email protected]: libdeflate/lib/x86/adler32_template.h:109:28: note: expanded from macro 'VDPBUSD'
warning: [email protected]:   109 | #  define VDPBUSD(a, b, c)      _mm512_dpbusd_epi32((a), (b), (c))
warning: [email protected]:       |                                 ^
warning: [email protected]: fatal error: too many errors emitted, stopping now [-ferror-limit=]
warning: [email protected]: 20 errors generated.
error: failed to run custom build command for `libdeflate-sys v1.20.0 (/tmp/libdeflater/libdeflate-sys)`

Caused by:
  process didn't exit successfully: `/tmp/libdeflater/target/release/build/libdeflate-sys-553645403fe1db87/build-script-build` (exit status: 1)
  --- stdout
  OPT_LEVEL = Some(3)
  TARGET = Some(x86_64-unknown-linux-gnu)
  HOST = Some(x86_64-unknown-linux-gnu)
  cargo:rerun-if-env-changed=CC_x86_64-unknown-linux-gnu
  CC_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CC_x86_64_unknown_linux_gnu
  CC_x86_64_unknown_linux_gnu = Some(/home/paolobarbolini/.cache/cargo-zigbuild/0.19.7/zigcc-x86_64-unknown-linux-gnu-7d27.sh)
  RUSTC_WRAPPER = None
  cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some(false)
  cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-gnu
  CFLAGS_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnu
  CFLAGS_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  CARGO_ENCODED_RUSTFLAGS = Some(-Clink-arg=-fuse-ld=/usr/bin/mold)
  cargo:warning=In file included from libdeflate/lib/adler32.c:128:
  cargo:warning=In file included from libdeflate/lib/x86/adler32_impl.h:93:
  cargo:warning=libdeflate/lib/x86/adler32_template.h:197:21: error: always_inline function '_mm512_set1_epi8' requires target feature 'evex512', but would be inlined into function 'adler32_x86_avx512_vl512_vnni' that is compiled without support for 'evex512'
  cargo:warning=  197 |         const vec_t ones = VSET1_8(1);
  cargo:warning=      |                            ^
  cargo:warning=libdeflate/lib/x86/adler32_template.h:116:23: note: expanded from macro 'VSET1_8'
  cargo:warning=  116 | #  define VSET1_8(a)            _mm512_set1_epi8(a)
  cargo:warning=      |                                 ^
  cargo:warning=libdeflate/lib/x86/adler32_template.h:197:21: error: AVX vector return of type '__m512i' (vector of 8 'long long' values) without 'evex512' enabled changes the ABI
  cargo:warning=libdeflate/lib/x86/adler32_template.h:116:23: note: expanded from macro 'VSET1_8'
  cargo:warning=  116 | #  define VSET1_8(a)            _mm512_set1_epi8(a)
  cargo:warning=      |                                 ^
  cargo:warning=libdeflate/lib/x86/adler32_template.h:224:23: error: always_inline function '_mm512_setzero_si512' requires target feature 'evex512', but would be inlined into function 'adler32_x86_avx512_vl512_vnni' that is compiled without support for 'evex512'
  cargo:warning=  224 |         const vec_t zeroes = VSETZERO();
  cargo:warning=      |                              ^
  cargo:warning=libdeflate/lib/x86/adler32_template.h:118:23: note: expanded from macro 'VSETZERO'
  cargo:warning=  118 | #  define VSETZERO()            _mm512_setzero_si512()
  cargo:warning=      |                                 ^
  cargo:warning=libdeflate/lib/x86/adler32_template.h:224:23: error: AVX vector return of type '__m512i' (vector of 8 'long long' values) without 'evex512' enabled changes the ABI
  cargo:warning=libdeflate/lib/x86/adler32_template.h:118:23: note: expanded from macro 'VSETZERO'
  cargo:warning=  118 | #  define VSETZERO()            _mm512_setzero_si512()
  cargo:warning=      |                                 ^
  cargo:warning=libdeflate/lib/x86/adler32_template.h:259:17: error: always_inline function '_mm512_load_si512' requires target feature 'evex512', but would be inlined into function 'adler32_x86_avx512_vl512_vnni' that is compiled without support for 'evex512'
  cargo:warning=  259 |                 vec_t mults = VLOAD(raw_mults);
  cargo:warning=      |                               ^
  cargo:warning=libdeflate/lib/x86/adler32_template.h:110:21: note: expanded from macro 'VLOAD'
  cargo:warning=  110 | #  define VLOAD(p)              _mm512_load_si512((const void *)(p))
  cargo:warning=      |                                 ^
  cargo:warning=libdeflate/lib/x86/adler32_template.h:259:17: error: AVX vector return of type '__m512i' (vector of 8 'long long' values) without 'evex512' enabled changes the ABI
  cargo:warning=libdeflate/lib/x86/adler32_template.h:110:21: note: expanded from macro 'VLOAD'
  cargo:warning=  110 | #  define VLOAD(p)              _mm512_load_si512((const void *)(p))
  cargo:warning=      |                                 ^
  cargo:warning=libdeflate/lib/x86/adler32_template.h:280:20: error: always_inline function '_mm512_loadu_si512' requires target feature 'evex512', but would be inlined into function 'adler32_x86_avx512_vl512_vnni' that is compiled without support for 'evex512'
  cargo:warning=  280 |                                 vec_t data_a = VLOADU(p + 0*VL);
  cargo:warning=      |                                                ^
  cargo:warning=libdeflate/lib/x86/adler32_template.h:111:22: note: expanded from macro 'VLOADU'
  cargo:warning=  111 | #  define VLOADU(p)             _mm512_loadu_si512((const void *)(p))
  cargo:warning=      |                                 ^
  cargo:warning=libdeflate/lib/x86/adler32_template.h:280:20: error: AVX vector return of type '__m512i' (vector of 8 'long long' values) without 'evex512' enabled changes the ABI
  cargo:warning=libdeflate/lib/x86/adler32_template.h:111:22: note: expanded from macro 'VLOADU'
  cargo:warning=  111 | #  define VLOADU(p)             _mm512_loadu_si512((const void *)(p))
  cargo:warning=      |                                 ^
  cargo:warning=libdeflate/lib/x86/adler32_template.h:281:20: error: always_inline function '_mm512_loadu_si512' requires target feature 'evex512', but would be inlined into function 'adler32_x86_avx512_vl512_vnni' that is compiled without support for 'evex512'
  cargo:warning=  281 |                                 vec_t data_b = VLOADU(p + 1*VL);
  cargo:warning=      |                                                ^
  cargo:warning=libdeflate/lib/x86/adler32_template.h:111:22: note: expanded from macro 'VLOADU'
  cargo:warning=  111 | #  define VLOADU(p)             _mm512_loadu_si512((const void *)(p))
  cargo:warning=      |                                 ^
  cargo:warning=libdeflate/lib/x86/adler32_template.h:281:20: error: AVX vector return of type '__m512i' (vector of 8 'long long' values) without 'evex512' enabled changes the ABI
  cargo:warning=libdeflate/lib/x86/adler32_template.h:111:22: note: expanded from macro 'VLOADU'
  cargo:warning=  111 | #  define VLOADU(p)             _mm512_loadu_si512((const void *)(p))
  cargo:warning=      |                                 ^
  cargo:warning=libdeflate/lib/x86/adler32_template.h:282:20: error: always_inline function '_mm512_loadu_si512' requires target feature 'evex512', but would be inlined into function 'adler32_x86_avx512_vl512_vnni' that is compiled without support for 'evex512'
  cargo:warning=  282 |                                 vec_t data_c = VLOADU(p + 2*VL);
  cargo:warning=      |                                                ^
  cargo:warning=libdeflate/lib/x86/adler32_template.h:111:22: note: expanded from macro 'VLOADU'
  cargo:warning=  111 | #  define VLOADU(p)             _mm512_loadu_si512((const void *)(p))
  cargo:warning=      |                                 ^
  cargo:warning=libdeflate/lib/x86/adler32_template.h:282:20: error: AVX vector return of type '__m512i' (vector of 8 'long long' values) without 'evex512' enabled changes the ABI
  cargo:warning=libdeflate/lib/x86/adler32_template.h:111:22: note: expanded from macro 'VLOADU'
  cargo:warning=  111 | #  define VLOADU(p)             _mm512_loadu_si512((const void *)(p))
  cargo:warning=      |                                 ^
  cargo:warning=libdeflate/lib/x86/adler32_template.h:283:20: error: always_inline function '_mm512_loadu_si512' requires target feature 'evex512', but would be inlined into function 'adler32_x86_avx512_vl512_vnni' that is compiled without support for 'evex512'
  cargo:warning=  283 |                                 vec_t data_d = VLOADU(p + 3*VL);
  cargo:warning=      |                                                ^
  cargo:warning=libdeflate/lib/x86/adler32_template.h:111:22: note: expanded from macro 'VLOADU'
  cargo:warning=  111 | #  define VLOADU(p)             _mm512_loadu_si512((const void *)(p))
  cargo:warning=      |                                 ^
  cargo:warning=libdeflate/lib/x86/adler32_template.h:283:20: error: AVX vector return of type '__m512i' (vector of 8 'long long' values) without 'evex512' enabled changes the ABI
  cargo:warning=libdeflate/lib/x86/adler32_template.h:111:22: note: expanded from macro 'VLOADU'
  cargo:warning=  111 | #  define VLOADU(p)             _mm512_loadu_si512((const void *)(p))
  cargo:warning=      |                                 ^
  cargo:warning=libdeflate/lib/x86/adler32_template.h:295:14: error: always_inline function '_mm512_dpbusd_epi32' requires target feature 'evex512', but would be inlined into function 'adler32_x86_avx512_vl512_vnni' that is compiled without support for 'evex512'
  cargo:warning=  295 |                                 v_s2   = VDPBUSD(v_s2,   data_a, mults);
  cargo:warning=      |                                          ^
  cargo:warning=libdeflate/lib/x86/adler32_template.h:109:28: note: expanded from macro 'VDPBUSD'
  cargo:warning=  109 | #  define VDPBUSD(a, b, c)      _mm512_dpbusd_epi32((a), (b), (c))
  cargo:warning=      |                                 ^
  cargo:warning=libdeflate/lib/x86/adler32_template.h:295:14: error: AVX vector argument of type '__m512i' (vector of 8 'long long' values) without 'evex512' enabled changes the ABI
  cargo:warning=libdeflate/lib/x86/adler32_template.h:109:28: note: expanded from macro 'VDPBUSD'
  cargo:warning=  109 | #  define VDPBUSD(a, b, c)      _mm512_dpbusd_epi32((a), (b), (c))
  cargo:warning=      |                                 ^
  cargo:warning=libdeflate/lib/x86/adler32_template.h:296:14: error: always_inline function '_mm512_dpbusd_epi32' requires target feature 'evex512', but would be inlined into function 'adler32_x86_avx512_vl512_vnni' that is compiled without support for 'evex512'
  cargo:warning=  296 |                                 v_s2_b = VDPBUSD(v_s2_b, data_b, mults);
  cargo:warning=      |                                          ^
  cargo:warning=libdeflate/lib/x86/adler32_template.h:109:28: note: expanded from macro 'VDPBUSD'
  cargo:warning=  109 | #  define VDPBUSD(a, b, c)      _mm512_dpbusd_epi32((a), (b), (c))
  cargo:warning=      |                                 ^
  cargo:warning=libdeflate/lib/x86/adler32_template.h:296:14: error: AVX vector argument of type '__m512i' (vector of 8 'long long' values) without 'evex512' enabled changes the ABI
  cargo:warning=libdeflate/lib/x86/adler32_template.h:109:28: note: expanded from macro 'VDPBUSD'
  cargo:warning=  109 | #  define VDPBUSD(a, b, c)      _mm512_dpbusd_epi32((a), (b), (c))
  cargo:warning=      |                                 ^
  cargo:warning=libdeflate/lib/x86/adler32_template.h:297:14: error: always_inline function '_mm512_dpbusd_epi32' requires target feature 'evex512', but would be inlined into function 'adler32_x86_avx512_vl512_vnni' that is compiled without support for 'evex512'
  cargo:warning=  297 |                                 v_s2_c = VDPBUSD(v_s2_c, data_c, mults);
  cargo:warning=      |                                          ^
  cargo:warning=libdeflate/lib/x86/adler32_template.h:109:28: note: expanded from macro 'VDPBUSD'
  cargo:warning=  109 | #  define VDPBUSD(a, b, c)      _mm512_dpbusd_epi32((a), (b), (c))
  cargo:warning=      |                                 ^
  cargo:warning=fatal error: too many errors emitted, stopping now [-ferror-limit=]
  cargo:warning=20 errors generated.

  --- stderr


  error occurred in cc-rs: Command LC_ALL="C" "/home/paolobarbolini/.cache/cargo-zigbuild/0.19.7/zigcc-x86_64-unknown-linux-gnu-7d27.sh" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "--target=x86_64-unknown-linux-gnu" "-I" "libdeflate" "-o" "/tmp/libdeflater/target/x86_64-unknown-linux-gnu/release/build/libdeflate-sys-38adf7bfa6adc4f1/out/lib/81d37bb229f1c0d9-adler32.o" "-c" "libdeflate/lib/adler32.c" with args zigcc-x86_64-unknown-linux-gnu-7d27.sh did not execute successfully (status code exit status: 1).

Later versions improved a lot, but compiling the master branch of this repository for aarch64-unknown-linux-musl on a x86_64-unknown-linux-gnu host is still broken:

warning: [email protected]: fatal error: error in backend: Cannot select: intrinsic %llvm.aarch64.crypto.eor3u
warning: [email protected]: zig: error: clang frontend command failed with exit code 70 (use -v to see invocation)
warning: [email protected]: clang version 18.1.8
warning: [email protected]: Target: aarch64-unknown-linux-musl
warning: [email protected]: Thread model: posix
warning: [email protected]: InstalledDir: /usr/bin
warning: [email protected]: zig: note: diagnostic msg: 
warning: [email protected]: ********************
warning: [email protected]: 
warning: [email protected]: PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
warning: [email protected]: Preprocessed source(s) and associated run script(s) are located at:
warning: [email protected]: zig: note: diagnostic msg: /tmp/crc32-0da230.c
warning: [email protected]: zig: note: diagnostic msg: /tmp/crc32-0da230.sh
warning: [email protected]: zig: note: diagnostic msg: 
warning: [email protected]: 
warning: [email protected]: ********************
error: failed to run custom build command for `libdeflate-sys v1.23.0 (/tmp/libdeflater/libdeflate-sys)`

Caused by:
  process didn't exit successfully: `/tmp/libdeflater/target/release/build/libdeflate-sys-5b713d98078c5f87/build-script-build` (exit status: 1)
  --- stdout
  OPT_LEVEL = Some(3)
  TARGET = Some(aarch64-unknown-linux-musl)
  HOST = Some(x86_64-unknown-linux-gnu)
  cargo:rerun-if-env-changed=CC_aarch64-unknown-linux-musl
  CC_aarch64-unknown-linux-musl = None
  cargo:rerun-if-env-changed=CC_aarch64_unknown_linux_musl
  CC_aarch64_unknown_linux_musl = Some(/home/paolobarbolini/.cache/cargo-zigbuild/0.19.7/zigcc-aarch64-unknown-linux-musl-fec1.sh)
  RUSTC_WRAPPER = None
  cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some(false)
  cargo:rerun-if-env-changed=CFLAGS_aarch64-unknown-linux-musl
  CFLAGS_aarch64-unknown-linux-musl = None
  cargo:rerun-if-env-changed=CFLAGS_aarch64_unknown_linux_musl
  CFLAGS_aarch64_unknown_linux_musl = None
  cargo:rerun-if-env-changed=TARGET_CFLAGS
  TARGET_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  CARGO_ENCODED_RUSTFLAGS = Some()
  cargo:warning=fatal error: error in backend: Cannot select: intrinsic %llvm.aarch64.crypto.eor3u
  cargo:warning=zig: error: clang frontend command failed with exit code 70 (use -v to see invocation)
  cargo:warning=clang version 18.1.8
  cargo:warning=Target: aarch64-unknown-linux-musl
  cargo:warning=Thread model: posix
  cargo:warning=InstalledDir: /usr/bin
  cargo:warning=zig: note: diagnostic msg: 
  cargo:warning=********************
  cargo:warning=
  cargo:warning=PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
  cargo:warning=Preprocessed source(s) and associated run script(s) are located at:
  cargo:warning=zig: note: diagnostic msg: /tmp/crc32-0da230.c
  cargo:warning=zig: note: diagnostic msg: /tmp/crc32-0da230.sh
  cargo:warning=zig: note: diagnostic msg: 
  cargo:warning=
  cargo:warning=********************

  --- stderr


  error occurred in cc-rs: Command LC_ALL="C" "/home/paolobarbolini/.cache/cargo-zigbuild/0.19.7/zigcc-aarch64-unknown-linux-musl-fec1.sh" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=aarch64-unknown-linux-musl" "-I" "libdeflate" "-o" "/tmp/libdeflater/target/aarch64-unknown-linux-musl/release/build/libdeflate-sys-02f1a5115846db24/out/lib/81d37bb229f1c0d9-crc32.o" "-c" "libdeflate/lib/crc32.c" with args zigcc-aarch64-unknown-linux-musl-fec1.sh did not execute successfully (status code exit status: 1).

v1.19.2 compiles fine.


The issue can be reproduced via:

# somehow install zig https://ziglang.org
cargo install --locked cargo-zigbuild
# on Arch Linux the above two commands can be replaced with: pacman -S zig cargo-zigbuild

git clone https://github.com/adamkewley/libdeflater
cd libdeflater/libdeflate-sys
git submodule init
git submodule update
cargo zigbuild --release --target aarch64-unknown-linux-gnu
# same applies for the musl target: cargo zigbuild --release --target aarch64-unknown-linux-musl

I was able to bisect the regression to ebiggers/libdeflate@c1926a4

@adamkewley
Copy link
Owner

Hi,

I'm quite busy and won't be able to investigate the exact reason for this regression. Based on what you're reporting, it looks like upstream has added support for some native instructions that aren't compatible with the way you would like to build libdeflater (i.e. via the zig compiler, rather than gcc?)

@paolobarbolini
Copy link
Author

via the zig compiler, rather than gcc?

Yes cargo-zigbuild is supposed to make it easier to cross compile by having zig replace gcc/clang.

I'm not in a hurry to fix this and I'll try spending some time myself to understand how it works under the hood and how to reproduce it without all of the surrounding Rust stuff.

@adamkewley
Copy link
Owner

Fair enough!

No idea exactly what this could be but, looking at the error message and the symbols involved (which are typical SIMD intrinsics you'd find in a C codebase that's using immintrin) my guess would be that the zig compiler doesn't like the intrinsics.

To be fair to zig, intrinsics are quite tricky to get right without UB etc. (they tend to rely on programmers being very aware of memory alignment, register state, etc.), so it wouldn't surprise me if there's some kind of restrictions on their use!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants