Skip to content

aesni detection fatally fails with rustflags in ~/.cargo/config #11

@FauxFaux

Description

@FauxFaux

I have target-cpu=native set in my rustflags, in ~/.cargo/config:

[target.'cfg(any(windows, unix))']
rustflags = ["-Ctarget-cpu=native"]

This causes aes-ctr to break my projects' build:

   Compiling aes-soft v0.3.3
   Compiling ctr v0.3.2
   Compiling aes-ctr v0.3.0
error[E0463]: can't find crate for `aesni`
  --> /home/faux/.cargo/registry/src/github.com-1ecc6299db9ec823/aes-ctr-0.3.0/src/lib.rs:62:1
   |
62 | extern crate aesni;
   | ^^^^^^^^^^^^^^^^^^^ can't find crate

error: aborting due to previous error

I guess cargo is using different rules to interpret target_feature in Cargo.toml vs. during the build? Note how it is loading the aes-soft crate above.

I tested stable and nightly cargo:
cargo 1.35.0-nightly (6f3e9c367 2019-04-04)
cargo 1.34.0 (6789d8a0a 2019-04-01)

If I remove ~/.cargo/config, and instead set RUSTFLAGS=, everything seems to work as expected:

% RUSTFLAGS=-Ctarget-cpu=native cargo build
...
   Compiling aesni v0.6.0
   Compiling aes-ctr v0.3.0
   Compiling lol v0.1.0 (/var/tmp/faux190416.sciatica/lol)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions