rust-lang / backtrace-rs

Backtraces in Rust
https://docs.rs/backtrace
Other
537 stars 246 forks source link

ARM cross compiling - GCC not found #435

Closed georgefst closed 3 years ago

georgefst commented 3 years ago

A tool chain update has meant that my gcc has changed names from arm-linux-gnueabihf-gcc to arm-none-linux-gnueabihf-gcc. This confuses this crate. I've been able to work around it with a symlink, or by setting TARGET_CC=arm-none-linux-gnueabihf-gcc, but neither of these were previously necessary.

error: failed to run custom build command for `backtrace-sys v0.1.32`

Caused by:
  process didn't exit successfully: `/home/gthomas/code/pi/target/release/build/backtrace-sys-e5e1ad9558e42a64/build-script-build` (exit status: 1)
  --- stdout
  cargo:rustc-cfg=rbt
  TARGET = Some("armv7-unknown-linux-gnueabihf")
  OPT_LEVEL = Some("3")
  HOST = Some("x86_64-unknown-linux-gnu")
  CC_armv7-unknown-linux-gnueabihf = None
  CC_armv7_unknown_linux_gnueabihf = None
  TARGET_CC = None
  CC = None
  CROSS_COMPILE = None
  CFLAGS_armv7-unknown-linux-gnueabihf = None
  CFLAGS_armv7_unknown_linux_gnueabihf = None
  TARGET_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = None
  running: "arm-linux-gnueabihf-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-march=armv7-a" "-I" "src/libbacktrace" "-I" "/home/gthomas/code/pi/target/armv7-unknown-linux-gnueabihf/release/build/backtrace-sys-fff9dfc23ffa452b/out" "-fvisibility=hidden" "-DBACKTRACE_ELF_SIZE=32" "-DBACKTRACE_SUPPORTED=1" "-DBACKTRACE_USES_MALLOC=1" "-DBACKTRACE_SUPPORTS_THREADS=0" "-DBACKTRACE_SUPPORTS_DATA=0" "-DHAVE_DL_ITERATE_PHDR=1" "-D_GNU_SOURCE=1" "-D_LARGE_FILES=1" "-Dbacktrace_full=__rbt_backtrace_full" "-Dbacktrace_dwarf_add=__rbt_backtrace_dwarf_add" "-Dbacktrace_initialize=__rbt_backtrace_initialize" "-Dbacktrace_pcinfo=__rbt_backtrace_pcinfo" "-Dbacktrace_syminfo=__rbt_backtrace_syminfo" "-Dbacktrace_get_view=__rbt_backtrace_get_view" "-Dbacktrace_release_view=__rbt_backtrace_release_view" "-Dbacktrace_alloc=__rbt_backtrace_alloc" "-Dbacktrace_free=__rbt_backtrace_free" "-Dbacktrace_vector_finish=__rbt_backtrace_vector_finish" "-Dbacktrace_vector_grow=__rbt_backtrace_vector_grow" "-Dbacktrace_vector_release=__rbt_backtrace_vector_release" "-Dbacktrace_close=__rbt_backtrace_close" "-Dbacktrace_open=__rbt_backtrace_open" "-Dbacktrace_print=__rbt_backtrace_print" "-Dbacktrace_simple=__rbt_backtrace_simple" "-Dbacktrace_qsort=__rbt_backtrace_qsort" "-Dbacktrace_create_state=__rbt_backtrace_create_state" "-Dbacktrace_uncompress_zdebug=__rbt_backtrace_uncompress_zdebug" "-Dmacho_get_view=__rbt_macho_get_view" "-Dmacho_symbol_type_relevant=__rbt_macho_symbol_type_relevant" "-Dmacho_get_commands=__rbt_macho_get_commands" "-Dmacho_try_dsym=__rbt_macho_try_dsym" "-Dmacho_try_dwarf=__rbt_macho_try_dwarf" "-Dmacho_get_addr_range=__rbt_macho_get_addr_range" "-Dmacho_get_uuid=__rbt_macho_get_uuid" "-Dmacho_add=__rbt_macho_add" "-Dmacho_add_symtab=__rbt_macho_add_symtab" "-Dmacho_file_to_host_u64=__rbt_macho_file_to_host_u64" "-Dmacho_file_to_host_u32=__rbt_macho_file_to_host_u32" "-Dmacho_file_to_host_u16=__rbt_macho_file_to_host_u16" "-o" "/home/gthomas/code/pi/target/armv7-unknown-linux-gnueabihf/release/build/backtrace-sys-fff9dfc23ffa452b/out/src/libbacktrace/alloc.o" "-c" "src/libbacktrace/alloc.c"

  --- stderr

  error occurred: Failed to find tool. Is `arm-linux-gnueabihf-gcc` installed?
bjorn3 commented 3 years ago

I think you need CC_armv7_unknown_linux_gnueabihf and not CC_TARGET.

Where did you get the toolchain from? Your linux distro? Maybe you could open an issue on the cc crate to update the c compiler auto-detect logic?

georgefst commented 3 years ago

I think you need CC_armv7_unknown_linux_gnueabihf and not CC_TARGET

I can confirm that also works. Thanks.

Where did you get the toolchain from? Your linux distro?

It's an official ARM binary distribution, via AUR.

Maybe you could open an issue on the cc crate to update the c compiler auto-detect logic?

Yes, that sounds like a good idea. Though to be honest, I don't think I know enough about what's going on there to really write up a useful bug report. I'm already out of my depth - I'm not even directly a user of backtrace-rs.

alexcrichton commented 3 years ago

Thanks for the report, but that crate no longer exists in this repository. You'll probably need to specify the compiler manually if you're using a nonstandard compiler or an older version of this crate.