BurntSushi / memchr

Optimized string search routines for Rust.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

memchr 2.5.0 fails to compile on Android

Storyyeller opened this issue · comments

After upgrading to 2.5.0, I'm getting build errors on Android like this:

[CONTEXT] stderr: error[E0531]: cannot find tuple struct or tuple variant `GenericSIMD128` in this scope
[CONTEXT]    --> third-party/rust/vendor/memchr-2.5.0/src/memmem/mod.rs:885:13
[CONTEXT]     |
[CONTEXT] 885 |             GenericSIMD128(gs) => GenericSIMD128(gs),
[CONTEXT]     |             ^^^^^^^^^^^^^^ not found in this scope
[CONTEXT] 

It appears that the GenericSIMD128 enum variant is defined with cfg target_arg = "x86_64" or memchr_runtime_wasm128, but then it is used in the code without a cfg check limiting it to those platforms, causing it to fail to compile.

Your diagnosis looks right. Patches welcome, otherwise I'll fix this when I get to it. Bonus points for finding a way to put an Android build in CI. :)

I looked into this, and I could not see how this compilation error could occur. While it looks like there is a missing target_arch = "x86_64" here, it is gated on memchr_runtime_simd which should only be enabled in the build script for x86_64, wasm32 and wasm64.

I also ran this crate's tests under every android target supported by cross and all of them succeeded:

$ cross test --target x86_64-linux-android
$ cross test --target aarch64-linux-android
$ cross test --target arm-linux-androideabi
$ cross test --target i686-linux-android
$ cross test --target thumbv7neon-linux-androideabi
$ cross test --target armv7-linux-androideabi

So I'm going to close this. If someone can come up with a real reproduction, then I'd be happy to re-open it.

(One possibility is that there is a weird build environment that is not using build scripts or is using them improperly somehow. But without an actual reproduction, it's impossible to say.)