seanmonstar / httparse

A push parser for the HTTP 1.x protocol in Rust.
https://docs.rs/httparse
Apache License 2.0
567 stars 111 forks source link

Build fails for x86 targets #165

Closed zonyitoo closed 1 month ago

zonyitoo commented 1 month ago

Here are build logs for i686-unknown-linux-musl:

error[E0432]: unresolved import `core::arch::x86_64`
  --> /cargo/registry/src/index.crates.io-6f17d22bba15001f/httparse-1.9.0/src/simd/avx2.rs:37:21
   |
37 |     use core::arch::x86_64::*;
   |                     ^^^^^^ could not find `x86_64` in `arch`

error[E0432]: unresolved import `core::arch::x86_64`
   --> /cargo/registry/src/index.crates.io-6f17d22bba15001f/httparse-1.9.0/src/simd/avx2.rs:104:21
    |
104 |     use core::arch::x86_64::*;
    |                     ^^^^^^ could not find `x86_64` in `arch`

   Compiling idna v0.4.0
error[E0412]: cannot find type `__m256i` in this scope
  --> /cargo/registry/src/index.crates.io-6f17d22bba15001f/httparse-1.9.0/src/simd/avx2.rs:41:14
   |
41 |     let LSH: __m256i = _mm256_set1_epi8(0x0f);
   |              ^^^^^^^ not found in this scope
   |
help: consider importing one of these items
   |
1  + use core::arch::x86::__m256i;
   |
1  + use std::arch::x86::__m256i;
   |

error[E0425]: cannot find function `_mm256_set1_epi8` in this scope
  --> /cargo/registry/src/index.crates.io-6f17d22bba15001f/httparse-1.9.0/src/simd/avx2.rs:41:24
   |
41 |     let LSH: __m256i = _mm256_set1_epi8(0x0f);
   |                        ^^^^^^^^^^^^^^^^ not found in this scope
   |
help: consider importing one of these items
   |
1  + use core::arch::x86::_mm256_set1_epi8;
   |
1  + use std::arch::x86::_mm256_set1_epi8;
   |

error[E0412]: cannot find type `__m256i` in this scope
  --> /cargo/registry/src/index.crates.io-6f17d22bba15001f/httparse-1.9.0/src/simd/avx2.rs:45:14
   |
