cuviper / autocfg

Automatic cfg for Rust compiler features
Apache License 2.0
95 stars 24 forks source link

Not compiling in Docker image running on M1 Mac using `--platform linux/amd64` #49

Closed pms1969 closed 2 years ago

pms1969 commented 2 years ago

trying to compile a program that has a dependency on this package. It gets stuck trying to compile every time.

root@6e4aba89c52b:/usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/autocfg-1.1.0# uname -a
Linux 6e4aba89c52b 5.10.104-linuxkit #1 SMP PREEMPT Thu Mar 17 17:05:54 UTC 2022 x86_64 GNU/Linux
root@6e4aba89c52b:/usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/autocfg-1.1.0# cargo build --verbose
   Compiling autocfg v1.1.0 (/usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/autocfg-1.1.0)
     Running `rustc --crate-name autocfg src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C metadata=76b5da8da28534a1 -C extra-filename=-76b5da8da28534a1 --out-dir /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/autocfg-1.1.0/target/debug/deps -C incremental=/usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/autocfg-1.1.0/target/debug/incremental -L dependency=/usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/autocfg-1.1.0/target/debug/deps`
^C  Building [                             ] 0/1: autocfg
root@6e4aba89c52b:/usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/autocfg-1.1.0# ls
Cargo.lock  Cargo.toml  Cargo.toml.orig  LICENSE-APACHE  LICENSE-MIT  README.md  examples  src  target  tests
root@6e4aba89c52b:/usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/autocfg-1.1.0# cargo clean
root@6e4aba89c52b:/usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/autocfg-1.1.0# cargo build --verbose
   Compiling autocfg v1.1.0 (/usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/autocfg-1.1.0)
     Running `rustc --crate-name autocfg src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C metadata=76b5da8da28534a1 -C extra-filename=-76b5da8da28534a1 --out-dir /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/autocfg-1.1.0/target/debug/deps -C incremental=/usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/autocfg-1.1.0/target/debug/incremental -L dependency=/usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/autocfg-1.1.0/target/debug/deps`
    Building [                             ] 0/1: autocfg

I've waited overnight. Still no love.

Docker command is

docker run --rm -ti --platform linux/amd64 -v $(pwd):/workspace rust:1 bash

M1 Mac - v12.5 (21G72) Docker - v4.11.1 (84025)

cuviper commented 2 years ago

Hi - I don't have any Mac to try this myself, but if you're getting stuck merely compiling autocfg, not even running it, then this seems like an issue for the compiler. This is not using proc-macros or anything like that which might directly intrude on the compilation process, just plain Rust code -- not even any unsafe!

pms1969 commented 2 years ago

Hadn’t even thought to talk to the compiler team. I’ll give them a shout. other packages compile just fine tho, so it’s a bit odd that this (tiny no dependency lib) is the thing that breaks it. I’ll report back if I get an answer from the compiler team.

pms1969 commented 2 years ago

I did get this to work with a fresh image somehow. Can't remember quite how, but the whole rust compilation thing is a little off for me in containers right now, so I've got more playing to do before understanding what is wrong.