Skip to content

Compiling Debug builds fails with undefined reference to 'rust_begin_unwind'. #52

Closed
@cldershem

Description

@cldershem

I have been unable to get any of examples from Chapter 06, Hello World, on to compile in debug without modifying Cargo.toml.

$ xargo build --target thumbv7em-none-eabihf
Compiling usart v0.1.0 (file:///home/cldershem/Dev/LearningStuffs/LearnRust/DiscoveryBook/discovery/src/06-hello-world)
error: linking with `arm-none-eabi-gcc` failed: exit code: 1
  |
  = note: "arm-none-eabi-gcc" "-L" "/home/cldershem/.xargo/lib/rustlib/thumbv7em-none-eabihf/lib"
  //
  // lots of stuff omitted
  //
  = note: /home/cldershem/.xargo/lib/rustlib/thumbv7em-none-eabihf/lib/libcore-1e711822e5d5d922.rlib(core-1e711822e5d5d922.0.o): In function `co
    re::panicking::panic_fmt::hb7c1829b06bc1b3c':
          core.cgu-0.rs:(.text.cold._ZN4core9panicking9panic_fmt17hb7c1829b06bc1b3cE+0x24): undefined reference to `rust_begin_unwind'
          collect2: error: ld returned 1 exit status
error: aborting due to previous error
error: Could not compile `hello-world`.
To learn more, run the command again with --verbose.
$ uname -a && xargo --version && rustc --version
Linux cldershem-xps 4.10.0-35-generic #39-Ubuntu SMP Wed Sep 13 07:46:59 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
xargo 0.3.9
cargo 0.23.0-nightly (e447ac7e9 2017-09-27)
rustc 1.22.0-nightly (417c73891 2017-10-05)

Compiling with --release works fine. I can get it to compile in debug if I change the default opt-level in the Cargo.toml.

[profile.dev]
opt-level = 1

I cannot be sure if this is something specific to my setup or if it's an issue with a newer nightly. Any guidance on how to troubleshoot this issue will be appreciated.

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