45 |     let URI: __m256i = _mm256_setr_epi8(
   |              ^^^^^^^ not found in this scope
   |
help: consider importing one of these items
   |
1  + use core::arch::x86::__m256i;
   |
1  + use std::arch::x86::__m256i;
   |

error[E0425]: cannot find function `_mm256_setr_epi8` in this scope
  --> /cargo/registry/src/index.crates.io-6f17d22bba15001f/httparse-1.9.0/src/simd/avx2.rs:45:24
   |
45 |     let URI: __m256i = _mm256_setr_epi8(
   |                        ^^^^^^^^^^^^^^^^ not found in this scope
   |
help: consider importing one of these items
   |
1  + use core::arch::x86::_mm256_setr_epi8;
   |
1  + use std::arch::x86::_mm256_setr_epi8;
   |

error[E0412]: cannot find type `__m256i` in this scope
  --> /cargo/registry/src/index.crates.io-6f17d22bba15001f/httparse-1.9.0/src/simd/avx2.rs:51:14
   |
51 |     let ARF: __m256i = _mm256_setr_epi8(
   |              ^^^^^^^ not found in this scope
   |
help: consider importing one of these items
   |
1  + use core::arch::x86::__m256i;
   |
1  + use std::arch::x86::__m256i;
   |

error[E0425]: cannot find function `_mm256_setr_epi8` in this scope
  --> /cargo/registry/src/index.crates.io-6f17d22bba15001f/httparse-1.9.0/src/simd/avx2.rs:51:24
   |
51 |     let ARF: __m256i = _mm256_setr_epi8(
   |                        ^^^^^^^^^^^^^^^^ not found in this scope
   |
help: consider importing one of these items
   |
1  + use core::arch::x86::_mm256_setr_epi8;
   |
1  + use std::arch::x86::_mm256_setr_epi8;
   |

error[E0425]: cannot find function `_mm256_lddqu_si256` in this scope
  --> /cargo/registry/src/index.crates.io-6f17d22bba15001f/httparse-1.9.0/src/simd/avx2.rs:58:16
   |
58 |     let data = _mm256_lddqu_si256(ptr as *const _);
   |                ^^^^^^^^^^^^^^^^^^ not found in this scope
   |
help: consider importing one of these items
   |
1  + use core::arch::x86::_mm256_lddqu_si256;
   |
1  + use std::arch::x86::_mm256_lddqu_si256;
   |

error[E0425]: cannot find function `_mm256_shuffle_epi8` in this scope
  --> /cargo/registry/src/index.crates.io-6f17d22bba15001f/httparse-1.9.0/src/simd/avx2.rs:59:16
   |
59 |     let rbms = _mm256_shuffle_epi8(URI, data);
   |                ^^^^^^^^^^^^^^^^^^^ not found in this scope
   |
help: consider importing one of these items
   |
1  + use core::arch::x86::_mm256_shuffle_epi8;
   |
1  + use std::arch::x86::_mm256_shuffle_epi8;
   |

error[E0425]: cannot find function `_mm256_and_si256` in this scope
  --> /cargo/registry/src/index.crates.io-6f17d22bba15001f/httparse-1.9.0/src/simd/avx2.rs:60:16
   |
60 |     let cols = _mm256_and_si256(LSH, _mm256_srli_epi16(data, 4));
   |                ^^^^^^^^^^^^^^^^ not found in this scope
   |
help: consider importing one of these items
   |
1  + use core::arch::x86::_mm256_and_si256;
   |
1  + use std::arch::x86::_mm256_and_si256;
   |

error[E0425]: cannot find function `_mm256_srli_epi16` in this scope
  --> /cargo/registry/src/index.crates.io-6f17d22bba15001f/httparse-1.9.0/src/simd/avx2.rs:60:38
   |
60 |     let cols = _mm256_and_si256(LSH, _mm256_srli_epi16(data, 4));
   |                                      ^^^^^^^^^^^^^^^^^ not found in this scope
   |
help: consider importing one of these items
   |
1  + use core::arch::x86::_mm256_srli_epi16;
   |
1  + use std::arch::x86::_mm256_srli_epi16;
   |

error[E0425]: cannot find function `_mm256_and_si256` in this scope
  --> /cargo/registry/src/index.crates.io-6f17d22bba15001f/httparse-1.9.0/src/simd/avx2.rs:61:16
   |
61 |     let bits = _mm256_and_si256(_mm256_shuffle_epi8(ARF, cols), rbms);
   |                ^^^^^^^^^^^^^^^^ not found in this scope
   |
help: consider importing one of these items
   |
1  + use core::arch::x86::_mm256_and_si256;
   |
1  + use std::arch::x86::_mm256_and_si256;
   |

error[E0425]: cannot find function `_mm256_shuffle_epi8` in this scope
  --> /cargo/registry/src/index.crates.io-6f17d22bba15001f/httparse-1.9.0/src/simd/avx2.rs:61:33
   |
61 |     let bits = _mm256_and_si256(_mm256_shuffle_epi8(ARF, cols), rbms);
   |                                 ^^^^^^^^^^^^^^^^^^^ not found in this scope
   |
help: consider importing one of these items
   |
1  + use core::arch::x86::_mm256_shuffle_epi8;
   |
1  + use std::arch::x86::_mm256_shuffle_epi8;
   |

error[E0425]: cannot find function `_mm256_cmpeq_epi8` in this scope
  --> /cargo/registry/src/index.crates.io-6f17d22bba15001f/httparse-1.9.0/src/simd/avx2.rs:63:13
   |
63 |     let v = _mm256_cmpeq_epi8(bits, _mm256_setzero_si256());
   |             ^^^^^^^^^^^^^^^^^ not found in this scope
   |
help: consider importing one of these items
   |
1  + use core::arch::x86::_mm256_cmpeq_epi8;
   |
1  + use std::arch::x86::_mm256_cmpeq_epi8;
   |

error[E0425]: cannot find function `_mm256_setzero_si256` in this scope
  --> /cargo/registry/src/index.crates.io-6f17d22bba15001f/httparse-1.9.0/src/simd/avx2.rs:63:37
   |
63 |     let v = _mm256_cmpeq_epi8(bits, _mm256_setzero_si256());
   |                                     ^^^^^^^^^^^^^^^^^^^^ not found in this scope
   |
help: consider importing one of these items
   |
1  + use core::arch::x86::_mm256_setzero_si256;
   |
1  + use std::arch::x86::_mm256_setzero_si256;
   |

error[E0425]: cannot find function `_mm256_movemask_epi8` in this scope
  --> /cargo/registry/src/index.crates.io-6f17d22bba15001f/httparse-1.9.0/src/simd/avx2.rs:64:13
   |
64 |     let r = _mm256_movemask_epi8(v) as u32;
   |             ^^^^^^^^^^^^^^^^^^^^ not found in this scope
   |
help: consider importing one of these items
   |
1  + use core::arch::x86::_mm256_movemask_epi8;
   |
1  + use std::arch::x86::_mm256_movemask_epi8;
   |

error[E0412]: cannot find type `__m256i` in this scope
   --> /cargo/registry/src/index.crates.io-6f17d22bba15001f/httparse-1.9.0/src/simd/avx2.rs:109:14
    |
109 |     let TAB: __m256i = _mm256_set1_epi8(0x09);
    |              ^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
1   + use core::arch::x86::__m256i;
    |
1   + use std::arch::x86::__m256i;
    |

error[E0425]: cannot find function `_mm256_set1_epi8` in this scope
   --> /cargo/registry/src/index.crates.io-6f17d22bba15001f/httparse-1.9.0/src/simd/avx2.rs:109:24
    |
109 |     let TAB: __m256i = _mm256_set1_epi8(0x09);
    |                        ^^^^^^^^^^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
1   + use core::arch::x86::_mm256_set1_epi8;
    |
1   + use std::arch::x86::_mm256_set1_epi8;
    |

error[E0412]: cannot find type `__m256i` in this scope
   --> /cargo/registry/src/index.crates.io-6f17d22bba15001f/httparse-1.9.0/src/simd/avx2.rs:110:14
    |
110 |     let DEL: __m256i = _mm256_set1_epi8(0x7f);
    |              ^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
1   + use core::arch::x86::__m256i;
    |
1   + use std::arch::x86::__m256i;
    |

error[E0425]: cannot find function `_mm256_set1_epi8` in this scope
   --> /cargo/registry/src/index.crates.io-6f17d22bba15001f/httparse-1.9.0/src/simd/avx2.rs:110:24
    |
110 |     let DEL: __m256i = _mm256_set1_epi8(0x7f);
    |                        ^^^^^^^^^^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
1   + use core::arch::x86::_mm256_set1_epi8;
    |
1   + use std::arch::x86::_mm256_set1_epi8;
    |

error[E0412]: cannot find type `__m256i` in this scope
   --> /cargo/registry/src/index.crates.io-6f17d22bba15001f/httparse-1.9.0/src/simd/avx2.rs:111:14
    |
111 |     let LOW: __m256i = _mm256_set1_epi8(0x20);
    |              ^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
1   + use core::arch::x86::__m256i;
    |
1   + use std::arch::x86::__m256i;
    |

error[E0425]: cannot find function `_mm256_set1_epi8` in this scope
   --> /cargo/registry/src/index.crates.io-6f17d22bba15001f/httparse-1.9.0/src/simd/avx2.rs:111:24
    |
111 |     let LOW: __m256i = _mm256_set1_epi8(0x20);
    |                        ^^^^^^^^^^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
1   + use core::arch::x86::_mm256_set1_epi8;
    |
1   + use std::arch::x86::_mm256_set1_epi8;
    |

error[E0425]: cannot find function `_mm256_lddqu_si256` in this scope
   --> /cargo/registry/src/index.crates.io-6f17d22bba15001f/httparse-1.9.0/src/simd/avx2.rs:113:15
    |
113 |     let dat = _mm256_lddqu_si256(ptr as *const _);
    |               ^^^^^^^^^^^^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
1   + use core::arch::x86::_mm256_lddqu_si256;
    |
1   + use std::arch::x86::_mm256_lddqu_si256;
    |

error[E0425]: cannot find function `_mm256_cmpeq_epi8` in this scope
   --> /cargo/registry/src/index.crates.io-6f17d22bba15001f/httparse-1.9.0/src/simd/avx2.rs:115:15
    |
115 |     let low = _mm256_cmpeq_epi8(_mm256_max_epu8(dat, LOW), dat);
    |               ^^^^^^^^^^^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
1   + use core::arch::x86::_mm256_cmpeq_epi8;
    |
1   + use std::arch::x86::_mm256_cmpeq_epi8;
    |

error[E0425]: cannot find function `_mm256_max_epu8` in this scope
   --> /cargo/registry/src/index.crates.io-6f17d22bba15001f/httparse-1.9.0/src/simd/avx2.rs:115:33
    |
115 |     let low = _mm256_cmpeq_epi8(_mm256_max_epu8(dat, LOW), dat);
    |                                 ^^^^^^^^^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
1   + use core::arch::x86::_mm256_max_epu8;
    |
1   + use std::arch::x86::_mm256_max_epu8;
    |

error[E0425]: cannot find function `_mm256_cmpeq_epi8` in this scope
   --> /cargo/registry/src/index.crates.io-6f17d22bba15001f/httparse-1.9.0/src/simd/avx2.rs:116:15
    |
116 |     let tab = _mm256_cmpeq_epi8(dat, TAB);
    |               ^^^^^^^^^^^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
1   + use core::arch::x86::_mm256_cmpeq_epi8;
    |
1   + use std::arch::x86::_mm256_cmpeq_epi8;
    |

error[E0425]: cannot find function `_mm256_cmpeq_epi8` in this scope
   --> /cargo/registry/src/index.crates.io-6f17d22bba15001f/httparse-1.9.0/src/simd/avx2.rs:117:15
    |
117 |     let del = _mm256_cmpeq_epi8(dat, DEL);
    |               ^^^^^^^^^^^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
1   + use core::arch::x86::_mm256_cmpeq_epi8;
    |
1   + use std::arch::x86::_mm256_cmpeq_epi8;
    |

error[E0425]: cannot find function `_mm256_andnot_si256` in this scope
   --> /cargo/registry/src/index.crates.io-6f17d22bba15001f/httparse-1.9.0/src/simd/avx2.rs:118:15
    |
118 |     let bit = _mm256_andnot_si256(del, _mm256_or_si256(low, tab));
    |               ^^^^^^^^^^^^^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
1   + use core::arch::x86::_mm256_andnot_si256;
    |
1   + use std::arch::x86::_mm256_andnot_si256;
    |

error[E0425]: cannot find function `_mm256_or_si256` in this scope
   --> /cargo/registry/src/index.crates.io-6f17d22bba15001f/httparse-1.9.0/src/simd/avx2.rs:118:40
    |
118 |     let bit = _mm256_andnot_si256(del, _mm256_or_si256(low, tab));
    |                                        ^^^^^^^^^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
1   + use core::arch::x86::_mm256_or_si256;
    |
1   + use std::arch::x86::_mm256_or_si256;
    |

error[E0425]: cannot find function `_mm256_movemask_epi8` in this scope
   --> /cargo/registry/src/index.crates.io-6f17d22bba15001f/httparse-1.9.0/src/simd/avx2.rs:119:15
    |
119 |     let res = _mm256_movemask_epi8(bit) as u32;
    |               ^^^^^^^^^^^^^^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
1   + use core::arch::x86::_mm256_movemask_epi8;
    |
1   + use std::arch::x86::_mm256_movemask_epi8;
    |

Some errors have detailed explanations: E0412, E0425, E0432.
For more information about an error, try `rustc --explain E0412`.
error: could not compile `httparse` (lib) due to 31 previous errors
warning: build failed, waiting for other jobs to finish...
Error: Process completed with exit code 1.
torokati44 commented 1 month ago

I was also just about to report this, we're seeing this as well: https://github.com/ruffle-rs/ruffle-android/actions/runs/9449084152/job/26024528379?pr=175

zonyitoo commented 1 month ago

Those functions should all add #[cfg(target_arch = "x86_64")].

seanmonstar commented 1 month ago

Sorry about that. Seems there's a target combo we aren't checking in CI.

zonyitoo commented 1 month ago

Please consider make a new release if it was easy to fix. @seanmonstar

seanmonstar commented 1 month ago

Working on it in https://github.com/seanmonstar/httparse/pull/168

If anyone wants to help confirm that the fix there works for them, that'd help. CI is still running, but since CI was already lacking, I'd feel more confident to know it worked in your environment too.

seanmonstar commented 1 month ago

v1.9.1 is published with a fix.

zonyitoo commented 1 month ago

Fix confirmed.

torokati44 commented 1 month ago

I can also confirm the fix: https://github.com/ruffle-rs/ruffle-android/actions/runs/9450180707/job/26028159231?pr=176 Thank you very much for the quick response!