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

Compiler error when building on custom x86_64 no_std target #57

Closed
kevinaboos opened this issue Aug 28, 2019 · 3 comments
Closed

Compiler error when building on custom x86_64 no_std target #57

kevinaboos opened this issue Aug 28, 2019 · 3 comments

Comments

@kevinaboos
Copy link

I ran into this error when trying to add the cstr_core crate to my no_std OS project, which depends on memchr and disables its default features.

Building in debug mode:

LLVM ERROR: Do not know how to split this operator's operand!

Building in release mode:

error: Could not compile `memchr`.

Caused by:
  process didn't exit successfully: `rustc --crate-name memchr /home/kevin/.cargo/registry/src/github.com-1ecc6299db9ec823/memchr-2.2.1/src/lib.rs --color always --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C codegen-units=1 -C metadata=ebf07e953eacc227 -C extra-filename=-ebf07e953eacc227 --out-dir /home/kevin/my_os/target/x86_64-my_os/release/deps --target x86_64-my_os -L dependency=/home/kevin/my_os/target/x86_64-my_os/release/deps -L dependency=/home/kevin/my_os/target/release/deps --cap-lints allow --emit=obj -C debuginfo=2 -C code-model=large -C relocation-model=static -D unused-must-use -Z merge-functions=disabled -Z share-generics=no --sysroot /home/kevin/.xargo --cfg memchr_runtime_simd --cfg memchr_runtime_sse2 --cfg memchr_runtime_sse42 --cfg memchr_runtime_avx` (signal: 11, SIGSEGV: invalid memory reference)

For reference and in case it matters, my compiler target .json file is:

{
  "llvm-target": "x86_64-unknown-none-gnu",
  "data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128",
  "linker-flavor": "gcc",
  "target-endian": "little",
  "target-pointer-width": "64",
  "target-c-int-width": "32",
  "arch": "x86_64",
  "os": "none",
  "features": "-mmx,-sse,+soft-float",
  "disable-redzone": true,
  "panic": "abort"
}

My rustc version is rustc 1.38.0-nightly (78ca1bda3 2019-07-08).

I've never encountered an error like this before, so I'm not sure what else to say. If more information is needed, I am happy to provide it.

@BurntSushi
Copy link
Owner

Thanks for the bug report, but this doesn't appear actionable to me. Firstly, I don't know how to take the information you've given me and reproduce your error. (What commands should I run? What do I do with your JSON file?) Secondly, any LLVM error one sees is unlikely to be something that crate authors can do something about. I don't have any insight in to how to debug it.

"features": "-mmx,-sse,+soft-float"

This crate makes extensive use of SIMD CPU instructions on x86_64: https://github.com/BurntSushi/rust-memchr/blob/master/src/x86/sse2.rs --- So your problem may be around that.

@kevinaboos
Copy link
Author

kevinaboos commented Aug 28, 2019

I figured as much, but I decided to post the issue just in case you or others had seen this problem previously, or for anyone who may encounter it in the future. Appreciate your quick response!

The good news is that I tried a few different compiler versions, and it just seems to be a compatibility problem with my older nightly version. Using the latest nightly compiler worked for me, as did downgrading to memchr 2.1.3 on my nightly version from 2019-07-08.

Thanks again, and sorry to bother!

@BurntSushi
Copy link
Owner

Oh interesting, that's good to know! Glad to hear it's working.

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