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

x.py build --stage 1 src/rustc --host=$HOST cross compiles rustc two times #38039

Closed
japaric opened this issue Nov 27, 2016 · 4 comments
Closed
Labels
T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@japaric
Copy link
Member

japaric commented Nov 27, 2016

(In this example BUILD = x86_64-unknown-linux-gnu and HOST=arm-unknown-linux-gnueabi)

$ x.py build --stage 1 src/rustc --host=$HOST
Building stage0 std artifacts (x86_64-unknown-linux-gnu -> arm-unknown-linux-gnueabi)
(..)
Building stage0 test artifacts (x86_64-unknown-linux-gnu -> arm-unknown-linux-gnueabi)
(..)
Building stage0 compiler artifacts (x86_64-unknown-linux-gnu -> arm-unknown-linux-gnueabi)
(..)
Building stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
(..)
Building stage0 test artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
(..)
Building stage0 compiler artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
(..)
Building stage1 std artifacts (x86_64-unknown-linux-gnu -> arm-unknown-linux-gnueabi)
(..)
Building stage1 test artifacts (x86_64-unknown-linux-gnu -> arm-unknown-linux-gnueabi)
(..)
Building stage1 compiler artifacts (x86_64-unknown-linux-gnu -> arm-unknown-linux-gnueabi)
(..)

This part:

Building stage0 std artifacts (x86_64-unknown-linux-gnu -> arm-unknown-linux-gnueabi)
(..)
Building stage0 test artifacts (x86_64-unknown-linux-gnu -> arm-unknown-linux-gnueabi)
(..)
Building stage0 compiler artifacts (x86_64-unknown-linux-gnu -> arm-unknown-linux-gnueabi)
(..)

seems unnecessary as that compiler won't be used in the bootstrap (in fact, it can be executed by the build machine due to the differences in architectures) and it's not the requested rustc either.

cc @alexcrichton

@japaric japaric added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Nov 27, 2016
@japaric
Copy link
Member Author

japaric commented Nov 27, 2016

Also it seems the wrong rustc is being copied into the output directory:

$ diff -u \
    ./build/arm-unknown-linux-gnueabi/stage1/bin/rustc \
    ./build/x86_64-unknown-linux-gnu/stage0-rustc/arm-unknown-linux-gnueabi/release/rustc && \
    echo SAME
SAME

$ diff -u \
    ./build/arm-unknown-linux-gnueabi/stage1/bin/rustc \
    ./build/x86_64-unknown-linux-gnu/stage1-rustc/arm-unknown-linux-gnueabi/release/rustc && \
    echo SAME
Binary files ./build/arm-unknown-linux-gnueabi/stage1/bin/rustc and ./build/x86_64-unknown-linux-gnu/stage1-rustc/arm-unknown-linux-gnueabi/release/rustc differ

build/$HOST/stage1/bin/rustc should be build/$BUILD/stage1-rustc/$HOST/release/rustc not stage0-rustc, right?

@alexcrichton
Copy link
Member

Hm ok some of this is expected, some of this isn't expected. I can't seem to quite make sense of your original logs, though. Are you sure that x.py build --stage 1 src/rustc --host=$HOST was executed exactly to produce that trace? I unfortunately can't seem to reconstruct the sequence of events on master that'd lead to that.

@japaric
Copy link
Member Author

japaric commented Nov 28, 2016

@alexcrichton repro as a shell script

# Ubuntu 16.04
# SRC_DIR is the rust-lang/rust source

main() {
    ARCH=armel
    BUILD=x86_64-unknown-linux-gnu
    HOST=arm-unknown-linux-gnueabi
    PREFIX=arm-linux-gnueabi

   sudo apt-get install -y --no-install-recommends \
        g++-$PREFIX libc6-dev-$ARCH-cross

   $SRC_DIR/configure \
       --enable-ccache \
       --enable-ninja \
       --enable-rustbuild \
       --host=$HOST

   # work around rust-lang/rust#38037
   nice $SRC_DIR/x.py build --stage 1 src/llvm --host=$BUILD

   # STDOUT
   # Building LLVM for x86_64-unknown-linux-gnu

   nice $SRC_DIR/x.py build --stage 1 src/rustc --host=$HOST

   # STDOUT
   # Building stage0 std artifacts (x86_64-unknown-linux-gnu -> arm-unknown-linux-gnueabi)
   # Building stage0 test artifacts (x86_64-unknown-linux-gnu -> arm-unknown-linux-gnueabi)
   # Building LLVM for arm-unknown-linux-gnueabi
   # Building stage0 compiler artifacts (x86_64-unknown-linux-gnu -> arm-unknown-linux-gnueabi)
   # Building stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
   # Building stage0 test artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
   # Building stage0 compiler artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
   # Building stage1 std artifacts (x86_64-unknown-linux-gnu -> arm-unknown-linux-gnueabi)
   # Building stage1 test artifacts (x86_64-unknown-linux-gnu -> arm-unknown-linux-gnueabi)
   # Building stage1 compiler artifacts (x86_64-unknown-linux-gnu -> arm-unknown-linux-gnueabi)
}

main

Meta

$ git rev-parse HEAD
0b399e5e99a44cf44d3860d353a8b7619d466410

alexcrichton added a commit to alexcrichton/rust that referenced this issue Nov 29, 2016
The `src/rustc` path is intended for assembling a compiler (e.g. the bare bones)
not actually compiling the whole compiler itself. This path was accidentally
getting hijacked to represent the whole compiler being compiled, so let's
redirect that elsewhere for that particular cargo project.

Closes rust-lang#38039
@alexcrichton
Copy link
Member

Ok addressed in #38076 (this path redirected to the wrong step) but it'll need #37817 as well to be maximally effective.

bors added a commit that referenced this issue Dec 8, 2016
rustbuild: Use src/rustc for assembled compilers

The `src/rustc` path is intended for assembling a compiler (e.g. the bare bones)
not actually compiling the whole compiler itself. This path was accidentally
getting hijacked to represent the whole compiler being compiled, so let's
redirect that elsewhere for that particular cargo project.

Closes #38039
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

No branches or pull requests

2 participants