Closed v-thakkar closed 6 years ago
libcore can be compiled if x.py dist is succeed. I guess some crate is needed for this task.
There are two use cases:
rustc
directlyI'm writing here because it's a most basic issue.
Here's my first attempt of run-make
which doesn't succeeds:
run-make/thumb-none-cortex-m/Makefile:
# warning: copy and paste ruined tab char!
-include ../../run-make-fulldeps/tools.mk
ifeq ($(TARGET),thumbv7m-none-eabi)
all:
env > env.txt
rm -rf cortex-m
$(CARGO) clone cortex-m --vers 0.5.0 && cd cortex-m
$(CARGO) build --target $(TARGET)
else
all:
endif
log and env.txt:
At this attempt, I tried to mimic the following cargo
use case:
In env.txt
included in the gist, you can see environment variables you can use.
https://gist.github.com/sekineh/a9e56bb523b071619c9f2b98e5d24d2f#file-env-txt
$(CARGO) is available but it's stage0.
sekineh@sekineh-VirtualBox:~/rustme7$ grep CARGO src/test/run-make/thumb-none-cortex-m/env.txt
CARGO=/home/sekineh/rustme7/build/x86_64-unknown-linux-gnu/stage0/bin/cargo
stage2 $(RUSTC) is available:
RUSTC=LD_LIBRARY_PATH="/home/sekineh/rustme7/build/x86_64-unknown-linux-gnu/test/run-make/thumb-none-cortex-m/thumb-none-cortex-m:/home/sekineh/rustme7/build/x86_64-unknown-linux-gnu/stage2/lib:/home/sekineh/rustme7/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/home/sekineh/rustme7/build/x86_64-unknown-linux-gnu/stage0/lib:" '/home/sekineh/rustme7/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /home/sekineh/rustme7/build/x86_64-unknown-linux-gnu/test/run-make/thumb-none-cortex-m/thumb-none-cortex-m -L /home/sekineh/rustme7/build/x86_64-unknown-linux-gnu/test/run-make/thumb-none-cortex-m/thumb-none-cortex-m -Clinker=arm-none-eabi-gcc
cargo build
performs for cortex-m
:(win 10; workaround "Failed to find tool. Is `ar` installed?" error by providing `env`)
$ cargo clean
$ env AR_thumbv7m-none-eabi=arm-none-eabi-ar cargo build --target thumbv7m-none-eabi -v 2>&1 | tee build_thumbv7m-none-eabi.txt
Compiling cc v1.0.18
Compiling vcell v0.1.0
Compiling aligned v0.2.0
Compiling bare-metal v0.2.0
Running `rustc --crate-name cc 'C:\Users\sekineh\.cargo\registry\src\github.com-1ecc6299db9ec823\cc-1.0.18\src\lib.rs' --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=9126dee9eaeb69ac -C extra-filename=-9126dee9eaeb69ac --out-dir 'C:\Users\sekineh\src\cortex-m\target\debug\deps' -L 'dependency=C:\Users\sekineh\src\cortex-m\target\debug\deps' --cap-lints allow`
Running `rustc --crate-name vcell 'C:\Users\sekineh\.cargo\registry\src\github.com-1ecc6299db9ec823\vcell-0.1.0\src\lib.rs' --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=855f0aa10a27024c -C extra-filename=-855f0aa10a27024c --out-dir 'C:\Users\sekineh\src\cortex-m\target\thumbv7m-none-eabi\debug\deps' --target thumbv7m-none-eabi -C ar=arm-none-eabi-ar -C linker=arm-none-eabi-gcc -L 'dependency=C:\Users\sekineh\src\cortex-m\target\thumbv7m-none-eabi\debug\deps' -L 'dependency=C:\Users\sekineh\src\cortex-m\target\debug\deps' --cap-lints allow`
Running `rustc --crate-name aligned 'C:\Users\sekineh\.cargo\registry\src\github.com-1ecc6299db9ec823\aligned-0.2.0\src\lib.rs' --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=bc95f696e48c7520 -C extra-filename=-bc95f696e48c7520 --out-dir 'C:\Users\sekineh\src\cortex-m\target\thumbv7m-none-eabi\debug\deps' --target thumbv7m-none-eabi -C ar=arm-none-eabi-ar -C linker=arm-none-eabi-gcc -L 'dependency=C:\Users\sekineh\src\cortex-m\target\thumbv7m-none-eabi\debug\deps' -L 'dependency=C:\Users\sekineh\src\cortex-m\target\debug\deps' --cap-lints allow`
Running `rustc --crate-name bare_metal 'C:\Users\sekineh\.cargo\registry\src\github.com-1ecc6299db9ec823\bare-metal-0.2.0\src\lib.rs' --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=78f17c947b880b5f -C extra-filename=-78f17c947b880b5f --out-dir 'C:\Users\sekineh\src\cortex-m\target\thumbv7m-none-eabi\debug\deps' --target thumbv7m-none-eabi -C ar=arm-none-eabi-ar -C linker=arm-none-eabi-gcc -L 'dependency=C:\Users\sekineh\src\cortex-m\target\thumbv7m-none-eabi\debug\deps' -L 'dependency=C:\Users\sekineh\src\cortex-m\target\debug\deps' --cap-lints allow`
Compiling volatile-register v0.2.0
Running `rustc --crate-name volatile_register 'C:\Users\sekineh\.cargo\registry\src\github.com-1ecc6299db9ec823\volatile-register-0.2.0\src\lib.rs' --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=709a9f73a0e4731c -C extra-filename=-709a9f73a0e4731c --out-dir 'C:\Users\sekineh\src\cortex-m\target\thumbv7m-none-eabi\debug\deps' --target thumbv7m-none-eabi -C ar=arm-none-eabi-ar -C linker=arm-none-eabi-gcc -L 'dependency=C:\Users\sekineh\src\cortex-m\target\thumbv7m-none-eabi\debug\deps' -L 'dependency=C:\Users\sekineh\src\cortex-m\target\debug\deps' --extern 'vcell=C:\Users\sekineh\src\cortex-m\target\thumbv7m-none-eabi\debug\deps\libvcell-855f0aa10a27024c.rlib' --cap-lints allow`
Compiling cortex-m v0.5.2 (file:///C:/Users/sekineh/src/cortex-m)
Running `rustc --crate-name build_script_build build.rs --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=a4a6f0362a5801fc -C extra-filename=-a4a6f0362a5801fc --out-dir 'C:\Users\sekineh\src\cortex-m\target\debug\build\cortex-m-a4a6f0362a5801fc' -C 'incremental=C:\Users\sekineh\src\cortex-m\target\debug\incremental' -L 'dependency=C:\Users\sekineh\src\cortex-m\target\debug\deps' --extern 'cc=C:\Users\sekineh\src\cortex-m\target\debug\deps\libcc-9126dee9eaeb69ac.rlib'`
Running `C:\Users\sekineh\src\cortex-m\target\debug\build\cortex-m-a4a6f0362a5801fc\build-script-build`
Running `rustc --crate-name cortex_m 'src\lib.rs' --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=4556fb5e068fee24 -C extra-filename=-4556fb5e068fee24 --out-dir 'C:\Users\sekineh\src\cortex-m\target\thumbv7m-none-eabi\debug\deps' --target thumbv7m-none-eabi -C ar=arm-none-eabi-ar -C linker=arm-none-eabi-gcc -C 'incremental=C:\Users\sekineh\src\cortex-m\target\thumbv7m-none-eabi\debug\incremental' -L 'dependency=C:\Users\sekineh\src\cortex-m\target\thumbv7m-none-eabi\debug\deps' -L 'dependency=C:\Users\sekineh\src\cortex-m\target\debug\deps' --extern 'aligned=C:\Users\sekineh\src\cortex-m\target\thumbv7m-none-eabi\debug\deps\libaligned-bc95f696e48c7520.rlib' --extern 'bare_metal=C:\Users\sekineh\src\cortex-m\target\thumbv7m-none-eabi\debug\deps\libbare_metal-78f17c947b880b5f.rlib' --extern 'volatile_register=C:\Users\sekineh\src\cortex-m\target\thumbv7m-none-eabi\debug\deps\libvolatile_register-709a9f73a0e4731c.rlib' -L 'native=C:\Users\sekineh\src\cortex-m\target\thumbv7m-none-eabi\debug\build\cortex-m-7198b41ea6872672\out' --cfg cortex_m --cfg armv7m -l static=asm`
Finished dev [unoptimized + debuginfo] target(s) in 3.77s
It's a library crate which is only suitable for it compiles
test.
Awesome job @sekineh! Am I understanding correctly that you were able to build the cortex-m
crate as a run-make
test?
Do you have your code pushed on github somewhere that I could look at?
Not yet!
The above run is obtained on my local win10 PC using beta-msvc toolchain. I’m now at day job where win10 is main PC. The cargo error I workaround is not the same as the error that made run-make fail.
Other useful info:
dry-run
option :-(We might want to change the ifeq
line to use logical or of 4 targets.
ifeq ($(TARGET),thumbv7m-none-eabi)
To do that, see:
By default make fails if one of the commands is failed. To ignore error, add '-' char in the begining of the command. Ex:
-rm -rf cortex-m
See:
@jamesmunns I have not created new branch yet. Currently, just experiments only.
cargo build
performs for cortex-m
:We can use this as a reference
Just opened the PR:
This issue is closed by the successful merge of
We aim to add tests which can successfully compile on $TARGET for the bunch of crates like libcore etc. We aim to add these tests no later than July 29, 2018. [Rust 1.28 ship date: 2nd August, 2018].