After I successfully built rustc. how do I put together the artifacts?

I was trying to build thumbv7a-pc-windows-msvc target with rust/master, with a few local patches, e.g. no panic_abort instead of panic_unwind, I was able to build stage 0/1/2 locally without issue, this is the command I used,

c:\python27\python.exe x.py build --host x86_64-pc-windows-msvc --build x86_64-pc-windows-msvc --target thumbv7a-pc-windows-msvc

After the build, I copied cargo from stage0\bin into stage1\bin, then copied everything from stage2 into stage1 and overwrote everything with same name, then I used cargo and rustc from stage1 as the toolchain, to build my own thumbv7a projects, so far so good, however, I got error complaining about unresolved external symbols like below. I checked the symbol is from rust\liballoc\collections\btree\node.js, it should be available in my local toolchain I just built, unless I made mistake when I merged artifacts from all stages.

libstd-67da064321eabc9f.rlib(std-67da064321eabc9f.std.38mh430v-cgu.5.rcgu.o) : error LNK2019: unresolved external symbol __imp__ZN5alloc11collections5btree4node15EMPTY_ROOT_NODE17h486b4088caeaa846E referenced in function _ZN3std3sys7windows7process7Command3new17hc990fb56302414eaE
          libstd-67da064321eabc9f.rlib(std-67da064321eabc9f.std.38mh430v-cgu.12.rcgu.o) : error LNK2001: unresolved external symbol __imp__ZN5alloc11collections5btree4node15EMPTY_ROOT_NODE17h486b4088caeaa846E
          libstd-67da064321eabc9f.rlib(std-67da064321eabc9f.std.38mh430v-cgu.14.rcgu.o) : error LNK2001: unresolved external symbol __imp__ZN5alloc11collections5btree4node15EMPTY_ROOT_NODE17h486b4088caeaa846E
          libstd-67da064321eabc9f.rlib(std-67da064321eabc9f.std.38mh430v-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol __imp__ZN5alloc11collections5btree4node15EMPTY_ROOT_NODE17h486b4088caeaa846E
          D:\git\iotedge\edgelet\target\thumbv7a-pc-windows-msvc\release\deps\iotedged_eventlog_messages.dll : fatal error LNK1120: 1 unresolved externals

According to how to build and run, should I use stage2\bin\rustc.exe along with all artifacts from stage1, instead of overwriting everything in stage1 (by stage2)?

This stage2/bin/rustc compiler is shipped to end-users, along with the stage 1 {std,test,rustc} artifacts.

It may, or may not help, but you can register a custom rustup toolchain:

rustup toolchain link stage1 /home/matklad/projects/rust-misc/build/x86_64-unknown-linux-gnu/stage1/

I’ve actually asked similar question couple times now on rust irc, with no answer, so I’ll try here since this helpfully just popped up!

When i build the stage2, e.g., ./x.py build --target=some-target, my build/stage2/lib/rustlib/host-target/lib/ is empty (except for a single lonely libLLVM); do I have to do something special to populate it?

If I use rustup toolchain link to use cargo so i can mess around with the compiler and stdlibs i built, attempting to build rustup default stage2; cargo build --target=some-target, e.g., proc macros (which use the host stdlib I should have built, but which is empty), won’t be found. Am I doing something wrong here? I don’t understand the point of rustup link if the rest of the host libs aren’t built in stage2, and so I can’t build real cargo project with my compiler.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.