Skip to content

Bootstrapping i686->i686 on x86_64 host fails in stage0 #36800

Description

@nagisa
$ python src/bootstrap/bootstrap.py --step rustc --stage 1 -j8 --target=i686-unknown-linux-gnu
    Finished debug [unoptimized + debuginfo] target(s) in 0.0 secs
Synchronizing submodule url for 'src/compiler-rt'
Synchronizing submodule url for 'src/jemalloc'
Synchronizing submodule url for 'src/liblibc'
Synchronizing submodule url for 'src/llvm'
Synchronizing submodule url for 'src/rt/hoedown'
Synchronizing submodule url for 'src/rust-installer'
HEAD is now at 8598065 Rust: fix MSVC-built lib pulling in other lib files
HEAD is now at e058ca6 Change how the default zone is found
HEAD is now at eb708c0 Auto merge of #402 - tmiasko:getaddrinfo-error-codes, r=alexcrichton
HEAD is now at a3736a0 Merge pull request #6 from intelfx/patch-1
HEAD is now at 755bc3d Merge pull request #48 from Diggsey/master
Building stage0 std artifacts (i686-unknown-linux-gnu -> i686-unknown-linux-gnu)
   Compiling compiler_builtins v0.0.0 (file:///home/nagisa/Documents/rust/rust/worktrees/more-cace/src/libcompiler_builtins)
   Compiling std v0.0.0 (file:///home/nagisa/Documents/rust/rust/worktrees/more-cace/src/libstd)
   Compiling std_shim v0.1.0 (file:///home/nagisa/Documents/rust/rust/worktrees/more-cace/src/rustc/std_shim)
    Finished release [optimized] target(s) in 15.57 secs
Building stage0 test artifacts (i686-unknown-linux-gnu -> i686-unknown-linux-gnu)
   Compiling term v0.0.0 (file:///home/nagisa/Documents/rust/rust/worktrees/more-cace/src/libterm)
   Compiling getopts v0.0.0 (file:///home/nagisa/Documents/rust/rust/worktrees/more-cace/src/libgetopts)
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m32" "-L" "/home/nagisa/Documents/rust/rust/worktrees/more-cace/build/i686-unknown-linux-gnu/stage0-sysroot/lib/rustlib/i686-unknown-linux-gnu/lib" "/home/nagisa/Documents/rust/rust/worktrees/more-cace/build/i686-unknown-linux-gnu/stage0-test/i686-unknown-linux-gnu/release/deps/getopts-603f5ee4adfd7630.0.o" "/home/nagisa/Documents/rust/rust/worktrees/more-cace/build/i686-unknown-linux-gnu/stage0-test/i686-unknown-linux-gnu/release/deps/getopts-603f5ee4adfd7630.1.o" "/home/nagisa/Documents/rust/rust/worktrees/more-cace/build/i686-unknown-linux-gnu/stage0-test/i686-unknown-linux-gnu/release/deps/getopts-603f5ee4adfd7630.2.o" "/home/nagisa/Documents/rust/rust/worktrees/more-cace/build/i686-unknown-linux-gnu/stage0-test/i686-unknown-linux-gnu/release/deps/getopts-603f5ee4adfd7630.3.o" "-o" "/home/nagisa/Documents/rust/rust/worktrees/more-cace/build/i686-unknown-linux-gnu/stage0-test/i686-unknown-linux-gnu/release/deps/libgetopts-603f5ee4adfd7630.so" "/home/nagisa/Documents/rust/rust/worktrees/more-cace/build/i686-unknown-linux-gnu/stage0-test/i686-unknown-linux-gnu/release/deps/getopts-603f5ee4adfd7630.metadata.o" "-Wl,-O1" "-nodefaultlibs" "-L" "/home/nagisa/Documents/rust/rust/worktrees/more-cace/build/i686-unknown-linux-gnu/stage0-test/i686-unknown-linux-gnu/release/deps" "-L" "/home/nagisa/Documents/rust/rust/worktrees/more-cace/build/i686-unknown-linux-gnu/stage0-sysroot/lib/rustlib/i686-unknown-linux-gnu/lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "-L" "/home/nagisa/Documents/rust/rust/worktrees/more-cace/build/i686-unknown-linux-gnu/stage0-sysroot/lib/rustlib/i686-unknown-linux-gnu/lib" "-l" "std-015eff4399913833" "-l" "dl" "-l" "rt" "-l" "pthread" "-l" "gcc_s" "-l" "c" "-l" "m" "-l" "rt" "-l" "util" "-shared" "-Wl,-rpath,$ORIGIN/../lib" "-l" "compiler-rt"
  = note: /usr/bin/ld: /home/nagisa/Documents/rust/rust/worktrees/more-cace/build/i686-unknown-linux-gnu/stage0-sysroot/lib/rustlib/i686-unknown-linux-gnu/lib/libstd-015eff4399913833.so: __moddi3: invalid version 21 (max 0)
/home/nagisa/Documents/rust/rust/worktrees/more-cace/build/i686-unknown-linux-gnu/stage0-sysroot/lib/rustlib/i686-unknown-linux-gnu/lib/libstd-015eff4399913833.so: error adding symbols: Bad value
collect2: error: ld returned 1 exit status

Some manual bisection shows that it stared happening after rust_builtins PR got merged.

Removing a number of assembly specialisations for i386 makes stuff compile.

Activity

  1. alexcrichton commented on Sep 28, 2016

    @alexcrichton
    Member

    Interesting! I've never seen this error before:

    /usr/bin/ld: /.../libstd-015eff4399913833.so: __moddi3: invalid version 21 (max 0)
    

    I wonder if may be we're compiling compiler-rt incorrectly?

    cc @japaric

  2. japaric commented on Sep 28, 2016

    @japaric
    Contributor

    Removing a number of assembly specialisations for i386 makes stuff compile.

    Perhaps gcc-rs doesn't correctly handle assembly when TARGET=i386 and HOST=x86_64. Because this sounds like the assembly may be being turned into a 64-bit ELF or something like that? (I could be talking nonsense here)

    Some manual bisection shows that it stared happening after rust_builtins PR got merged.

    You mean #35021? We were already using gcc-rs before that landed. Perhaps I mis-copy-pasted some code from bootstrap?

    @nagisa This outcome is with rustbuild, right?

  3. nagisa commented on Sep 28, 2016

    @nagisa
    MemberAuthor

    You mean #35021?

    Yes

    This outcome is with rustbuild, right?

    Yes, as can clearly be seen from the command line invocation. Keep in mind that this bootstraps from i686 beta compiler (i.e. i686 -> i686).

    turned into a 64-bit ELF or something like that?

    Object files with failing functions were elf32-i386 and contain 32bit code, though I can’t say for sure if all that stayed intact after they got packed into some archive somewhere.

  4. japaric commented on Sep 28, 2016

    @japaric
    Contributor

    in stage0

    Ohhh, I think I know what's happening. Because the compiler still passes -lcompiler-rt in stage0 (more precisely, when building stage1 using stage0 compiler) but building std doesn't generate that artifact, we copy stage0 (the snapshot) libcompiler-rt.a into stage1 build artifacts. The logic for that is probably not correct for this case and we are using copying the 64-bit version of libcompiler-rt.a instead of the 32-bit version -- bootstrap should have downloaded a 32-bit version of stage0, right?

    Instead of tweaking that logic we could simply create an empty libcompiler-rt.a and place that in stage1 build artifacts when we build stage1 compiler (before stage1 std). That should also work.

  5. alexcrichton commented on Sep 28, 2016

    @alexcrichton
    Member

    Oh that makes sense. This'll also get fixed on master very soon when we update the bootstrap compiler.

  6. alexcrichton commented on Sep 29, 2016

    @alexcrichton
    Member

    Ok #36811 landed so I think this is closed now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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