Rust: 'inconsistent target specification' on custom .json target

Created on 12 Nov 2020  路  6Comments  路  Source: rust-lang/rust

Hello everyone, this is my first Issue on the Rust project, let me know if I'm doing anthing wrong !

Problem

I am in the process of building a library/runtime for the Wii fully written in Rust. To acheive this goal, I need to cross-compile my library to a custom target I named powerpc-none-eabi.

The json file contains "target-endian": "big" and "data-layout": "E-m:e-p:32:32-i64:64-n32" along other lines to define the architecture.

Normally, the build completes without an issue.

On the latest nighlty, the compiler fails and return:

PS S:\Code\ppc_ill> cargo build -Z build-std=core,alloc --target .\powerpc-none-eabi.json --release
error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `rustc - --crate-name ___ --print=file-names --target \\?\S:\Code\ppc_ill\powerpc-none-eabi.json --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (exit code: 1)
  --- stderr
  error: inconsistent target specification: "data-layout" claims architecture is big-endian, while "target-endian" is `little`

Of course, target-endian is set to big in the file, so this shouldn't happen.

Version it worked on

It most recently worked on:

rustc --version --verbose:

rustc 1.49.0-nightly (1773f60ea 2020-11-08)
binary: rustc
commit-hash: 1773f60ea5d42e86b8fdf78d2fc5221ead222bc1
commit-date: 2020-11-08
host: x86_64-pc-windows-msvc
release: 1.49.0-nightly

Version with regression

It fails on this nightly, currently latest at the time of writing:

rustc --version --verbose:

rustc 1.49.0-nightly (5404efc28 2020-11-11)
binary: rustc
commit-hash: 5404efc28a0cddee103ef6396c48ea71ff9631c8
commit-date: 2020-11-11
host: x86_64-pc-windows-msvc
release: 1.49.0-nightly

I can provide any file or other precision if necessary !

Thanks for reading my report !

A-target-specs C-bug T-compiler

Most helpful comment

I'll fix this today.

All 6 comments

I was also having the some issue and tracked it to this: https://github.com/rust-lang/rust/commit/dc004d4809f7e5fb5ea73ac630a0b1bdb58eabe4#diff-aa810a3be0834da891b171a8b04b09d0d3bbb76ac27c757cd232235099e062d2R1309

That commit broke the equivalence between "target_endian" and "target-endian" by adding a case to the key!() macro without the replace line for it.

cc @petrochenkov

I'll fix this today.

I hope this gets merged asap :-)

(Reopening because https://github.com/rust-lang/rust/pull/78993 isn't merged yet.)

Was this page helpful?
0 / 5 - 0 ratings