Skip to content

Possible Regression: Error: the current crate is indistinguishable from one of its dependencies #111349

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
spencerkohan opened this issue May 8, 2023 · 7 comments
Labels
C-bug Category: This is a bug. E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@spencerkohan
Copy link

I'm attempting to compile a crate which depends on inline_python.

The crate is compiled in the context of this docker file:

# syntax=docker/dockerfile:1
FROM pytorch/pytorch:2.0.0-cuda11.7-cudnn8-runtime

ENV TZ=Europe/Berlin
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

# Install dependencies
RUN apt-get update && \
    apt-get install -y curl unzip sudo build-essential libssl-dev pkg-config git && \
    rm -rf /var/lib/apt/lists/*

# Install Rust & Cargo
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain nightly && \
    echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.bashrc && \
    . ~/.bashrc && \
    rustup update


# Update PATH to include Cargo
ENV PATH="/root/.cargo/bin:$PATH"

WORKDIR /app
COPY ./app /app

RUN cd /app && cargo clean
RUN rm -rf ~/.cargo/registry/

# Fetch and build in separate steps, so that the fetch step can be cached
RUN cd /app && cargo fetch
RUN cd /app && cargo build
...

This fails on the cargo build step with the following error:

#28 280.5    Compiling inline-python v0.10.0
#28 280.6 <jemalloc>: MADV_DONTNEED does not work (memset will be used instead)
#28 280.6 <jemalloc>: (This is the expected behaviour if you are running under QEMU)
#28 280.9 error[E0519]: the current crate is indistinguishable from one of its dependencies: it has the same crate-name `inline_python_macros` and was compiled with the same `-C metadata` arguments. This will result in symbol conflicts between the two.
#28 280.9    --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/inline-python-0.10.0/src/lib.rs:138:9
#28 280.9     |
#28 280.9 138 | pub use inline_python_macros::python;
#28 280.9     |         ^^^^^^^^^^^^^^^^^^^^
#28 280.9 
#28 281.5 For more information about this error, try `rustc --explain E0519`.
#28 281.5 error: could not compile `inline-python` (lib) due to previous error
#28 281.5 warning: build failed, waiting for other jobs to finish...
#28 ERROR: executor failed running [/bin/sh -c cd /app/sd_worker && cargo build]: exit code: 101
------
 > [20/21] RUN cd /app && cargo build:
------
executor failed running [/bin/sh -c cd /app && cargo build]: exit code: 101

This docker-file previously built successfully, a few days ago, and all that changed was the base image.

The relevant dependency looks like this:

[dependencies]
inline-python = "0.10"

I believe it might be a regression in nightly, since nothing should have changed which would make this suddenly start failing.

@Noratrieb
Copy link
Member

Can you use cargo-bisect-rustc to bisect it? That would be very useful.

@Noratrieb Noratrieb added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc labels May 8, 2023
@m-ou-se
Copy link
Member

m-ou-se commented May 8, 2023

I can't reproduce this on the latest nightly. Can you post the exact rustc version and your dependency tree?

@m-ou-se
Copy link
Member

m-ou-se commented May 8, 2023

This might be related to #110460. In that issue, after 660c966, the E0519 error seems to point at the wrong crate.

@m-ou-se
Copy link
Member

m-ou-se commented May 8, 2023

The latest PR that relates to E0519 seems to be #109213

@marmeladema
Copy link
Contributor

marmeladema commented May 9, 2023

I am facing the same issue on Linux after a fresh rustup update:

$ cargo +nightly --version
cargo 1.71.0-nightly (569b648b5 2023-05-05)
$ rustc +nightly --version
rustc 1.71.0-nightly (2f2c438dc 2023-05-08)

I can reproduce it consistently when setting a RUSTFLAGS environment variable to build with address sanitizer:

RUSTFLAGS="-Zsanitizer=address" cargo +nightly build

Without RUSTFLAGS, everything is building just fine.

Also note that the errors can be triggered from different dependencies:

error[E0519]: the current crate is indistinguishable from one of its dependencies: it has the same crate-name `thiserror_impl` and was compiled with the same `-C metadata` arguments. This will result in symbol conflicts between the two.                  
   --> /home/adema/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thiserror-1.0.40/src/lib.rs:246:9
    |
246 | pub use thiserror_impl::*;
    |         ^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0519`.
error: could not compile `thiserror` (lib) due to previous error
warning: build failed, waiting for other jobs to finish...
error[E0519]: the current crate is indistinguishable from one of its dependencies: it has the same crate-name `zeroize_derive` and was compiled with the same `-C metadata` arguments. This will result in symbol conflicts between the two.
   --> /home/adema/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zeroize-1.6.0/src/lib.rs:246:9
    |
246 | pub use zeroize_derive::{Zeroize, ZeroizeOnDrop};
    |         ^^^^^^^^^^^^^^

error[E0432]: unresolved import `crate::Zeroize`
 --> /home/adema/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zeroize-1.6.0/src/x86.rs:3:43
  |
3 | use crate::{atomic_fence, volatile_write, Zeroize};
  |                                           ^^^^^^^

Some errors have detailed explanations: E0432, E0519.
For more information about an error, try `rustc --explain E0432`.
error: could not compile `zeroize` (lib) due to 2 previous errors

EDIT:
It works just fine when specifying the target:

RUSTFLAGS="-Zsanitizer=address" cargo +nightly build --target  x86_64-unknown-linux-gnu

@m-ou-se
Copy link
Member

m-ou-se commented May 9, 2023

build with address sanitizer

In that case this seems to be a duplicate of: #111284

@tgross35
Copy link
Contributor

@spencerkohan can you reproduce this with the latest stable Rust? This may have been fixed in #111461

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-bug Category: This is a bug. E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants