tlink.x build error
Closed this issue · 4 comments
I get the error below when trying run on ubuntu. I'm not familiar enough with rust yet but it looks like "-Tlink.x" is being used as a command line argument twice for rust-lld. Commenting out the rustflags line in .cargo/config fixes this for me.
Compiling blue-pill-quickstart v0.1.0 (/home/zlewko/src/my-new-project/blue-pill-quickstart)
error: linking with `rust-lld` failed: exit code: 1
|
= note: "rust-lld" "-flavor" "gnu" "-L" "/home/zlewko/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/thumbv7m-none-eabi/lib" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.10l9keozr1azjxxb.rcgu.o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.1nnvqjw29kudhvn3.rcgu.o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.1qdwekv9om07jq89.rcgu.o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.1wqxsabd0q7gamlh.rcgu.o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.2ckemoq0z4sbznl9.rcgu.o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.2d3ro4mimji4gjot.rcgu.o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.2jvvr9y25t17tqu8.rcgu.o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.2ktiphgdj33f5dhp.rcgu.o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.2odvisrdwlwbncgw.rcgu.o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.2zau10m7ucn44pn4.rcgu.o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.3o97obryy241fwbl.rcgu.o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.4hlo6wom1hmssrw3.rcgu.o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.4l7jjzmb1yy8yvxp.rcgu.o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.5722xo7rjzr5sw89.rcgu.o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.5ebqcj5vu1lkcjus.rcgu.o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.64rwavbiml2ui7g.rcgu.o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.aigwtnjqxough0l.rcgu.o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.izjotxgugmodeed.rcgu.o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.onapcjauee2gk5n.rcgu.o" "-o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc" "--gc-sections" "-L" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps" "-L" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/debug/deps" "-L" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/build/cortex-m-9345be4a269acadb/out" "-L" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/build/cortex-m-rt-2b43955fa98b4ad0/out" "-L" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/build/cortex-m-semihosting-ab07e1b57173a6a5/out" "-L" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/build/stm32f103xx-hal-16832c351c2938ac/out" "-L" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/build/stm32f103xx-d3deb763bb715481/out" "-L" "/home/zlewko/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/thumbv7m-none-eabi/lib" "-Bstatic" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/libstm32f103xx_hal-75db98507f0321f8.rlib" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/libcast-a5321062713d01a4.rlib" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/libstm32f103xx-09e4d9d1fdff3e8e.rlib" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/libembedded_hal-aad34f8d9c33ffcf.rlib" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/libvoid-c89b4d8d5f4ffed8.rlib" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/libnb-115008accecdccaa.rlib" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/libcortex_m_rt-4d3998b9322d76f6.rlib" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/libr0-d9b5ebe20b659dec.rlib" "--start-group" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/libpanic_semihosting-48bd918cb6b7e64c.rlib" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/libcortex_m_semihosting-619a349c9ad4ce86.rlib" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/libcortex_m-3fdd2f688076ed68.rlib" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/libvolatile_register-237e033e63048848.rlib" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/libvcell-617ada1d0d900745.rlib" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/libbare_metal-d9e85f06fcdd0262.rlib" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/libaligned-24e16d16f1d52771.rlib" "/home/zlewko/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/thumbv7m-none-eabi/lib/libcore-bc99d396b91fe14a.rlib" "--end-group" "/home/zlewko/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/thumbv7m-none-eabi/lib/libcompiler_builtins-4b33c00e5bd54fa2.rlib" "-Tlink.x" "-Tlink.x" "-Bdynamic"
= note: rust-lld: error: /home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/build/stm32f103xx-hal-16832c351c2938ac/out/memory.x:4: region 'FLASH' already defined
>>> FLASH : ORIGIN = 0x08000000, LENGTH = 64K
>>> ^
error: aborting due to previous error
error: Could not compile `blue-pill-quickstart`.
Which version of ubuntu? Which rust toolchain? (Nightly or stable?) Did you cargo update?
You you have any other .cargo/config? I can't reproduce your issue.
I figured out what happened. I ran ALL the setup commands in README.md without really paying attention, so I accidentally created two copies of this project, one within a sub directory of the other. I got the error while trying to build the one nested inside the other, I didn't realize cargo would look for .cargo/config "up" on directory from where it was being run. I correctly setup the project and the problem went way.
Thanks. Sorry for the false issue.
No problem. Thanks for the explanation. Enjoy with your bluepill!