Giter Site home page Giter Site logo

backtrace-rs's Introduction

backtrace-rs

Documentation

A library for acquiring backtraces at runtime for Rust. This library aims to enhance the support of the standard library by providing a programmatic interface to work with, but it also supports simply easily printing the current backtrace like libstd's panics.

Install

[dependencies]
backtrace = "0.3"

Usage

To simply capture a backtrace and defer dealing with it until a later time, you can use the top-level Backtrace type.

use backtrace::Backtrace;

fn main() {
    let bt = Backtrace::new();

    // do_some_work();

    println!("{bt:?}");
}

If, however, you'd like more raw access to the actual tracing functionality, you can use the trace and resolve functions directly.

fn main() {
    backtrace::trace(|frame| {
        let ip = frame.ip();
        let symbol_address = frame.symbol_address();

        // Resolve this instruction pointer to a symbol name
        backtrace::resolve_frame(frame, |symbol| {
            if let Some(name) = symbol.name() {
                // ...
            }
            if let Some(filename) = symbol.filename() {
                // ...
            }
        });

        true // keep going to the next frame
    });
}

Supported Rust Versions

The backtrace crate is a core component of the standard library, and must at times keep up with the evolution of various platforms in order to serve the standard library's needs. This often means using recent libraries that provide unwinding and symbolication for various platforms. Thus backtrace is likely to use recent Rust features or depend on a library which itself uses them. Its minimum supported Rust version, by policy, is within a few versions of current stable, approximately "stable - 2".

This policy takes precedence over versions written anywhere else in this repo.

License

This project is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in backtrace-rs by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

backtrace-rs's People

Contributors

aaron1011 avatar alexcrichton avatar amanieu avatar azriel91 avatar chrisdenton avatar cramertj avatar cuviper avatar detly avatar fitzgen avatar jchlapinski avatar johntitor avatar keruspe avatar khuey avatar king6cong avatar klensy avatar kobzol avatar leo60228 avatar masonremaley avatar mitsuhiko avatar mzohreva avatar nielx avatar nyurik avatar philipc avatar ralfjung avatar saethlin avatar sfackler avatar tomcc avatar uweigand avatar wesleywiser avatar workingjubilee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

backtrace-rs's Issues

Failed iOS app review linked back to usage of this crate

So I recently failed ( a few times until I figured it out ) app review for iOS. I traced the failure back to an indirect dependency on this crate ( through failure ).

Your app uses or references the following non-public APIs:

PrivateFrameworks/CoreSymbolication.framework (_CSSourceInfoGetLineNumber), PrivateFrameworks/CoreSymbolication.framework (_CSSourceInfoGetSymbol), PrivateFrameworks/CoreSymbolication.framework (_CSSymbolGetName), PrivateFrameworks/CoreSymbolication.framework (_CSRelease), PrivateFrameworks/CoreSymbolication.framework (_CSSourceInfoGetPath), PrivateFrameworks/CoreSymbolication.framework (_CSSymbolicatorGetSourceInfoWithAddressAtTime), PrivateFrameworks/CoreSymbolication.framework (_CSSymbolicatorGetSymbolWithAddressAtTime), PrivateFrameworks/CoreSymbolication.framework (_CSSymbolOwnerGetBaseAddress), PrivateFrameworks/CoreSymbolication.framework (_CSSymbolicatorCreateWithPid), PrivateFrameworks/CoreSymbolication.framework (_CSSymbolGetSymbolOwner)

The use of non-public APIs is not permitted on the App Store because it can lead to a poor user experience should these APIs change.

Continuing to use or conceal non-public APIs in future submissions of this app may result in the termination of your Apple Developer account, as well as removal of all associated apps from the App Store.

To resolve this quickly I forked this crate and resolve the above issue by forcibly disabling CoreSymbolication: mehcode@8990d86

I'm not sure how to resolve this nicely upstream so iOS developers don't have this nasty landmine when publishing.

I saw a commit that switches to "dynamic linking" to hide the dependency on CoreSymbolication. Two issues with that (at least on iOS):

  • System/Library/PrivateFrameworks/CoreSymbolication.framework is still in the binary
  • Symbols are still present like CSSymbolGetName. Apple review checks for symbol presence so even if your function had nothing in common with the private framework, those symbol names effectively banned.

I don't see a nice way to resolve this. I'd personally like to throw out usage of CoreSymbolication either completely or at least when not compiled for debug.

Cross-compile for androideabi (linux host!)

different from #44

aep@stark: ~/kram/backtrace-rs cargo rustc  --target arm-linux-androideabi    --   -C linker=/home/aep/android/build/android-18-toolchain/bin/arm-linux-androideabi-clang

    Updating registry `https://github.com/rust-lang/crates.io-index`
   Compiling libc v0.2.26
   Compiling rustc-demangle v0.1.4
   Compiling gcc v0.3.51
   Compiling cfg-if v0.1.2
   Compiling backtrace-sys v0.1.12 (file:///home/aep/kram/backtrace-rs/backtrace-sys)
error: failed to run custom build command for `backtrace-sys v0.1.12 (file:///home/aep/kram/backtrace-rs/backtrace-sys)`
process didn't exit successfully: `/home/aep/kram/backtrace-rs/target/debug/build/backtrace-sys-c8941b55014412f0/build-script-build` (exit code: 101)
--- stdout
OPT_LEVEL = Some("0")
TARGET = Some("arm-linux-androideabi")
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("arm-linux-androideabi")
TARGET = Some("arm-linux-androideabi")
HOST = Some("x86_64-unknown-linux-gnu")
CC_arm-linux-androideabi = None
CC_arm_linux_androideabi = None
TARGET_CC = None
CC = None
TARGET = Some("arm-linux-androideabi")
HOST = Some("x86_64-unknown-linux-gnu")
CFLAGS_arm-linux-androideabi = None
CFLAGS_arm_linux_androideabi = None
TARGET_CFLAGS = None
CFLAGS = None
PROFILE = Some("debug")
running: "sh" "/home/aep/kram/backtrace-rs/backtrace-sys/src/libbacktrace/configure" "--with-pic" "--disable-multilib" "--disable-shared" "--disable-host-shared" "--host=arm-linux-androideabi" "--build=x86_64-unknown-linux-gnu"
checking build system type... x86_64-unknown-linux-gnu
checking host system type... arm-unknown-linux-androideabi
checking target system type... arm-unknown-linux-androideabi
checking for arm-linux-androideabi-gcc... arm-linux-androideabi-gcc
checking for C compiler default output file name... 

--- stderr
configure: error: in `/home/aep/kram/backtrace-rs/target/arm-linux-androideabi/debug/build/backtrace-sys-e9614a5f38c40b50/out':
configure: error: C compiler cannot create executables
See `config.log' for more details.
thread 'main' panicked at 'failed with: exit code: 77', backtrace-sys/build.rs:169
note: Run with `RUST_BACKTRACE=1` for a backtrace.


'assertion failed: sym - actual_fn_pointer < 1024'

	thread 'smoke_test_frames' panicked at 'assertion failed: sym - actual_fn_pointer < 1024', tests/smoke.rs:74:12

Not sure how to debug it, I'm running Fedora 28 x86_64 with rustc 1.22.1 and cargo 0.23.0.

Cross-compile for armv7-unknown-linux-gnueabihf target fails

error: failed to run custom build command for backtrace-sys v0.1.10process didn't exit successfully:/home/chessnokov/workspace/volter/target/release/build/backtrace-sys-3989d5c503a9238f/build-script-build` (exit code: 101)
--- stdout
OPT_LEVEL = Some("3")
TARGET = Some("armv7-unknown-linux-gnueabihf")
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("armv7-unknown-linux-gnueabihf")
TARGET = Some("armv7-unknown-linux-gnueabihf")
HOST = Some("x86_64-unknown-linux-gnu")
CC_armv7-unknown-linux-gnueabihf = None
CC_armv7_unknown_linux_gnueabihf = None
TARGET_CC = None
CC = Some("arm-linux-gnu-gcc")
TARGET = Some("armv7-unknown-linux-gnueabihf")
HOST = Some("x86_64-unknown-linux-gnu")
CFLAGS_armv7-unknown-linux-gnueabihf = None
CFLAGS_armv7_unknown_linux_gnueabihf = None
TARGET_CFLAGS = None
CFLAGS = None
PROFILE = Some("release")
running: "/home/chessnokov/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.10/src/libbacktrace/configure" "--with-pic" "--disable-multilib" "--disable-shared" "--disable-host-shared" "--target=armv7-unknown-linux-gnueabihf" "--host=x86_64-unknown-linux-gnu"
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... armv7-unknown-linux-gnueabihf
checking for x86_64-unknown-linux-gnu-gcc... arm-linux-gnu-gcc
checking for C compiler default output file name...

--- stderr
configure: WARNING: If you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used.
configure: error: in /home/chessnokov/workspace/volter/target/armv7-unknown-linux-gnueabihf/release/build/backtrace-sys-c41044212322c9f2/out': configure: error: C compiler cannot create executables See config.log' for more details.
thread 'main' panicked at 'failed with: exit code: 77', /home/chessnokov/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.10/build.rs:134
note: Run with RUST_BACKTRACE=1 for a backtrace.
`

Cross-compile for androideabi on -msvc target fails

error: failed to run custom build command for `backtrace-sys v0.1.10`
process didn't exit successfully: `...target\debug\build\backtrace-sys-0c4d13204b0e1510\build
-script-build` (exit code: 101)
--- stdout
OPT_LEVEL = Some("0")
TARGET = Some("armv7-linux-androideabi")
HOST = Some("x86_64-pc-windows-msvc")
TARGET = Some("armv7-linux-androideabi")
TARGET = Some("armv7-linux-androideabi")
HOST = Some("x86_64-pc-windows-msvc")
CC_armv7-linux-androideabi = None
CC_armv7_linux_androideabi = None
TARGET_CC = None
CC = None
TARGET = Some("armv7-linux-androideabi")
HOST = Some("x86_64-pc-windows-msvc")
CFLAGS_armv7-linux-androideabi = None
CFLAGS_armv7_linux_androideabi = None
TARGET_CFLAGS = None
CFLAGS = None
PROFILE = Some("debug")
running: "...\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\backtrace-sys-0.1.10\\src/libbacktrace/c
onfigure" "--with-pic" "--disable-multilib" "--disable-shared" "--disable-host-shared" "--target=armv7-linux-androideabi
" "--host=x86_64-pc-windows-msvc"

--- stderr
thread 'main' panicked at 'failed to get status: %1 is not a valid Win32 application. (os error 193)', ...\.c
argo\registry\src\github.com-1ecc6299db9ec823\backtrace-sys-0.1.10\build.rs:131
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Hitting this with some JNI libraries, not quite sure what the fix is here but happy to take a shot at it if I could get some pointers.

Is `make` not installed?

While compiling my web app on FreeBsd 11:

  % ~/.cargo/bin/cargo build --release                 
     Compiling simplelog v0.4.4
     Compiling aho-corasick v0.6.4
     Compiling bytes v0.4.5
     Compiling futures-cpupool v0.1.7
     Compiling mio v0.6.11
     Compiling thread_local v0.3.5
     Compiling unicase v2.1.0
     Compiling backtrace-sys v0.1.16
  error: failed to run custom build command for `backtrace-sys v0.1.16`
  process didn't exit successfully: `/usr/home/my_user/my_web_app/target/release/build/backtrace-sys-04771ae6bd33bf45/build-script-build` (exit code: 101)
  --- stdout
  OPT_LEVEL = Some("3")
  TARGET = Some("x86_64-unknown-freebsd")
  HOST = Some("x86_64-unknown-freebsd")
  TARGET = Some("x86_64-unknown-freebsd")
  TARGET = Some("x86_64-unknown-freebsd")
  HOST = Some("x86_64-unknown-freebsd")
  CC_x86_64-unknown-freebsd = None
  CC_x86_64_unknown_freebsd = None
  HOST_CC = None
  CC = None
  HOST = Some("x86_64-unknown-freebsd")
  TARGET = Some("x86_64-unknown-freebsd")
  HOST = Some("x86_64-unknown-freebsd")
  CFLAGS_x86_64-unknown-freebsd = None
  CFLAGS_x86_64_unknown_freebsd = None
  HOST_CFLAGS = None
  CFLAGS = None
  DEBUG = Some("false")
  running: "sh" "/usr/home/my_user/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.16/src/libbacktrace/configure" "--with-pic" "--disable-multilib" "--disable-shared" "--disable-host-shared" "--host=x86_64-unknown-freebsd" "--build=x86_64-unknown-freebsd"
  checking build system type... x86_64-unknown-freebsd
  checking host system type... x86_64-unknown-freebsd
  checking target system type... x86_64-unknown-freebsd
  checking for x86_64-unknown-freebsd-gcc... cc
  checking for C compiler default output file name... a.out
  checking whether the C compiler works... yes
  checking whether we are cross compiling... no
  checking for suffix of executables... 
  checking for suffix of object files... o
  checking whether we are using the GNU C compiler... yes
  checking whether cc accepts -g... yes
  checking for cc option to accept ISO C89... none needed
  checking how to run the C preprocessor... cc -E
  checking for grep that handles long lines and -e... /usr/bin/grep
  checking for egrep... /usr/bin/grep -E
  checking for ANSI C header files... yes
  checking for sys/types.h... yes
  checking for sys/stat.h... yes
  checking for stdlib.h... yes
  checking for string.h... yes
  checking for memory.h... yes
  checking for strings.h... yes
  checking for inttypes.h... yes
  checking for stdint.h... yes
  checking for unistd.h... yes
  checking minix/config.h usability... no
  checking minix/config.h presence... no
  checking for minix/config.h... no
  checking whether it is safe to define __EXTENSIONS__... yes
  checking for a BSD-compatible install... /usr/bin/install -c
  checking whether build environment is sane... yes
  checking for a thread-safe mkdir -p... /usr/home/my_user/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.16/src/libbacktrace/install-sh -c -d
  checking for gawk... no
  checking for mawk... no
  checking for nawk... nawk
  checking whether make sets $(MAKE)... yes
  checking whether to enable maintainer-specific portions of Makefiles... no
  checking for x86_64-unknown-freebsd-gcc... (cached) cc
  checking whether we are using the GNU C compiler... (cached) yes
  checking whether cc accepts -g... (cached) yes
  checking for cc option to accept ISO C89... (cached) none needed
  checking for x86_64-unknown-freebsd-ranlib... ranlib
  checking for gawk... (cached) nawk
  checking how to print strings... printf
  checking for a sed that does not truncate output... /usr/bin/sed
  checking for fgrep... /usr/bin/grep -F
  checking for ld used by cc... /usr/bin/ld
  checking if the linker (/usr/bin/ld) is GNU ld... yes
  checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm
  checking the name lister (/usr/bin/nm) interface... BSD nm
  checking whether ln -s works... yes
  checking the maximum length of command line arguments... 196608
  checking whether the shell understands some XSI constructs... yes
  checking whether the shell understands "+="... no
  checking for /usr/bin/ld option to reload object files... -r
  checking for x86_64-unknown-freebsd-objdump... no
  checking for objdump... objdump
  checking how to recognize dependent libraries... pass_all
  checking for x86_64-unknown-freebsd-ar... ar
  checking for x86_64-unknown-freebsd-strip... no
  checking for strip... strip
  checking for x86_64-unknown-freebsd-ranlib... (cached) ranlib
  checking command to parse /usr/bin/nm output from cc object... ok
  checking for dlfcn.h... yes
  checking for objdir... .libs
  checking if cc supports -fno-rtti -fno-exceptions... yes
  checking for cc option to produce PIC... -fPIC -DPIC
  checking if cc PIC flag -fPIC -DPIC works... yes
  checking if cc static flag -static works... yes
  checking if cc supports -c -o file.o... yes
  checking if cc supports -c -o file.o... (cached) yes
  checking whether the cc linker (/usr/bin/ld) supports shared libraries... yes
  checking dynamic linker characteristics... freebsd ld.so
  checking how to hardcode library paths into programs... immediate
  checking whether stripping libraries is possible... no
  checking if libtool supports shared libraries... yes
  checking whether to build shared libraries... no
  checking whether to build static libraries... yes
  checking unwind.h usability... no
  checking unwind.h presence... no
  checking for unwind.h... no
  checking for -funwind-tables option... yes
  checking for -frandom-seed=string option... yes
  checking whether cc supports -W... yes
  checking whether cc supports -Wall... yes
  checking whether cc supports -Wwrite-strings... yes
  checking whether cc supports -Wstrict-prototypes... yes
  checking whether cc supports -Wmissing-prototypes... yes
  checking whether cc supports -Wold-style-definition... yes
  checking whether cc supports -Wmissing-format-attribute... yes
  checking whether cc supports -Wcast-qual... yes
  checking for _Unwind_GetIPInfo... no
  checking __sync extensions... yes
  checking __atomic extensions... yes
  checking output filetype... elf64
  looking for a compliant stdint.h in stdint.h, checking for uintmax_t... yes
  checking for uintptr_t... yes
  checking for int_least32_t... yes
  checking for int_fast32_t... yes
  checking for uint64_t... yes
  checking what to include in gstdint.h... stdint.h (already complete)
  checking sys/mman.h usability... yes
  checking sys/mman.h presence... yes
  checking for sys/mman.h... yes
  checking for mmap... yes
  checking link.h usability... yes
  checking link.h presence... yes
  checking for link.h... yes
  checking for dl_iterate_phdr... yes
  checking for fcntl... yes
  checking whether strnlen is declared... yes
  checking for getexecname... no
  checking whether tests can run... yes
  configure: creating ./config.status
  config.status: creating Makefile
  config.status: creating backtrace-supported.h
  config.status: creating config.h
  config.status: config.h is unchanged
  config.status: executing libtool commands
  config.status: executing gstdint.h commands
  config.status: executing default commands
  running: "gmake" "INCDIR=/usr/home/my_user/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.16/src/libbacktrace"

  --- stderr
  thread 'main' panicked at '

  failed to execute command: No such file or directory (os error 2)
  Is `make` not installed?

  ', /home/my_user/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.16/build.rs:168:12
  note: Run with `RUST_BACKTRACE=1` for a backtrace.

But

% which make
/usr/bin/make

Cannot build inside a Ubuntu 16 Docker container

Build failed, waiting for other jobs to finish...
error: failed to run custom build command for `backtrace-sys v0.1.6`
process didn't exit successfully: `/playground/target/debug/build/backtrace-sys-ee65290f711dd3dc/build-script-build` (exit code: 101)
--- stdout
OPT_LEVEL = Some("0")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
CC_x86_64-unknown-linux-gnu = None
CC_x86_64_unknown_linux_gnu = None
HOST_CC = None
CC = None
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
CFLAGS_x86_64-unknown-linux-gnu = None
CFLAGS_x86_64_unknown_linux_gnu = None
HOST_CFLAGS = None
CFLAGS = None
PROFILE = Some("debug")
running: "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.6/src/libbacktrace/configure" "--with-pic" "--disable-multilib" "--disable-shared" "--disable-host-shared" "--target=x86_64-unknown-linux-gnu" "--host=x86_64-unknown-linux-gnu"
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for x86_64-unknown-linux-gnu-gcc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... no
checking whether to enable maintainer-specific portions of Makefiles... no
checking for x86_64-unknown-linux-gnu-gcc... (cached) cc
checking whether we are using the GNU C compiler... (cached) yes
checking whether cc accepts -g... (cached) yes
checking for cc option to accept ISO C89... (cached) none needed
checking for x86_64-unknown-linux-gnu-ranlib... no
checking for ranlib... ranlib
checking for gawk... (cached) mawk
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... no
checking for x86_64-unknown-linux-gnu-dumpbin... no
checking for x86_64-unknown-linux-gnu-link... no
checking for dumpbin... no
checking for link... link -dump
checking the name lister (nm) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/bin/ld option to reload object files... -r
checking for x86_64-unknown-linux-gnu-objdump... no
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for x86_64-unknown-linux-gnu-ar... no
checking for ar... ar
checking for x86_64-unknown-linux-gnu-strip... no
checking for strip... strip
checking for x86_64-unknown-linux-gnu-ranlib... ranlib
checking command to parse nm output from cc object... ok
checking for dlfcn.h... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking unwind.h usability... yes
checking unwind.h presence... yes
checking for unwind.h... yes
checking for _Unwind_Backtrace... yes
checking for -funwind-tables option... yes
checking for -frandom-seed=string option... yes
checking whether cc supports -W... yes
checking whether cc supports -Wall... yes
checking whether cc supports -Wwrite-strings... yes
checking whether cc supports -Wstrict-prototypes... yes
checking whether cc supports -Wmissing-prototypes... yes
checking whether cc supports -Wold-style-definition... yes
checking whether cc supports -Wmissing-format-attribute... yes
checking whether cc supports -Wcast-qual... yes
checking for _Unwind_GetIPInfo... yes
checking __sync extensions... yes
checking __atomic extensions... yes
checking output filetype... elf64
looking for a compliant stdint.h in stdint.h, checking for uintmax_t... yes
checking for uintptr_t... yes
checking for int_least32_t... yes
checking for int_fast32_t... yes
checking for uint64_t... yes
checking what to include in gstdint.h... stdint.h (already complete)
checking sys/mman.h usability... yes
checking sys/mman.h presence... yes
checking for sys/mman.h... yes
checking for mmap... yes
checking link.h usability... yes
checking link.h presence... yes
checking for link.h... yes
checking for dl_iterate_phdr... yes
checking for fcntl... yes
checking whether strnlen is declared... yes
checking for getexecname... no
checking whether tests can run... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating backtrace-supported.h
config.status: creating config.h
config.status: executing libtool commands
config.status: executing gstdint.h commands
config.status: executing default commands
running: "make" "INCDIR=/root/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.6/src/libbacktrace"

--- stderr
configure: WARNING: If you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used.
/root/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.6/src/libbacktrace/configure: line 6897: /usr/bin/file: No such file or directory
thread 'main' panicked at 'failed to get status: No such file or directory (os error 2)', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.6/build.rs:91
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Getting a lot of <no info> blocks, Windows, rustc 1.19, stable-x86_64-pc-windows-gnu

Hello, thank you for the library (and sorry if this has already been asked...I did a search on google and the issues and didn't find anything).

I've just finished implementing error_chain in my app to get access to backtraces. However, when I'm (running with RUST_BACKTRACE=1) printing out the backtrace, I just get a bunch of <no info> blocks:

match my_app() {
    Ok(..) => {}
    Err(err) => { println!("{:?}", err.backtrace()); }
}
   0:           0xa95c23 - <no info>
   1:           0xa96688 - <no info>
   2:           0xa876b2 - <no info>
   3:           0xa87762 - <no info>
   4:           0x7be522 - <no info>
   5:           0x7bebf6 - <no info>
   6:           0x758349 - <no info>
   7:           0x7aa58e - <no info>
   8:           0x79932f - <no info>
   9:           0x7a42d7 - <no info>
  10:           0x7bc078 - <no info>
  11:           0x5187cb - <no info>
  12:           0x524f1d - <no info>
  13:           0x6a417b - <no info>
  14:           0x527244 - <no info>
  15:          0x112ef09 - <no info>
  16:           0x52578f - <no info>
  17:           0x521292 - <no info>
  18:           0x524873 - <no info>
  19:           0x606590 - <no info>
  20:          0x11299d0 - <no info>
  21:     0x7ff81ae12774 - BaseThreadInitThunk

I'm on Windows 10, x64, rustc 1.19.0, stable-x86_64-pc-windows-gnu. Am I doing something wrong?

Backtrace not displayed if invoked via ffi

This is a regression from the default handler, which displays a full backtrace on linux, even if invoked from a ruby process.

stack backtrace:
   0:           0x4008a8 - <unknown>
   1:                0x0 - <unknown>

In this context, I'm invoking a Rust (C-compatible) API from Ruby. The current directory is not near the symbols, and the ruby is at /home/n/.rvm/rubies/ruby-2.2.1/bin/ruby

using backtrace 0.3.2, Rust nightly 2017-06-11

Armv7 problem

Trying to build rust-doom using rustc 1.5.0-dev (e518c057f 2015-10-23), I'm getting the following errors:

 Compiling backtrace v0.1.5
Running `rustc /home/odroid/.cargo/registry/src/github.com-121aea75f9ef2ce2/backtrace-0.1.5/src/lib.rs --crate-name backtrace --crate-type lib -C opt-level=3 --cfg feature=\"dbghelp-sys\" --cfg feature=\"default\" --cfg feature=\"kernel32-sys\" --cfg feature=\"libunwind\" --cfg feature=\"dladdr\" --cfg feature=\"dbghelp\" --cfg feature=\"backtrace-sys\" --cfg feature=\"libbacktrace\" --cfg feature=\"winapi\" -C metadata=e4c0ebe143c52b5d -C extra-filename=-e4c0ebe143c52b5d --out-dir /tmp/rust-doom-master/target/release/deps --emit=dep-info,link -L dependency=/tmp/rust-doom-master/target/release/deps -L dependency=/tmp/rust-doom-master/target/release/deps --extern dbghelp=/tmp/rust-doom-master/target/release/deps/libdbghelp-040983399761f987.rlib --extern backtrace_sys=/tmp/rust-doom-master/target/release/deps/libbacktrace_sys-e659868d1ba4bec9.rlib --extern libc=/tmp/rust-doom-master/target/release/deps/liblibc-165b5479aec0459c.rlib --extern kernel32=/tmp/rust-doom-master/target/release/deps/libkernel32-c606ce60307b6481.rlib --extern debug_builders=/tmp/rust-doom-master/target/release/deps/libdebug_builders-4717471a4c16d259.rlib --extern winapi=/tmp/rust-doom-master/target/release/deps/libwinapi-3afcd2170e6034e1.rlib --extern cfg_if=/tmp/rust-doom-master/target/release/deps/libcfg_if-f8ac1d2a9eed8e25.rlib --cap-lints allow`
/home/odroid/.cargo/registry/src/github.com-121aea75f9ef2ce2/backtrace-0.1.5/src/backtrace/libunwind.rs:158:29: 158:35 error: use of undeclared type name `c_uint` [E0412]
/home/odroid/.cargo/registry/src/github.com-121aea75f9ef2ce2/backtrace-0.1.5/src/backtrace/libunwind.rs:158         type _Unwind_Word = c_uint;
                                                                                                                                        ^~~~~~
<cfg_if macros>:5:1: 6:79 note: in this expansion of __cfg_if_apply! (defined in <cfg_if macros>)
<cfg_if macros>:4:1: 6:29 note: in this expansion of __cfg_if_items! (defined in <cfg_if macros>)
/home/odroid/.cargo/registry/src/github.com-121aea75f9ef2ce2/backtrace-0.1.5/src/backtrace/mod.rs:79:1: 93:2 note: in this expansion of cfg_if! (defined in <cfg_if macros>)
/home/odroid/.cargo/registry/src/github.com-121aea75f9ef2ce2/backtrace-0.1.5/src/backtrace/libunwind.rs:158:29: 158:35 help: run `rustc --explain E0412` to see a detailed explanation
error: aborting due to previous error

Error building since sys 0.1.6

Using a crate that uses backtrace and cargo update got me from backtrace-sys 0.1.5 to a more recent one and since then i get this error. going back to 0.1.5 fixes it (and backtraces work)

--- stdout
OPT_LEVEL = Some("1")
TARGET = Some("aarch64-linux-android")
HOST = Some("x86_64-pc-windows-msvc")
TARGET = Some("aarch64-linux-android")
TARGET = Some("aarch64-linux-android")
HOST = Some("x86_64-pc-windows-msvc")
CC_aarch64-linux-android = None
CC_aarch64_linux_android = None
TARGET_CC = Some("C:\\Users\\David\\Documents\\Android\\ndk\\android-ndk-r13b\\toolchains/aarch64-linux-android-4.9/prebuilt/windows-x86_64\\bin/aarch64-linux-android-gcc")
TARGET = Some("aarch64-linux-android")
HOST = Some("x86_64-pc-windows-msvc")
CFLAGS_aarch64-linux-android = None
CFLAGS_aarch64_linux_android = None
TARGET_CFLAGS = Some("--sysroot C:\\Users\\David\\Documents\\Android\\ndk\\android-ndk-r13b\\platforms/android-24/arch-arm64")
PROFILE = Some("debug")
running: "C:\\Users\\David\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\backtrace-sys-0.1.6\\src/libbacktrace/configure" "--with-pic" "--disable-multilib" "--disable-shared" "--disable-host-shared" "--target=aarch64-linux-android" "--host=x86_64-pc-windows-msvc"

--- stderr
thread 'main' panicked at 'failed to get status: %1 is not a valid Win32 application. (os error 193)', C:\Users\David\.cargo\registry\src\github.com-1ecc6299db9ec823\backtrace-sys-0.1.6\build.rs:91
stack backtrace:
   0:     0x7ff79f8b5fc8 - std::panicking::default_hook::{{closure}}
                        at C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\libstd\panicking.rs:356
   1:     0x7ff79f8b54d4 - std::panicking::default_hook
                        at C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\libstd\panicking.rs:367
   2:     0x7ff79f8b8dad - std::panicking::rust_panic_with_hook
                        at C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\libstd\panicking.rs:555
   3:     0x7ff79f8b8bf8 - std::panicking::begin_panic<collections::string::String>
                        at C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\libstd\panicking.rs:517
   4:     0x7ff79f8b8b64 - std::panicking::begin_panic_fmt
                        at C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\libstd\panicking.rs:501
   5:     0x7ff79f8834a8 - build_script_build::run
                        at C:\Users\David\.cargo\registry\src\github.com-1ecc6299db9ec823\backtrace-sys-0.1.6\build.rs:91
   6:     0x7ff79f881fc9 - build_script_build::main
                        at C:\Users\David\.cargo\registry\src\github.com-1ecc6299db9ec823\backtrace-sys-0.1.6\build.rs:46
   7:     0x7ff79f8bb301 - panic_unwind::__rust_maybe_catch_panic
                        at C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\libpanic_unwind\lib.rs:98
   8:     0x7ff79f8b939a - std::rt::lang_start
                        at C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\libstd\rt.rs:51
   9:     0x7ff79f8bfb58 - __scrt_common_main_seh
                        at f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:253
  10:     0x7ffb1dc88363 - BaseThreadInitThunk

Error executing ["cargo", "rustc", "--target", "aarch64-linux-android", "--", "-C", "linker=C:\\d\\Documents\\Repositories\\TeamRocket\\gameboyemulator\\gameboy\\target\\android-artifacts\\linker_exe.exe", "--extern", "cargo_apk_injected_glue=C:\\d\\Documents\\Repositories\\TeamRocket\\gameboyemulator\\gameboy\\target\\android-artifacts\\aarch64-linux-android\\libcargo_apk_injected_glue.rlib"]
Status code 101

Serialize backtrace

Hi!

I am trying to serialize a Backtrace object like so:

fn serialize_backtrace(backtrace: &Backtrace) -> String {
    let backtrace_frames: Vec<BacktraceFrame> = backtrace.into();
    let to_print = backtrace_frames.into_iter()
        .map(|frame| frame.to_string() + "\n")
        .fold("", |acc, &frame_str| acc + frame_str);
}

It is telling me

the trait bound `std::vec::Vec<errors::backtrace::BacktraceFrame>: std::convert::From<&errors::backtrace::Backtrace>` is not satisfied

Although from the doc: I should be able to convert a backtrace in a vec of frames.

Also,

the method `to_string` exists but the following trait bounds were not satisfied: `errors::backtrace::BacktraceFrame : std::fmt::Display`

I am confused since in the examples, the reference of backtrace is used in a println! statement.

Thanks for the help.

PS: I am on rust 1.13 on MacX 64 10.12.1 using backtrace 0.2 (same error with 0.3)

Fails to compile with asmjs-unknown-emscripten

(strange, it's me again; hopefully this time my report has actually something to do with backtrace)

When compiling a project depending on backtrace with --target asmjs-unknown-emscripten, I get this error:

   Compiling backtrace-sys v0.1.4
     Running `/home/lukas/dev/plantex/target/release/build/backtrace-sys-4a333e150e37ba3b/build-script-build`
error: failed to run custom build command for `backtrace-sys v0.1.4`
process didn't exit successfully: `/home/lukas/dev/plantex/target/release/build/backtrace-sys-4a333e150e37ba3b/build-script-build` (exit code: 101)
--- stdout
OPT_LEVEL = Some("3")
PROFILE = Some("release")
TARGET = Some("asmjs-unknown-emscripten")
debug=false opt-level=3
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("asmjs-unknown-emscripten")
TARGET = Some("asmjs-unknown-emscripten")
HOST = Some("x86_64-unknown-linux-gnu")
CC_asmjs-unknown-emscripten = None
CC_asmjs_unknown_emscripten = None
TARGET_CC = None
CC = None
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("asmjs-unknown-emscripten")
HOST = Some("x86_64-unknown-linux-gnu")
CFLAGS_asmjs-unknown-emscripten = None
CFLAGS_asmjs_unknown_emscripten = None
TARGET_CFLAGS = None
CFLAGS = None
running: "/home/lukas/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.4/src/libbacktrace/configure" "--with-pic" "--disable-multilib" "--disable-shared" "--disable-host-shared" "--target=asmjs-unknown-emscripten" "--host=x86_64-unknown-linux-gnu"
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... 
--- stderr
configure: WARNING: If you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used.
Invalid configuration `asmjs-unknown-emscripten': system `emscripten' not recognized
configure: error: /bin/bash /home/lukas/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.4/src/libbacktrace/config.sub asmjs-unknown-emscripten failed
thread 'main' panicked at 'failed with: exit code: 1', /home/lukas/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.4/build.rs:63
stack backtrace:
   1:     0x55a4447ea81f - std::sys::backtrace::tracing::imp::write::h22f199c1dbb72ba2
   2:     0x55a4447f06bd - std::panicking::default_hook::{{closure}}::h9a389c462b6a22dd
   3:     0x55a4447ef652 - std::panicking::default_hook::h852b4223c1c00c59
   4:     0x55a4447efb98 - std::panicking::rust_panic_with_hook::hcd9d05f53fa0dafc
   5:     0x55a4447efa32 - std::panicking::begin_panic::hf6c488cee66e7f17
   6:     0x55a4447ef970 - std::panicking::begin_panic_fmt::hb0a7126ee57cdd27
   7:     0x55a4447dad69 - build_script_build::run::hd1d9cc3b7c1d4ef5
   8:     0x55a4447da469 - build_script_build::main::h4b7e86393e928de9
   9:     0x55a4447f8186 - __rust_maybe_catch_panic
  10:     0x55a4447eeed1 - std::rt::lang_start::h14cbded5fe3cd915
  11:     0x7f4ccd91e82f - __libc_start_main
  12:     0x55a4447d88e8 - _start
  13:                0x0 - <unknown>

Rust version:

rustc 1.14.0-nightly (a3bc191b5 2016-10-10)
binary: rustc
commit-hash: a3bc191b5f41df5143cc65084b13999896411817
commit-date: 2016-10-10
host: x86_64-unknown-linux-gnu
release: 1.14.0-nightly

If I shall provide more information, just tell me!

Recompiling behavior with `cargo check` in 0.3.1

Hi,
I noticed something strange today I believe related to the 0.3.1 release. Whenever, I do cargo check on a project, the first time it would compile everything (as expected), but subsequent runs would just recompile the crate (if it changed). However, it seems with backtrace 0.3.1 (or maybe something with cpp_demangle...) it is always recompiling the backtrace related crates even if nothing changes. Here's an example from error-chain crate to explain it a bit better:

โžœ  rust_tests g clone https://github.com/brson/error-chain
Cloning into 'error-chain'...
remote: Counting objects: 7841, done.
remote: Total 7841 (delta 0), reused 0 (delta 0), pack-reused 7840
Receiving objects: 100% (7841/7841), 4.98 MiB | 5.64 MiB/s, done.
Resolving deltas: 100% (4852/4852), done.
โžœ  rust_tests cd error-chain 
โžœ  error-chain git:(master) cargo check
    Updating registry `https://github.com/rust-lang/crates.io-index`
   Compiling fixedbitset v0.1.6
   Compiling libc v0.2.23
   Compiling rustc-demangle v0.1.4
   Compiling gcc v0.3.46
   Compiling cfg-if v0.1.0
   Compiling backtrace v0.3.1
   Compiling cpp_demangle v0.2.1
   Compiling backtrace-sys v0.1.10
   Compiling error-chain v0.10.1-pre (file:///home/chris/code/rust_tests/error-chain)
    Finished dev [unoptimized + debuginfo] target(s) in 6.25 secs
โžœ  error-chain git:(master) cargo check # why recompile again
   Compiling cpp_demangle v0.2.1
   Compiling backtrace v0.3.1
   Compiling error-chain v0.10.1-pre (file:///home/chris/code/rust_tests/error-chain)
    Finished dev [unoptimized + debuginfo] target(s) in 2.3 secs
โžœ  error-chain git:(master) cargo check # still here
   Compiling cpp_demangle v0.2.1
   Compiling backtrace v0.3.1
   Compiling error-chain v0.10.1-pre (file:///home/chris/code/rust_tests/error-chain)
    Finished dev [unoptimized + debuginfo] target(s) in 2.4 secs
โžœ  error-chain git:(master) # move to backtrace 0.3.0
โžœ  error-chain git:(master) nvim Cargo.toml 
โžœ  error-chain git:(master) โœ— cargo check
    Updating registry `https://github.com/rust-lang/crates.io-index`
   Compiling winapi-build v0.1.1
   Compiling winapi v0.2.8
   Compiling backtrace v0.3.0
   Compiling kernel32-sys v0.2.2
   Compiling dbghelp-sys v0.2.0
   Compiling error-chain v0.10.1-pre (file:///home/chris/code/rust_tests/error-chain)
    Finished dev [unoptimized + debuginfo] target(s) in 1.1 secs
โžœ  error-chain git:(master) โœ— cargo check # no recompiling
    Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
โžœ  error-chain git:(master) โœ— cargo check # no recompiling
    Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs

Env:

rustc 1.19.0-nightly (0ed1ec9f9 2017-05-18)
arch linux: kernel 4.10.11-1

Cross-Compile to `x86_64-unknown-linux-musl` from macOS Fails

Hi! I'm opening this issue despite #25 existing. When trying to cross-compile a project that has backtrace-rs as a transitive dependency, I get the following error:

Standard
minimum-failure:master >> cargo build --release --target=x86_64-unknown-linux-musl
   Compiling backtrace-sys v0.1.16
   Compiling failure_derive v0.1.1
error: failed to run custom build command for `backtrace-sys v0.1.16`
process didn't exit successfully: `/Users/dbarsky/Developer/Rust/minimum-failure/target/release/build/backtrace-sys-d00ffb83df7137b6/build-script-build` (exit code: 101)
--- stdout
OPT_LEVEL = Some("3")
TARGET = Some("x86_64-unknown-linux-musl")
HOST = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-unknown-linux-musl")
TARGET = Some("x86_64-unknown-linux-musl")
HOST = Some("x86_64-apple-darwin")
CC_x86_64-unknown-linux-musl = None
CC_x86_64_unknown_linux_musl = None
TARGET_CC = None
CC = None
HOST = Some("x86_64-apple-darwin")
CROSS_COMPILE = None
TARGET = Some("x86_64-unknown-linux-musl")
HOST = Some("x86_64-apple-darwin")
CFLAGS_x86_64-unknown-linux-musl = None
CFLAGS_x86_64_unknown_linux_musl = None
TARGET_CFLAGS = None
CFLAGS = None
DEBUG = Some("false")
running: "sh" "/Users/dbarsky/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.16/src/libbacktrace/configure" "--with-pic" "--disable-multilib" "--disable-shared" "--disable-host-shared" "--host=x86_64-unknown-linux-musl" "--build=x86_64-apple-darwin"
checking build system type... x86_64-apple-darwin
checking host system type... x86_64-unknown-linux-musl
checking target system type... x86_64-unknown-linux-musl
checking for x86_64-unknown-linux-musl-gcc... musl-gcc
checking for C compiler default output file name...

--- stderr
configure: error: in `/Users/dbarsky/Developer/Rust/minimum-failure/target/x86_64-unknown-linux-musl/release/build/backtrace-sys-0faeb9e02c25b08d/out':
configure: error: C compiler cannot create executables
See `config.log' for more details.
thread 'main' panicked at 'failed with: exit code: 77', /Users/dbarsky/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.16/build.rs:176:9
note: Run with `RUST_BACKTRACE=1` for a backtrace.

warning: build failed, waiting for other jobs to finish...
error: build failed
With Backtrace
minimum-failure:master >> cargo build --release --target=x86_64-unknown-linux-musl
   Compiling backtrace-sys v0.1.16
   Compiling failure_derive v0.1.1
error: failed to run custom build command for `backtrace-sys v0.1.16`
process didn't exit successfully: `/Users/dbarsky/Developer/Rust/minimum-failure/target/release/build/backtrace-sys-d00ffb83df7137b6/build-script-build` (exit code: 101)
--- stdout
OPT_LEVEL = Some("3")
TARGET = Some("x86_64-unknown-linux-musl")
HOST = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-unknown-linux-musl")
TARGET = Some("x86_64-unknown-linux-musl")
HOST = Some("x86_64-apple-darwin")
CC_x86_64-unknown-linux-musl = None
CC_x86_64_unknown_linux_musl = None
TARGET_CC = None
CC = None
HOST = Some("x86_64-apple-darwin")
CROSS_COMPILE = None
TARGET = Some("x86_64-unknown-linux-musl")
HOST = Some("x86_64-apple-darwin")
CFLAGS_x86_64-unknown-linux-musl = None
CFLAGS_x86_64_unknown_linux_musl = None
TARGET_CFLAGS = None
CFLAGS = None
DEBUG = Some("false")
running: "sh" "/Users/dbarsky/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.16/src/libbacktrace/configure" "--with-pic" "--disable-multilib" "--disable-shared" "--disable-host-shared" "--host=x86_64-unknown-linux-musl" "--build=x86_64-apple-darwin"
checking build system type... x86_64-apple-darwin
checking host system type... x86_64-unknown-linux-musl
checking target system type... x86_64-unknown-linux-musl
checking for x86_64-unknown-linux-musl-gcc... musl-gcc
checking for C compiler default output file name...

--- stderr
configure: error: in `/Users/dbarsky/Developer/Rust/minimum-failure/target/x86_64-unknown-linux-musl/release/build/backtrace-sys-0faeb9e02c25b08d/out':
configure: error: C compiler cannot create executables
See `config.log' for more details.
thread 'main' panicked at 'failed with: exit code: 77', /Users/dbarsky/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.16/build.rs:176:9
note: Run with `RUST_BACKTRACE=1` for a backtrace.

warning: build failed, waiting for other jobs to finish...
error: build failed
minimum-failure:master >> env RUST_BACKTRACE=1 cargo build --release --target=x86_64-unknown-linux-musl
   Compiling backtrace-sys v0.1.16
error: failed to run custom build command for `backtrace-sys v0.1.16`
process didn't exit successfully: `/Users/dbarsky/Developer/Rust/minimum-failure/target/release/build/backtrace-sys-d00ffb83df7137b6/build-script-build` (exit code: 101)
--- stdout
OPT_LEVEL = Some("3")
TARGET = Some("x86_64-unknown-linux-musl")
HOST = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-unknown-linux-musl")
TARGET = Some("x86_64-unknown-linux-musl")
HOST = Some("x86_64-apple-darwin")
CC_x86_64-unknown-linux-musl = None
CC_x86_64_unknown_linux_musl = None
TARGET_CC = None
CC = None
HOST = Some("x86_64-apple-darwin")
CROSS_COMPILE = None
TARGET = Some("x86_64-unknown-linux-musl")
HOST = Some("x86_64-apple-darwin")
CFLAGS_x86_64-unknown-linux-musl = None
CFLAGS_x86_64_unknown_linux_musl = None
TARGET_CFLAGS = None
CFLAGS = None
DEBUG = Some("false")
running: "sh" "/Users/dbarsky/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.16/src/libbacktrace/configure" "--with-pic" "--disable-multilib" "--disable-shared" "--disable-host-shared" "--host=x86_64-unknown-linux-musl" "--build=x86_64-apple-darwin"
checking build system type... x86_64-apple-darwin
checking host system type... x86_64-unknown-linux-musl
checking target system type... x86_64-unknown-linux-musl
checking for x86_64-unknown-linux-musl-gcc... musl-gcc
checking for C compiler default output file name...

--- stderr
configure: error: in `/Users/dbarsky/Developer/Rust/minimum-failure/target/x86_64-unknown-linux-musl/release/build/backtrace-sys-0faeb9e02c25b08d/out':
configure: error: C compiler cannot create executables
See `config.log' for more details.
thread 'main' panicked at 'failed with: exit code: 77', /Users/dbarsky/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.16/build.rs:176:9
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: std::panicking::rust_panic_with_hook
   5: std::panicking::begin_panic
   6: std::panicking::begin_panic_fmt
   7: build_script_build::run
   8: build_script_build::main
   9: std::rt::lang_start::{{closure}}
  10: std::panicking::try::do_call
  11: __rust_maybe_catch_panic
  12: std::rt::lang_start_internal
  13: main

The project that I'm building just has a dependency on withoutboats/failure 0.1.1. The config.log is reproduced here.

Thanks for your work on this! Let me know if I can help you triage this in any way!

macOS Sierra Xcode 8.3 - Cross Compilation failed - Is `objcopy` not installed?

I'm currently trying to cross-compile a library for android.

I'm using dustup with the last target:

Default host: x86_64-apple-darwin

installed toolchains
--------------------

stable-x86_64-apple-darwin (default)
nightly-x86_64-apple-darwin

installed targets for active toolchain
--------------------------------------

aarch64-apple-ios
aarch64-linux-android
arm-linux-androideabi
armv7-apple-ios
armv7-linux-androideabi
armv7s-apple-ios
i386-apple-ios
i686-linux-android
x86_64-apple-darwin
x86_64-apple-ios

active toolchain
----------------

stable-x86_64-apple-darwin (default)
rustc 1.16.0 (30cf806ef 2017-03-10)

I have installed correctly the standalone NDK toolchain and set them up inside .cargo/config:

[target.aarch64-linux-android]
ar = "~/dev/rust/arm64/bin/aarch64-linux-android-ar"
linker = "~/dev/rust/arm64/bin/aarch64-linux-android-gcc"

[target.armv7-linux-androideabi]
ar = "/NDK/arm/bin/arm-linux-androideabi-ar"
linker = "~/dev/rust/arm/bin/arm-linux-androideabi-gcc"

[target.i686-linux-android]
ar = "~/dev/rust/x86/bin/i686-linux-android-ar"
linker = "~/dev/rust/x86/bin/i686-linux-android-gcc"

When I trigger cargo build --target=arm-linux-androideabi, the compilation failed telling me:

 Is `objcopy` not installed?

The long and complete output can be found here: https://gist.github.com/yageek/6f828bfb496d50856797cb65a453b725

NOTE: I had to manually specify the CC environment variable before to reach this point:

export CC=$HOME/dev/rust/arm/bin/arm-linux-androideabi-clang

If I did not do it, I have this error:

error: failed to run custom build command for `backtrace-sys v0.1.10`
process didn't exit successfully: `/Users/yheinrich/dev/ios/message-protocol/capi/target/debug/build/backtrace-sys-0c4d13204b0e1510/build-script-build` (exit code: 101)
--- stdout
OPT_LEVEL = Some("0")
TARGET = Some("arm-linux-androideabi")
HOST = Some("x86_64-apple-darwin")
TARGET = Some("arm-linux-androideabi")
TARGET = Some("arm-linux-androideabi")
HOST = Some("x86_64-apple-darwin")
CC_arm-linux-androideabi = None
CC_arm_linux_androideabi = None
TARGET_CC = None
CC = None
TARGET = Some("arm-linux-androideabi")
HOST = Some("x86_64-apple-darwin")
CFLAGS_arm-linux-androideabi = None
CFLAGS_arm_linux_androideabi = None
TARGET_CFLAGS = None
CFLAGS = None
PROFILE = Some("debug")
running: "/Users/yheinrich/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.10/src/libbacktrace/configure" "--with-pic" "--disable-multilib" "--disable-shared" "--disable-host-shared" "--target=arm-linux-androideabi" "--host=x86_64-apple-darwin"
checking build system type... x86_64-apple-darwin16.5.0
checking host system type... x86_64-apple-darwin
checking target system type... arm-unknown-linux-androideabi
checking for x86_64-apple-darwin-gcc... arm-linux-androideabi-gcc
checking for C compiler default output file name...

--- stderr
configure: WARNING: If you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used.
configure: error: in `/Users/yheinrich/dev/ios/component-protocol/capi/target/arm-linux-androideabi/debug/build/backtrace-sys-c41044212322c9f2/out':
configure: error: C compiler cannot create executables
See `config.log' for more details.
thread 'main' panicked at 'failed with: exit code: 77', /Users/yheinrich/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.10/build.rs:134
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Build failed, waiting for other jobs to finish...

mismatched types expected i8, found u8 targeting i686-linux-android

error[E0308]: mismatched types
  --> /home/jarod/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.0/src/dylib.rs:30:32
   |
30 |         let ptr = libc::dlopen(name.as_ptr(), libc::RTLD_LAZY);
   |                                ^^^^^^^^^^^^^ expected i8, found u8
   |
   = help: here are some functions which might fulfill your needs:
           - .offset(...)
           - .wrapping_offset(...)

Filter backtrace

Currently, the generated backtrace is something like

   0:     0x55590e70c461 - backtrace::backtrace::libunwind::trace
                        at /home/yamakaky/.cache/cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.0/src/backtrace/mod.rs:90
                         - backtrace::backtrace::trace<closure>
                        at /home/yamakaky/.cache/cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.0/src/backtrace/mod.rs:42
   1:     0x55590e70d2b0 - backtrace::capture::{{impl}}::new
                        at /home/yamakaky/.cache/cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.0/src/lib.rs:101
   2:     0x55590e704491 - error_chain::make_backtrace
                        at /home/yamakaky/dev/rust/error-chain/src/lib.rs:416
   3:     0x55590e6fe8f0 - core::option::{{impl}}::or_else<alloc::arc::Arc<backtrace::capture::Backtrace>,fn() -> core::option::Option<alloc::arc::Arc<backtrace::capture::Backtrace>>>
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/obj/../src/libcore/option.rs:631
   4:     0x55590e6fe5fa - error_chain::{{impl}}::new<quickstart::errors::Error>
                        at /home/yamakaky/dev/rust/error-chain/src/lib.rs:467
   5:     0x55590e702460 - quickstart::errors::{{impl}}::chain_err::{{closure}}<std::fs::File,std::io::error::Error,closure,&str>
                        at /home/yamakaky/dev/rust/error-chain/examples/quickstart.rs:17
   6:     0x55590e6fed1c - core::result::{{impl}}::map_err<std::fs::File,std::io::error::Error,quickstart::errors::Error,closure>
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/obj/../src/libcore/result.rs:494
   7:     0x55590e701bef - quickstart::errors::{{impl}}::chain_err<std::fs::File,std::io::error::Error,closure,&str>
                        at /home/yamakaky/dev/rust/error-chain/examples/quickstart.rs:17
   8:     0x55590e701666 - quickstart::run
                        at /home/yamakaky/dev/rust/error-chain/examples/quickstart.rs:33
   9:     0x55590e701ed8 - quickstart::main
                        at /home/yamakaky/dev/rust/error-chain/examples/quickstart.rs:24
  10:     0x55590e7258e6 - __rust_maybe_catch_panic
  11:     0x55590e71c9f1 - std::rt::lang_start::h538f8960e7644c80
  12:     0x55590e7026d3 - main
  13:     0x7f93d53dd290 - __libc_start_main
  14:     0x55590e6fe429 - _start
  15:                0x0 - <unknown>

The frame 0 and 1 could be removed since they are not relevant. Maybe add RUST_BACKTRACE=full to keep them.

Build script fails due to file permission error

Cargo is failing to compile backtrace-sys in some of my projects.
The build.rs script fails, apparently due to a failure to set fs permissions
for some intermediate files. I am using Linux, but the affected project is
located in an NTFS filesystem (a legacy from my past using MS Windows).
Cargo is able to successfully compile backtrace-sys in projects which are
located in ext4 filesystems.

I would rather not move all of my projects to a different filesystem; I still
need to access them occassionally from Windows machines.
I assume that the backtrace crate does not actually depend on the ability to set
permissions in the local filesystem, and that this is simply an unintended
consequence of the config scripts. I don't understand the crate well enough
to know for sure though.

Relevant info:

$ uname -a
Linux jroush-laptop 4.10.0-42-generic #46~16.04.1-Ubuntu SMP Mon Dec 4 15:57:59 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
$ cargo --version
cargo 0.24.0 (45043115c 2017-12-05)
$ rustc --version
rustc 1.23.0 (766bd11c8 2018-01-01)

Steps to reproduce (on an NTFS filesystem mounted in Linux):

$ cargo init
     Created library project
$ echo 'backtrace-sys = "0.1.16"' >> Cargo.toml
$ cargo build
    Updating registry `https://github.com/rust-lang/crates.io-index`
   Compiling cc v1.0.4
   Compiling libc v0.2.36
   Compiling backtrace-sys v0.1.16
error: failed to run custom build command for `backtrace-sys v0.1.16`
process didn't exit successfully: `test/target/debug/build/backtrace-sys-88660b8801f94ad6/build-script-build` (exit code: 101)
--- stdout
OPT_LEVEL = Some("0")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
    [[ many lines omitted for brevity ]]
checking whether tests can run... yes
configure: creating ./config.status

--- stderr
/usr/bin/install: cannot change permissions of 'test/target/debug/build/backtrace-sys-65fded567eb95adc/out/conftest.dir/conftest.one': Operation not permitted
/usr/bin/install: cannot change permissions of 'test/target/debug/build/backtrace-sys-65fded567eb95adc/out/conftest.dir/conftest.two': Operation not permitted
chmod: changing permissions of './config.status': Operation not permitted
configure: error: write failure creating ./config.status
thread 'main' panicked at 'failed with: exit code: 1', /home/jroush/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.16/build.rs:176:8
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Expected Result (as seen on an ext4 filesystem on the same machine):

$ cargo init
     Created library project
$ echo 'backtrace-sys = "0.1.16"' >> Cargo.toml 
$ cargo build
    Updating registry `https://github.com/rust-lang/crates.io-index`
   Compiling libc v0.2.36                                                       
   Compiling cc v1.0.4
   Compiling backtrace-sys v0.1.16
   Compiling test v0.1.0 (file://test)
    Finished dev [unoptimized + debuginfo] target(s) in 30.7 secs

`backtrace-sys/build.rs` doesn't pass `ranlib` to `configure`

For ar and cc, the build script finds those tools and passes them to the configure script using environment variables (https://github.com/alexcrichton/backtrace-rs/blob/master/backtrace-sys/build.rs#L105). The libbacktrace build also uses ranlib, which isn't passed to configure. Ordinarily, this wouldn't be a problem, since the configure script has enough information to figure out which one you want most of the time, but when you are passing a compiler to the build script to use instead of the obvious one (like if you have wrapper scripts to work around rust-lang/cargo#4456 like we do) then it chooses the wrong one.

It seems like the best solution is to get the right tool using find_tool and pass that to configure using the RANLIB environment variable (which fixed the problem for me), so that all of the tools used by the libbacktrace build are definitely part of the same toolchain. I can submit a pull request doing just that, but I wanted to get feedback to make sure that was the correct approach or if there was a better thing to do.

Prints garbage for function name if it exceeds MAX_SYM_NAME (2000) characters

image

(Sorry for screenshot, I can't copy the garbage out of the terminal window.)

I had it AV once as well in the OsString::from_wide call.

The reason is that SymFromAddrW will set info.NameLen to the real length, which can be greater than MAX_SYM_NAME. So when backtrace converts the buffer to a widestring, it should use min of info.NameLen and info.MaxNameLen rather than just info.NameLen - the latter causes it to read past the buffer into garbage. This behavior doesn't seem to be documented as far as I can tell, but it's what I observed in the debugger.

(I don't apologize for not boxing my futures :P )

Build on FreeBSD fails

Building as a dependency of Rocket crate.

error: failed to run custom build command for `backtrace-sys v0.1.11`
process didn't exit successfully: `/usr/home/johannes/llnw/Rocket/target/debug/build/backtrace-sys-8a32bb107e14caf0/build-script-build` (exit code: 101)
--- stdout
OPT_LEVEL = Some("0")
TARGET = Some("x86_64-unknown-freebsd")
HOST = Some("x86_64-unknown-freebsd")
TARGET = Some("x86_64-unknown-freebsd")
TARGET = Some("x86_64-unknown-freebsd")
HOST = Some("x86_64-unknown-freebsd")
CC_x86_64-unknown-freebsd = None
CC_x86_64_unknown_freebsd = None
HOST_CC = None
CC = None
HOST = Some("x86_64-unknown-freebsd")
TARGET = Some("x86_64-unknown-freebsd")
HOST = Some("x86_64-unknown-freebsd")
CFLAGS_x86_64-unknown-freebsd = None
CFLAGS_x86_64_unknown_freebsd = None
HOST_CFLAGS = None
CFLAGS = None
PROFILE = Some("debug")
running: "sh" "/usr/home/johannes/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.11/src/libbacktrace/configure" "--with-pic" "--disable-multilib" "--disable-shared" "--disable-host-shared" "--host=x86_64-unknown-freebsd" "--build=x86_64-unknown-freebsd"
checking build system type... x86_64-unknown-freebsd
checking host system type... x86_64-unknown-freebsd
checking target system type... x86_64-unknown-freebsd
checking for x86_64-unknown-freebsd-gcc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/local/bin/gmkdir -p
checking for gawk... no
checking for mawk... no
checking for nawk... nawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for x86_64-unknown-freebsd-gcc... (cached) cc
checking whether we are using the GNU C compiler... (cached) yes
checking whether cc accepts -g... (cached) yes
checking for cc option to accept ISO C89... (cached) none needed
checking for x86_64-unknown-freebsd-ranlib... no
checking for ranlib... ranlib
checking for gawk... (cached) nawk
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for fgrep... /usr/bin/grep -F
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/local/bin/nm -B
checking the name lister (/usr/local/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 196608
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... no
checking for /usr/bin/ld option to reload object files... -r
checking for x86_64-unknown-freebsd-objdump... no
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for x86_64-unknown-freebsd-ar... no
checking for ar... ar
checking for x86_64-unknown-freebsd-strip... no
checking for strip... strip
checking for x86_64-unknown-freebsd-ranlib... ranlib
checking command to parse /usr/local/bin/nm -B output from cc object... ok
checking for dlfcn.h... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... yes
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... freebsd ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... no
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking unwind.h usability... no
checking unwind.h presence... no
checking for unwind.h... no
checking for -funwind-tables option... yes
checking for -frandom-seed=string option... yes
checking whether cc supports -W... yes
checking whether cc supports -Wall... yes
checking whether cc supports -Wwrite-strings... yes
checking whether cc supports -Wstrict-prototypes... yes
checking whether cc supports -Wmissing-prototypes... yes
checking whether cc supports -Wold-style-definition... yes
checking whether cc supports -Wmissing-format-attribute... yes
checking whether cc supports -Wcast-qual... yes
checking for _Unwind_GetIPInfo... no
checking __sync extensions... yes
checking __atomic extensions... yes
checking output filetype... elf64
looking for a compliant stdint.h in stdint.h, checking for uintmax_t... yes
checking for uintptr_t... yes
checking for int_least32_t... yes
checking for int_fast32_t... yes
checking for uint64_t... yes
checking what to include in gstdint.h... stdint.h (already complete)
checking sys/mman.h usability... yes
checking sys/mman.h presence... yes
checking for sys/mman.h... yes
checking for mmap... yes
checking link.h usability... yes
checking link.h presence... yes
checking for link.h... yes
checking for dl_iterate_phdr... yes
checking for fcntl... yes
checking whether strnlen is declared... yes
checking for getexecname... no
checking whether tests can run... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating backtrace-supported.h
config.status: creating config.h
config.status: executing libtool commands
config.status: executing gstdint.h commands
config.status: executing default commands
running: "make" "INCDIR=/usr/home/johannes/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.11/src/libbacktrace"

--- stderr
make: illegal argument to -j -- must be positive integer!
thread 'main' panicked at 'failed with: exit code: 1', /home/johannes/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.11/build.rs:136:8
note: Run with `RUST_BACKTRACE=1` for a backtrace.

warning: build failed, waiting for other jobs to finish...
error: build failed

rustc / cargo panics on NixOS when compiling backtrace

Hey!

System info:

~ $ cat /etc/os-release 
NAME=NixOS
ID=nixos
VERSION="17.09.2182.7f6f0c49f0 (Hummingbird)"
VERSION_CODENAME=hummingbird
VERSION_ID="17.09.2182.7f6f0c49f0"
PRETTY_NAME="NixOS 17.09.2182.7f6f0c49f0 (Hummingbird)"
HOME_URL="https://nixos.org/"
SUPPORT_URL="https://nixos.org/nixos/support.html"
BUG_REPORT_URL="https://github.com/NixOS/nixpkgs/issues"
~ $ rustc --version
rustc 1.22.1 (05e2e1c41 2017-11-22)
~ $ cargo --version
cargo 0.23.0 (61fa02415 2017-11-22)

I'm getting the following panic when building backtrace:

   Compiling rustc-demangle v0.1.5
   Compiling libc v0.2.33
   Compiling cc v1.0.3
   Compiling cfg-if v0.1.2
   Compiling backtrace-sys v0.1.16
   Compiling backtrace v0.3.4
thread '<unnamed>' panicked at 'failed to acquire jobserver token: Resource temporarily unavailable (os error 11)', /checkout/src/librustc_trans/back/write.rs:1619:28
note: Run with `RUST_BACKTRACE=1` for a backtrace.
error: failed to acquire jobserver token: Resource temporarily unavailable (os error 11)

error: Could not compile `backtrace`.

To learn more, run the command again with --verbose.

This is reproducible for me by just running cargo init and adding backtrace = "0.3.4" as the only dependency to the project.

Interestingly running cargo build a second time will succeed! I've tried setting build parallelism flags, e.g. -j1 to disable parallel builds, but it doesn't seem to make a difference.

Will try to add more information to the issue as debugging continues, but thought that you may have an idea what this is about :)

Handling of version hashes with symbol demangling

rustc is producing symbol names like this: _ZN2gl2Gl13CompileShader20h18931bbc7b159946zjfE

when running it through backtrace::demangle() it returns the following gl::Gl::CompileShader::h18931bbc7b159946zjf. It it intentional that the h18931bbc7b159946zjf is still left on the end?

Cross compiling backtrace-sys 0.1.6

I did a cargo update on my project and that bumped up the version of backtrace-sys to 0.1.6.

Unfortunately, this has resulted in the build of the project failing. It does build on Windows but not when cross compiling for ARM Linux.

This is the error message that I got:

error: failed to run custom build command for `backtrace-sys v0.1.6`
process didn't exit successfully: `/home/tlostroh/project/target/release/build/backtrace-sys-630598d76a7afd9a/build-script-build` (exit code: 101)
--- stdout
OPT_LEVEL = Some("3")
TARGET = Some("armv7-unknown-linux-gnueabihf")
HOST = Some("i686-unknown-linux-gnu")
TARGET = Some("armv7-unknown-linux-gnueabihf")
TARGET = Some("armv7-unknown-linux-gnueabihf")
HOST = Some("i686-unknown-linux-gnu")
CC_armv7-unknown-linux-gnueabihf = None
CC_armv7_unknown_linux_gnueabihf = None
TARGET_CC = None
CC = None
HOST = Some("i686-unknown-linux-gnu")
CROSS_COMPILE = None
TARGET = Some("armv7-unknown-linux-gnueabihf")
HOST = Some("i686-unknown-linux-gnu")
CFLAGS_armv7-unknown-linux-gnueabihf = None
CFLAGS_armv7_unknown_linux_gnueabihf = None
TARGET_CFLAGS = None
CFLAGS = None
PROFILE = Some("release")
running: "/home/tlostroh/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.6/src/libbacktrace/configure" "--with-pic" "--disable-multilib" "--disable-shared" "--disable-host-shared" "--target=armv7-unknown-linux-gnueabihf" "--host=i686-unknown-linux-gnu"
checking build system type... i686-pc-linux-gnu
checking host system type... i686-unknown-linux-gnu
checking target system type... armv7-unknown-linux-gnueabihf
checking for i686-unknown-linux-gnu-gcc... arm-linux-gnueabihf-gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... yes
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether arm-linux-gnueabihf-gcc accepts -g... yes
checking for arm-linux-gnueabihf-gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... arm-linux-gnueabihf-gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for i686-unknown-linux-gnu-strip... no
checking for strip... strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for i686-unknown-linux-gnu-gcc... (cached) arm-linux-gnueabihf-gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether arm-linux-gnueabihf-gcc accepts -g... (cached) yes
checking for arm-linux-gnueabihf-gcc option to accept ISO C89... (cached) none needed
checking for i686-unknown-linux-gnu-ranlib... no
checking for ranlib... ranlib
checking for gawk... (cached) mawk
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by arm-linux-gnueabihf-gcc... /usr/arm-linux-gnueabihf/bin/ld
checking if the linker (/usr/arm-linux-gnueabihf/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... no
checking for i686-unknown-linux-gnu-dumpbin... no
checking for i686-unknown-linux-gnu-link... no
checking for dumpbin... no
checking for link... link -dump
checking the name lister (nm) interface... BSD nm
checking whether ln -s works... no, using cp -p
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/arm-linux-gnueabihf/bin/ld option to reload object files... -r
checking for i686-unknown-linux-gnu-objdump... no
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for i686-unknown-linux-gnu-ar... no
checking for ar... ar
checking for i686-unknown-linux-gnu-strip... strip
checking for i686-unknown-linux-gnu-ranlib... ranlib
checking command to parse nm output from arm-linux-gnueabihf-gcc object... ok
checking for dlfcn.h... yes
checking for objdir... .libs
checking if arm-linux-gnueabihf-gcc supports -fno-rtti -fno-exceptions... no
checking for arm-linux-gnueabihf-gcc option to produce PIC... -fPIC -DPIC
checking if arm-linux-gnueabihf-gcc PIC flag -fPIC -DPIC works... yes
checking if arm-linux-gnueabihf-gcc static flag -static works... yes
checking if arm-linux-gnueabihf-gcc supports -c -o file.o... yes
checking if arm-linux-gnueabihf-gcc supports -c -o file.o... (cached) yes
checking whether the arm-linux-gnueabihf-gcc linker (/usr/arm-linux-gnueabihf/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking unwind.h usability... yes
checking unwind.h presence... yes
checking for unwind.h... yes
checking for _Unwind_Backtrace... yes
checking for -funwind-tables option... yes
checking for -frandom-seed=string option... yes
checking whether arm-linux-gnueabihf-gcc supports -W... yes
checking whether arm-linux-gnueabihf-gcc supports -Wall... yes
checking whether arm-linux-gnueabihf-gcc supports -Wwrite-strings... yes
checking whether arm-linux-gnueabihf-gcc supports -Wstrict-prototypes... yes
checking whether arm-linux-gnueabihf-gcc supports -Wmissing-prototypes... yes
checking whether arm-linux-gnueabihf-gcc supports -Wold-style-definition... yes
checking whether arm-linux-gnueabihf-gcc supports -Wmissing-format-attribute... yes
checking whether arm-linux-gnueabihf-gcc supports -Wcast-qual... yes
checking for _Unwind_GetIPInfo... yes
checking __sync extensions... yes
checking __atomic extensions... yes
checking output filetype... elf32
looking for a compliant stdint.h in stdint.h, checking for uintmax_t... yes
checking for uintptr_t... yes
checking for int_least32_t... yes
checking for int_fast32_t... yes
checking for uint64_t... yes
checking what to include in gstdint.h... stdint.h (already complete)
checking sys/mman.h usability... yes
checking sys/mman.h presence... yes
checking for sys/mman.h... yes
checking for mmap... yes
checking link.h usability... yes
checking link.h presence... yes
checking for link.h... yes
checking for dl_iterate_phdr... yes
checking for fcntl... yes
checking whether strnlen is declared... yes
checking for getexecname... no
checking whether tests can run... no
configure: creating ./config.status
config.status: creating Makefile
config.status: creating backtrace-supported.h
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing libtool commands
config.status: executing gstdint.h commands
config.status: executing default commands
running: "make" "INCDIR=/home/tlostroh/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.6/src/libbacktrace"
make  all-am
make[1]: Entering directory '/home/tlostroh/project/target/armv7-unknown-linux-gnueabihf/release/build/backtrace-sys-b2e53518d4e6e892/out'
/bin/bash ./libtool --tag=CC   --mode=compile arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I. -I/home/tlostroh/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.6/src/libbacktrace  -I /home/tlostroh/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.6/src/libbacktrace/../include -I /home/tlostroh/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.6/src/libbacktrace/../libgcc -I ../libgcc  -funwind-tables -frandom-seed=state.lo -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wmissing-format-attribute -Wcast-qual -fPIC -O3 -ffunction-sections -fdata-sections -fPIC -march=armv7-a -c -o state.lo /home/tlostroh/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.6/src/libbacktrace/state.c
libtool: compile:  arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I. -I/home/tlostroh/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.6/src/libbacktrace -I /home/tlostroh/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.6/src/libbacktrace/../include -I /home/tlostroh/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.6/src/libbacktrace/../libgcc -I ../libgcc -funwind-tables -frandom-seed=state.lo -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wmissing-format-attribute -Wcast-qual -fPIC -O3 -ffunction-sections -fdata-sections -fPIC -march=armv7-a -c /home/tlostroh/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.6/src/libbacktrace/state.c  -fPIC -DPIC -o state.o
/bin/bash ./libtool --tag=CC   --mode=link arm-linux-gnueabihf-gcc -funwind-tables -frandom-seed=libbacktrace.la -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wmissing-format-attribute -Wcast-qual -fPIC -O3 -ffunction-sections -fdata-sections -fPIC -march=armv7-a   -o libbacktrace.la  atomic.lo dwarf.lo fileline.lo posix.lo print.lo sort.lo state.lo backtrace.lo simple.lo elf.lo mmapio.lo mmap.lo 
libtool: link: rm -fr  .libs/libbacktrace.la
libtool: link: ar cru .libs/libbacktrace.a  atomic.o dwarf.o fileline.o posix.o print.o sort.o state.o backtrace.o simple.o elf.o mmapio.o mmap.o
libtool: link: ranlib .libs/libbacktrace.a
libtool: link: ( cd ".libs" && rm -f "libbacktrace.la" && cp -p "../libbacktrace.la" "libbacktrace.la" )
true  DO=all multi-do # make
make[1]: Leaving directory '/home/tlostroh/project/target/armv7-unknown-linux-gnueabihf/release/build/backtrace-sys-b2e53518d4e6e892/out'
cargo:rustc-link-search=native=/home/tlostroh/project/target/armv7-unknown-linux-gnueabihf/release/build/backtrace-sys-b2e53518d4e6e892/out/.libs
cargo:rustc-link-lib=static=backtrace
running: "ar" "x" "/home/tlostroh/project/target/armv7-unknown-linux-gnueabihf/release/build/backtrace-sys-b2e53518d4e6e892/out/.libs/libbacktrace.a"
running: "objcopy" "--redefine-syms=symbol-map" "/home/tlostroh/project/target/armv7-unknown-linux-gnueabihf/release/build/backtrace-sys-b2e53518d4e6e892/out/__tmp/atomic.o"

--- stderr
configure: WARNING: If you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used.
configure: WARNING: using cross tools not prefixed with host triplet
ar: `u' modifier ignored since `D' is the default (see `U')
objcopy: Unable to recognise the format of the input file `/home/tlostroh/project/target/armv7-unknown-linux-gnueabihf/release/build/backtrace-sys-b2e53518d4e6e892/out/__tmp/atomic.o'
thread 'main' panicked at 'failed with: exit code: 1', /home/tlostroh/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.6/build.rs:94
note: Run with `RUST_BACKTRACE=1` for a backtrace.

If I downgrade the version to 0.1.5 in the Cargo.lock file, everything works as expected.

Cross compile fail in docker (dockcore-armv7)

Symptom

When cross compiling backtrace-sys where error-chain and diesel_codegen are required, the ./configure command kicked off by build.rs fails. It appears that the wrong build target is being used. The logs seem to indicate that the target is x86_64-unknown-linux-gnu when armv7-unknown-linux-gnueabihf is passed into cargo. As such the wrong compiler flags are passed to arm-linux-gnueabihf-gcc. The error in config.log is the following

configure:2999: /usr/bin/arm-linux-gnueabihf-gcc -O0 -ffunction-sections -fdata-sections -fPIC -g -m64 -Wall -Wextra   conftest.c  >&5
arm-linux-gnueabihf-gcc: error: unrecognized command line option '-m64'

Reproduce

I created a git repo with an example project to trigger the error. Its just a hello-world program with dependencies of diesel_codegen and error-chain. I'm not sure what is so special about the combination of the two. The process makes use of docker and the dockcross base images, specifically linux-armv7.

To reproduce Docker is needed, then clone https://github.com/noyez/xcompile_test.

  • Build the docker image from the git repo root directory.
    docker build -t noyez/dockcore-armv7 .

  • Using the previously built docker image, start a docker container with a bash shell.
    docker run -ti -v $PWD:/work noyez/dockcore-armv7 bash

  • Build the project from within the container.
    gosu root cargo build --target=armv7-unknown-linux-gnueabihf

I get the following build error:

error: failed to run custom build command for `backtrace-sys v0.1.16`
   	process didn't exit successfully: `/work/target/debug/build/backtrace-sys-514698a0155fc278/build-script-build` (exit code: 101)
    --- stdout
    OPT_LEVEL = Some("0")
    TARGET = Some("x86_64-unknown-linux-gnu")
    HOST = Some("x86_64-unknown-linux-gnu")
    TARGET = Some("x86_64-unknown-linux-gnu")
    TARGET = Some("x86_64-unknown-linux-gnu")
    HOST = Some("x86_64-unknown-linux-gnu")
    CC_x86_64-unknown-linux-gnu = None
    CC_x86_64_unknown_linux_gnu = None
    HOST_CC = None
    CC = Some("/usr/bin/arm-linux-gnueabihf-gcc")
    TARGET = Some("x86_64-unknown-linux-gnu")
    HOST = Some("x86_64-unknown-linux-gnu")
    CFLAGS_x86_64-unknown-linux-gnu = None
    CFLAGS_x86_64_unknown_linux_gnu = None
    HOST_CFLAGS = None
    CFLAGS = None
    DEBUG = Some("true")
    running: "sh" "/opt/rust/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.16/src/libbacktrace/configure" "--with-pic" "--disable-multilib" "--disable-shared" "--disable-host-shared" "--host=x86_64-unknown-linux-gnu" "--build=x86_64-unknown-linux-gnu"
    checking build system type... x86_64-unknown-linux-gnu
    checking host system type... x86_64-unknown-linux-gnu
    checking target system type... x86_64-unknown-linux-gnu
    checking for x86_64-unknown-linux-gnu-gcc... /usr/bin/arm-linux-gnueabihf-gcc
    checking for C compiler default output file name...

    --- stderr
    configure: error: in `/work/target/debug/build/backtrace-sys-c8a25c9ec23a59ad/out':
    configure: error: C compiler cannot create executables
    See `config.log' for more details.
    thread 'main' panicked at 'failed with: exit code: 77', /opt/rust/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.16/build.rs:176:8
    note: Run with `RUST_BACKTRACE=1` for a backtrace.

backtrace-sys fails to compile on Debian sid

I am not sure if this is a bug in Debian but after doing a system upgrade with apt-get upgrade libbacktrace configure script is no longer working. cargo build output of backtrace-sys:

   Compiling backtrace-sys v0.1.10
error: failed to run custom build command for `backtrace-sys v0.1.10`
process didn't exit successfully: `/home/onur/code/rust/letsencrypt-rs/acme-client/target/debug/build/backtrace-sys-0c4d13204b0e1510/build-script-build` (exit code: 101)
--- stdout
OPT_LEVEL = Some("0")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
CC_x86_64-unknown-linux-gnu = None
CC_x86_64_unknown_linux_gnu = None
HOST_CC = None
CC = None
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
CFLAGS_x86_64-unknown-linux-gnu = None
CFLAGS_x86_64_unknown_linux_gnu = None
HOST_CFLAGS = None
CFLAGS = None
PROFILE = Some("debug")
running: "/home/onur/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.10/src/libbacktrace/configure" "--with-pic" "--disable-multilib" "--disable-shared" "--disable-host-shared" "--target=x86_64-unknown-linux-gnu" "--host=x86_64-unknown-linux-gnu"
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for x86_64-unknown-linux-gnu-gcc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... unsupported
checking how to run the C preprocessor... cc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... no
checking for sys/types.h... no
checking for sys/stat.h... no
checking for stdlib.h... no
checking for string.h... no
checking for memory.h... no
checking for strings.h... no
checking for inttypes.h... no
checking for stdint.h... no
checking for unistd.h... no
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... no
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for x86_64-unknown-linux-gnu-gcc... (cached) cc
checking whether we are using the GNU C compiler... (cached) yes
checking whether cc accepts -g... (cached) yes
checking for cc option to accept ISO C89... (cached) unsupported
checking for x86_64-unknown-linux-gnu-ranlib... no
checking for ranlib... ranlib
checking for gawk... (cached) gawk
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... no
checking for x86_64-unknown-linux-gnu-dumpbin... no
checking for x86_64-unknown-linux-gnu-link... no
checking for dumpbin... no
checking for link... link -dump
checking the name lister (nm) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/bin/ld option to reload object files... -r
checking for x86_64-unknown-linux-gnu-objdump... no
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for x86_64-unknown-linux-gnu-ar... no
checking for ar... ar
checking for x86_64-unknown-linux-gnu-strip... no
checking for strip... strip
checking for x86_64-unknown-linux-gnu-ranlib... ranlib
checking command to parse nm output from cc object... failed
checking for dlfcn.h... no
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking unwind.h usability... no
checking unwind.h presence... yes
checking for unwind.h... no
checking for -funwind-tables option... no
checking for -frandom-seed=string option... yes
checking whether cc supports -W... yes
checking whether cc supports -Wall... yes
checking whether cc supports -Wwrite-strings... yes
checking whether cc supports -Wstrict-prototypes... yes
checking whether cc supports -Wmissing-prototypes... yes
checking whether cc supports -Wold-style-definition... yes
checking whether cc supports -Wmissing-format-attribute... yes
checking whether cc supports -Wcast-qual... yes
checking for _Unwind_GetIPInfo... no
checking __sync extensions... no
checking __atomic extensions... no
checking output filetype... elf64
looking for a compliant stdint.h in stdint.h, checking for uintmax_t... no
looking for a compliant stdint.h in inttypes.h, checking for uintmax_t... no
looking for a compliant stdint.h in sys/inttypes.h, checking for uintmax_t... no
looking for an incomplete stdint.h in stdint.h, checking for uint32_t... no
looking for an incomplete stdint.h in inttypes.h, checking for uint32_t... no
looking for an incomplete stdint.h in sys/inttypes.h, checking for uint32_t... no
looking for u_intXX_t types in sys/types.h, checking for u_int32_t... no
looking for u_intXX_t types in inttypes.h, checking for u_int32_t... no
looking for u_intXX_t types in sys/inttypes.h, checking for u_int32_t... no
checking what to include in gstdint.h... stddef.h (using manual detection)
checking size of void *... 0
checking size of long... 0
checking size of int... 0
checking size of short... 0
checking size of char... 0
checking for type equivalent to int8_t... 
--- stderr
configure: WARNING: If you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used.
configure: WARNING: unwind.h: present but cannot be compiled
configure: WARNING: unwind.h:     check for missing prerequisite headers?
configure: WARNING: unwind.h: see the Autoconf documentation
configure: WARNING: unwind.h:     section "Present But Cannot Be Compiled"
configure: WARNING: unwind.h: proceeding with the compiler's result
configure: error: no 8-bit type, please report a bug
thread 'main' panicked at 'failed with: exit code: 1', /home/onur/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.10/build.rs:134
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: build_script_build::run
             at ./build.rs:134
   1: build_script_build::main
             at ./build.rs:74

Can't compile in rc from Acme but can from urxvt.

I was testing another crate that somehow indirectly require this one and got the following error:

   (lots of crates omitted)
   Compiling idna v0.1.4
   Compiling thread_local v0.3.5
error: failed to run custom build command for `backtrace-sys v0.1.16`
process didn't exit successfully: `/home/rain/coding/internbot/target/debug/build/backtrace-sys-25dbdfc5dc447658/build-script-build` (exit code: 101)
--- stdout
OPT_LEVEL = Some("0")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
CC_x86_64-unknown-linux-gnu = None
CC_x86_64_unknown_linux_gnu = None
HOST_CC = None
CC = None
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
CFLAGS_x86_64-unknown-linux-gnu = None
CFLAGS_x86_64_unknown_linux_gnu = None
HOST_CFLAGS = None
CFLAGS = None
DEBUG = Some("true")
running: "sh" "/home/rain/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.16/src/libbacktrace/configure" "--with-pic" "--disable-multilib" "--disable-shared" "--disable-host-shared" "--host=x86_64-unknown-linux-gnu" "--build=x86_64-unknown-linux-gnu"

--- stderr
sed: Command garbled: s/[-+.]/_/g
sed: Command garbled: s/[-+.]/_/g
sed: Command garbled: s/[-+.]/_/g
sed: Command garbled: s/[-+.]/_/g
configure: WARNING: unrecognized options: --with-pic, --disable-multilib, --disable-shared, --disable-host-shared
usage: ls [-dlmnpqrstuFQ] [file ...]
configure: error: working directory cannot be determined
thread 'main' panicked at 'failed with: exit code: 1', /home/rain/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.16/build.rs:176:8
note: Run with `RUST_BACKTRACE=1` for a backtrace.

warning: build failed, waiting for other jobs to finish...
error: build failed
cargo: exit 101

I currently use Acme from plan9ports which for me uses ZSH (as far as I know) to run commands. After that I tried to build it from ZSH in a urxvt terminal and it worked, I checked with plan9ports rc (from terminal again) and that worked too. I then tested it by building the latest git version on its own and that also breaks in Acme but works in urxvt.

Unable to build if using exa (rust ls replacement)

Howdy, I replaced ls on my machine with exa (https://github.com/ogham/exa), but due to the time checks here https://github.com/alexcrichton/backtrace-rs/blob/2f4fd762d973a53634933672e2e3a0f80a54d99c/backtrace-sys/src/libbacktrace/aclocal.m4#L493 backtrace doesn't build. They use a the -L flag to set the depth limit rather than dereferencing. I don't understand enough about this crate to see how important this is to how things function, but thought it might be worth bringing up.

Exa issue here: ogham/exa#286

bump kernel32-sys

Hi !
I've recently noticed that the kernel32-sys at 0.1 breaks the build of glium (inspecting the Cargo.lock, shows this is the only dependency that pulls 0.1) because of two crates linking to the same library.

I kinda cloned the repo, changed the version in Cargo.toml in a "brace yourselves" kinda fashion to see what breaks and what I would end up fixing, and it seems that bumping doesn't break building nor tests ๐Ÿ˜ƒ

Is is possible for the project to update the crate published at crates.io with newer kernel32/libc dependencies?

Thanks for reading, hugs

Error compiling for arm target (raspberry pi)

This error occurres when i try to cross-compile for an arm-v6 taget with rust(082e47636 2015-08-03):

/home/frede/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.1.5/src/backtrace/libunwind.rs:158:29: 158:35 error: use of undeclared type name c_uint
/home/frede/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.1.5/src/backtrace/libunwind.rs:158 type _Unwind_Word = c_uint;
^~~~~~
<cfg_if macros>:1:1: 1:67 note: in expansion of __cfg_if_apply!
<cfg_if macros>:5:1: 6:79 note: expansion site
<cfg_if macros>:1:1: 7:74 note: in expansion of __cfg_if_items!
<cfg_if macros>:4:1: 6:29 note: expansion site
<cfg_if macros>:1:1: 6:31 note: in expansion of cfg_if!
/home/frede/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.1.5/src/backtrace/mod.rs:79:1: 93:2 note: expansion site
error: aborting due to previous error

UTF8 decoding error in libunwind

We saw our error reporting crash because backtrace seemingly assumed that something was UTF-8 encoded which was not:

Error(Mongo(MongoError (IoError(Error { repr: Custom(Custom { kind: InvalidData, error: StringError("stream did not contain valid UTF-8") }) }))), State { next_error: None, backtrace: Some(stack backtrace:
   0:     0x7f076fac249e - backtrace::backtrace::libunwind::trace
                        at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.4/src/backtrace/libunwind.rs:53
                         - backtrace::backtrace::trace<closure>
                        at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.4/src/backtrace/mod.rs:42
   1:     0x7f076fac2673 - backtrace::capture::{{impl}}::new_unresolved
                        at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.4/src/capture.rs:88
                         - backtrace::capture::{{impl}}::new
                        at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.4/src/capture.rs:63
   2:     0x7f076fac18c7 - error_chain::make_backtrace
                        at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/error-chain-0.11.0/src/lib.rs:616
   3:     0x7f076fac1968 - error_chain::{{impl}}::default
                        at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/error-chain-0.11.0/src/lib.rs:710

Reading the relevant code I'm not sure how this is possible, maybe I'm misinterpreting this trace? This was running on Ubuntu 14.04. I suspect that the underlying error is Mongo returning some invalid UTF-8 in an error message which ended up in the backtrace somehow.

Compilation for android failing on windows - preprocessor sanity check fails

When compiling a project that has backtrace-rs as a dependency, I get this:

"sh" "C:/Users/thoma/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.12/src/libbacktrace/configure" "--with-pic" "--disable-multilib" "--disable-shared" "--disable-host-shared" "--host=arm-linux-androideabi"
running: "sh" "C:/Users/thoma/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.12/src/libbacktrace/configure" "--with-pic" "--disable-multilib" "--disable-shared" "--disable-host-shared" "--host=arm-linux-androideabi"
configure: loading site script /usr/local/etc/config.site
checking build system type... x86_64-pc-msys
checking host system type... arm-unknown-linux-androideabi
checking target system type... arm-unknown-linux-androideabi
checking for arm-linux-androideabi-gcc... C:\Users\thoma\dev\tools\android-ndk-r14b\toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64\bin/arm-linux-androideabi-gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... yes
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether C:\Users\thoma\dev\tools\android-ndk-r14b\toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64\bin/arm-linux-androideabi-gcc accepts -g... yes
checking for C:\Users\thoma\dev\tools\android-ndk-r14b\toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64\bin/arm-linux-androideabi-gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... /lib/cpp

After this, it fails. Here's stderr:

--- stderr
configure: WARNING: If you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used.
configure: error: in `/c/Users/thoma/dev/practice/rust-android/android_test/target/arm-linux-androideabi/debug/build/backtrace-sys-19334c94e1ccd578/out':
configure: error: C preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details.
thread 'main' panicked at 'failed with: exit code: 1', C:\Users\thoma\.cargo\registry\src\github.com-1ecc6299db9ec823\backtrace-sys-0.1.12\build.rs:173
stack backtrace:
... stuff
             at .\build.rs:173
   7: build_script_build::main
             at .\build.rs:123
   8: _rust_maybe_catch_panic
... More stuff

Having a look at the config.log, I find this:

configure:3404: checking how to run the C preprocessor
configure:3435: C:\Users\thoma\dev\tools\android-ndk-r14b\toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64\bin/arm-linux-androideabi-gcc -E  conftest.c
In file included from c:\users\thoma\dev\tools\android-ndk-r14b\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.9.x\include-fixed\syslimits.h:7:0,
                 from c:\users\thoma\dev\tools\android-ndk-r14b\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.9.x\include-fixed\limits.h:34,
                 from conftest.c:10:
c:\users\thoma\dev\tools\android-ndk-r14b\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.9.x\include-fixed\limits.h:168:61: error: no include path in which to search for limits.h
 #include_next <limits.h>  /* recurse down to the real one */
                                                             ^
configure:3435: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "package-unused"
| #define PACKAGE_TARNAME "libbacktrace"
| #define PACKAGE_VERSION "version-unused"
| #define PACKAGE_STRING "package-unused version-unused"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /* end confdefs.h.  */
| #ifdef __STDC__
| # include <limits.h>
| #else
| # include <assert.h>
| #endif
| 		     Syntax error

And more following this, but with assert.h: No such file or directory.

I believe this might be because my environment is misconfigured, but I can compile a hello world program with GCC in C that includes assert.h. I figured it was an NDK problem (using NDK's gcc), but I've downloaded the latest version and the one before that, to no avail.

Is this an issue with including the --build flag somewhere in configure? I'd search through it, but it's like 10k lines long._. Do I just have a bad setup?

Thanks!

P.S.

Have tried this on both stable GNU and stable MSVC compilers on Windows 10.

Broken on latest nightly

On Linux using the latest nightly (01-31-2017), the library fails due to undefined references. cargo test results in:

$ cargo test
    Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
     Running target/debug/deps/backtrace-8f69c3ae17590833

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured

     Running target/debug/deps/smoke-b4bc19c251bc60fa

running 2 tests
test smoke_test_frames ... ok
test many_threads ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured

   Doc-tests backtrace

running 4 tests
test backtrace::trace_0 ... ok
test symbolize::resolve_0 ... FAILED
test _0 ... FAILED
test capture::Backtrace::new_0 ... FAILED

failures:

---- symbolize::resolve_0 stdout ----
	warning: unused variable: `symbol`, #[warn(unused_variables)] on by default
 --> <anon>:7:33
  |
7 |         backtrace::resolve(ip, |symbol| {
  |                                 ^^^^^^

error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/home/u1/sbenitez/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/tmp/rustdoctest.BKeX4H9JaL0D/rust_out.0.o" "-o" "/tmp/rustdoctest.BKeX4H9JaL0D/rust_out" "-Wl,--gc-sections" "-pie" "-nodefaultlibs" "-L" "/tmp/backtrace-rs/target/debug/deps" "-L" "/home/u1/sbenitez/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "/tmp/backtrace-rs/target/debug/deps/libbacktrace-e72a309f309020de.rlib" "/tmp/backtrace-rs/target/debug/deps/librustc_demangle-ffe0cd46130fc1c4.rlib" "/tmp/backtrace-rs/target/debug/deps/libbacktrace_sys-efea7818ed02b81a.rlib" "/tmp/backtrace-rs/target/debug/deps/liblibc-2a4507ee5e52ea3e.rlib" "/tmp/backtrace-rs/target/debug/deps/libcfg_if-5cf5b4dd25466da1.rlib" "-L" "/home/u1/sbenitez/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-l" "std-93390f7535a2b2f7" "/home/u1/sbenitez/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-5d4fca8590bb0079.rlib" "-l" "util" "-l" "dl" "-l" "rt" "-l" "pthread" "-l" "gcc_s" "-l" "pthread" "-l" "c" "-l" "m" "-l" "rt" "-l" "util"
  = note: /tmp/backtrace-rs/target/debug/deps/libbacktrace-e72a309f309020de.rlib(backtrace-e72a309f309020de.0.o): In function `backtrace::symbolize::libbacktrace::init_state::{{closure}}':
          /tmp/backtrace-rs/src/symbolize/mod.rs:159: undefined reference to `backtrace_create_state'
          /tmp/backtrace-rs/target/debug/deps/libbacktrace-e72a309f309020de.rlib(backtrace-e72a309f309020de.0.o): In function `backtrace::symbolize::libbacktrace::resolve':
          /tmp/backtrace-rs/src/symbolize/mod.rs:159: undefined reference to `backtrace_pcinfo'
          /tmp/backtrace-rs/src/symbolize/mod.rs:159: undefined reference to `backtrace_syminfo'
          collect2: error: ld returned 1 exit status


error: aborting due to previous error

thread 'rustc' panicked at 'Box<Any>', /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/librustc_errors/lib.rs:453
note: Run with `RUST_BACKTRACE=1` for a backtrace.
thread 'rustc' panicked at 'couldn't compile the test', /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/librustdoc/test.rs:265

---- _0 stdout ----
	warning: unused variable: `symbol_address`, #[warn(unused_variables)] on by default
 --> <anon>:6:13
  |
6 |         let symbol_address = frame.symbol_address();
  |             ^^^^^^^^^^^^^^

warning: unused variable: `name`, #[warn(unused_variables)] on by default
  --> <anon>:10:25
   |
10 |             if let Some(name) = symbol.name() {
   |                         ^^^^

warning: unused variable: `filename`, #[warn(unused_variables)] on by default
  --> <anon>:13:25
   |
13 |             if let Some(filename) = symbol.filename() {
   |                         ^^^^^^^^

error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/home/u1/sbenitez/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/tmp/rustdoctest.I0qW5cADJTz7/rust_out.0.o" "-o" "/tmp/rustdoctest.I0qW5cADJTz7/rust_out" "-Wl,--gc-sections" "-pie" "-nodefaultlibs" "-L" "/tmp/backtrace-rs/target/debug/deps" "-L" "/home/u1/sbenitez/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "/tmp/backtrace-rs/target/debug/deps/libbacktrace-e72a309f309020de.rlib" "/tmp/backtrace-rs/target/debug/deps/librustc_demangle-ffe0cd46130fc1c4.rlib" "/tmp/backtrace-rs/target/debug/deps/libbacktrace_sys-efea7818ed02b81a.rlib" "/tmp/backtrace-rs/target/debug/deps/liblibc-2a4507ee5e52ea3e.rlib" "/tmp/backtrace-rs/target/debug/deps/libcfg_if-5cf5b4dd25466da1.rlib" "-L" "/home/u1/sbenitez/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-l" "std-93390f7535a2b2f7" "/home/u1/sbenitez/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-5d4fca8590bb0079.rlib" "-l" "util" "-l" "dl" "-l" "rt" "-l" "pthread" "-l" "gcc_s" "-l" "pthread" "-l" "c" "-l" "m" "-l" "rt" "-l" "util"
  = note: /tmp/backtrace-rs/target/debug/deps/libbacktrace-e72a309f309020de.rlib(backtrace-e72a309f309020de.0.o): In function `backtrace::symbolize::libbacktrace::init_state::{{closure}}':
          /tmp/backtrace-rs/src/symbolize/mod.rs:159: undefined reference to `backtrace_create_state'
          /tmp/backtrace-rs/target/debug/deps/libbacktrace-e72a309f309020de.rlib(backtrace-e72a309f309020de.0.o): In function `backtrace::symbolize::libbacktrace::resolve':
          /tmp/backtrace-rs/src/symbolize/mod.rs:159: undefined reference to `backtrace_pcinfo'
          /tmp/backtrace-rs/src/symbolize/mod.rs:159: undefined reference to `backtrace_syminfo'
          collect2: error: ld returned 1 exit status


error: aborting due to previous error

thread 'rustc' panicked at 'Box<Any>', /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/librustc_errors/lib.rs:453
thread 'rustc' panicked at 'couldn't compile the test', /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/librustdoc/test.rs:265

---- capture::Backtrace::new_0 stdout ----
	warning: unused variable: `current_backtrace`, #[warn(unused_variables)] on by default
 --> <anon>:5:5
  |
5 | let current_backtrace = Backtrace::new();
  |     ^^^^^^^^^^^^^^^^^

error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/home/u1/sbenitez/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/tmp/rustdoctest.drtYPrbUoAPN/rust_out.0.o" "-o" "/tmp/rustdoctest.drtYPrbUoAPN/rust_out" "-Wl,--gc-sections" "-pie" "-nodefaultlibs" "-L" "/tmp/backtrace-rs/target/debug/deps" "-L" "/home/u1/sbenitez/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "/tmp/backtrace-rs/target/debug/deps/libbacktrace-e72a309f309020de.rlib" "/tmp/backtrace-rs/target/debug/deps/librustc_demangle-ffe0cd46130fc1c4.rlib" "/tmp/backtrace-rs/target/debug/deps/libbacktrace_sys-efea7818ed02b81a.rlib" "/tmp/backtrace-rs/target/debug/deps/liblibc-2a4507ee5e52ea3e.rlib" "/tmp/backtrace-rs/target/debug/deps/libcfg_if-5cf5b4dd25466da1.rlib" "-L" "/home/u1/sbenitez/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-l" "std-93390f7535a2b2f7" "/home/u1/sbenitez/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-5d4fca8590bb0079.rlib" "-l" "util" "-l" "dl" "-l" "rt" "-l" "pthread" "-l" "gcc_s" "-l" "pthread" "-l" "c" "-l" "m" "-l" "rt" "-l" "util"
  = note: /tmp/backtrace-rs/target/debug/deps/libbacktrace-e72a309f309020de.rlib(backtrace-e72a309f309020de.0.o): In function `backtrace::symbolize::libbacktrace::init_state::{{closure}}':
          /tmp/backtrace-rs/src/symbolize/mod.rs:159: undefined reference to `backtrace_create_state'
          /tmp/backtrace-rs/target/debug/deps/libbacktrace-e72a309f309020de.rlib(backtrace-e72a309f309020de.0.o): In function `backtrace::symbolize::libbacktrace::resolve':
          /tmp/backtrace-rs/src/symbolize/mod.rs:159: undefined reference to `backtrace_pcinfo'
          /tmp/backtrace-rs/src/symbolize/mod.rs:159: undefined reference to `backtrace_syminfo'
          collect2: error: ld returned 1 exit status


error: aborting due to previous error

thread 'rustc' panicked at 'Box<Any>', /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/librustc_errors/lib.rs:453
thread 'rustc' panicked at 'couldn't compile the test', /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/librustdoc/test.rs:265


failures:
    _0
    capture::Backtrace::new_0
    symbolize::resolve_0

test result: FAILED. 1 passed; 3 failed; 0 ignored; 0 measured

error: test failed

Cross compile for arm-unknown-linux-musleabihf: configure: error: C compiler cannot create executables

.cargo/config

[target.arm-unknown-linux-musleabihf]
linker = "/home/oleg/bin/buildroot-2017.02.10/output/host/usr/bin/arm-buildroot-linux-musleabihf-gcc-5.4.0.br_real"

cargo build --target=arm-unknown-linux-musleabihf
yields an error:

running: "sh" "/home/oleg/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.16/src/libbacktrace/configure" "--with-pic" "--disable-multilib" "--disable-shared" "--disable-host-shared" "--host=arm-unknown-linux-musleabihf" "--build=x86_64-unknown-linux-gnu"
configure: loading site script /usr/share/site/x86_64-unknown-linux-gnu
checking build system type... x86_64-unknown-linux-gnu
checking host system type... arm-unknown-linux-musleabihf
checking target system type... arm-unknown-linux-musleabihf
checking for arm-unknown-linux-musleabihf-gcc... arm-linux-musleabihf-gcc
checking for C compiler default output file name... 

--- stderr
configure: error: in `/home/oleg/projects/bbb_webui/target/arm-unknown-linux-musleabihf/debug/build/backtrace-sys-2f65fb215f9723a3/out':
configure: error: C compiler cannot create executables
See `config.log' for more details.

To make it work I have to specify CC through env:
CC=/home/oleg/bin/buildroot-2017.02.10/output/host/usr/bin/arm-buildroot-linux-musleabihf-gcc-5.4.0.br_real cargo build --target=arm-unknown-linux-musleabihf

Don't know exactly how to fix it properly, but anyway.
rustc 1.26.0-nightly (322d7f7b9 2018-02-25)
cargo 0.26.0-nightly (1d6dfea44 2018-01-26)

Relative path

Currently, all the frames shows absolute path for the rust files. That's not really easy to read. Instead, they could show relative path if the path is a child of the current directory. That way, for your crate, you would see src/lib.rs instead of the full path.

Missing library on Ubuntu 17.10

$ cargo build
Compiling backtrace-sys v0.1.16
error: could not find native static library backtrace, perhaps an -L flag is missing?

error: Could not compile backtrace-sys.
$ uname -a
Linux UBUNTU 4.13.0-25-generic #29-Ubuntu SMP Mon Jan 8 21:14:41 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
$ lsb_release -r
Release: 17.10
$ rustc --version
rustc 1.23.0 (766bd11c8 2018-01-01)
$ cargo --version
cargo 0.24.0 (45043115c 2017-12-05)

Is there a specific prerequisite?

musl-gcc required when building with target=x86_64-unknown-linux-musl

When building backtrace-sys for x86_64-unknown-linux-musl I got the following errors:

error: failed to run custom build command for `backtrace-sys v0.1.10`
...
configure: error: C compiler cannot create executables
See `config.log' for more details.

Opening up the config.log i saw:

musl-gcc: command not found

On ubuntu I can fix this with apt-get install musl-tools.

I suspect there is no workaround for this, but it probably should be noted in the readme that a compiler is required to build this, and specifically musl-gcc if building for the the musl target.

SymbolName.as_str() returns the original mangled name

Hi, why does SymbolName.as_str() returns the mangled name and not the demangled name?
Because to get the demangled name, I need to call to_string(). Could we maybe change the interface? I could create a pull request. Or do you try to minimize the number of allocations?

Fails to compile with `-C target-cpu=native`

When trying to compile a project that somehow depends on backtrace-rs with RUSTFLAGS="-C target-cpu=native, I get:

error: failed to run custom build command for `backtrace-sys v0.1.4`
process didn't exit successfully: `/*some path*/target/release/build/backtrace-sys-4a333e150e37ba3b/build-script-build` (signal: 4, SIGILL: illegal instruction)

Ubuntu 16.04 (64bit) and i7-6700HQ, if important.

Cross compile fails with: configure: error: C compiler cannot create executables

I'm trying to cross compile rust for a mipsel target using a poky toolchain. I don't think this is a duplicate of #89 because I have set CC. backtrace-sys fails because it thinks it should build with x86_64 as host/target.

How do I make it understand it shouldn't?

$ xargo build --target mipsel-poky-linux
...
lots of output
...

error: failed to run custom build command for `backtrace-sys v0.1.16`
process didn't exit successfully: `/home/user/Repositories/hello-rust/old/target/release/build/backtrace-sys-a963d1d7bf901961/build-script-build` (exit code: 101)
--- stdout
OPT_LEVEL = Some("3")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
CC_x86_64-unknown-linux-gnu = None
CC_x86_64_unknown_linux_gnu = None
HOST_CC = None
CC = Some("mipsel-poky-linux-gcc -mel -mabi=32 -msoft-float -march=34kc -msynci --sysroot=/home/user/SDK/2.3.2/sysroots/mips32r2el-nf-poky-linux")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
CFLAGS_x86_64-unknown-linux-gnu = None
CFLAGS_x86_64_unknown_linux_gnu = None
HOST_CFLAGS = None
CFLAGS = Some(" -O2 -pipe")
DEBUG = Some("false")
running: "sh" "/home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.16/src/libbacktrace/configure" "--with-pic" "--disable-multilib" "--disable-shared" "--disable-host-shared" "--host=x86_64-unknown-linux-gnu" "--build=x86_64-unknown-linux-gnu"
configure: loading site script /home/user/SDK/2.3.2/site-config-mips32r2el-nf-poky-linux
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for x86_64-unknown-linux-gnu-gcc... mipsel-poky-linux-gcc
checking for C compiler default output file name...

--- stderr
configure: error: in `/home/user/Repositories/hello-rust/old/target/release/build/backtrace-sys-cb31f2d9c5339c6b/out':
configure: error: C compiler cannot create executables
See `config.log' for more details.
thread 'main' panicked at 'failed with: exit code: 77', /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.16/build.rs:176:9
note: Run with `RUST_BACKTRACE=1` for a backtrace.

warning: build failed, waiting for other jobs to finish...
error: build failed
Makefile:21: recipe for target 'xargo' failed
make: *** [xargo] Error 101

I have a bazilion of environment flags set:

AR=mipsel-poky-linux-ar
ARCH=mips
AS=mipsel-poky-linux-as
CC=mipsel-poky-linux-gcc -mel -mabi=32 -msoft-float -march=34kc -msynci --sysroot=/home/user/SDK/2.3.2/sysroots/mips32r2el-nf-poky-linux
CC_mipsel_poky_linux=mipsel-poky-linux-gcc
CFLAGS= -O2 -pipe
CFLAGS_mipsel_poky_linux=-mel -mabi=32 -msoft-float -march=34kc -msynci --sysroot=/home/user/SDK/2.3.2/sysroots/mips32r2el-nf-poky-linux -O2 -pipe
CONFIGURE_FLAGS=--target=mipsel-poky-linux --host=mipsel-poky-linux --build=x86_64-linux --with-libtool-sysroot=/home/user/SDK/2.3.2/sysroots/mips32r2el-nf-poky-linux
CONFIG_SITE=/home/user/SDK/2.3.2/site-config-mips32r2el-nf-poky-linux
CPP=mipsel-poky-linux-gcc -E -mel -mabi=32 -msoft-float -march=34kc -msynci --sysroot=/home/user/SDK/2.3.2/sysroots/mips32r2el-nf-poky-linux
CPPFLAGS=
CXX=mipsel-poky-linux-g++ -mel -mabi=32 -msoft-float -march=34kc -msynci --sysroot=/home/user/SDK/2.3.2/sysroots/mips32r2el-nf-poky-linux
CXXFLAGS=
CXXFLAGS_mipsel_poky_linux=-mel -mabi=32 -msoft-float -march=34kc -msynci --sysroot=/home/user/SDK/2.3.2/sysroots/mips32r2el-nf-poky-linux
CXX_mipsel_poky_linux=mipsel-poky-linux-g++
GDB=mipsel-poky-linux-gdb
LD=mipsel-poky-linux-ld  --sysroot=/home/user/SDK/2.3.2/sysroots/mips32r2el-nf-poky-linux
LDFLAGS=-Wl,-O1
LD_LIBRARY_PATH=/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib
NM=mipsel-poky-linux-nm
OBJCOPY=mipsel-poky-linux-objcopy
OBJDUMP=mipsel-poky-linux-objdump
PKG_CONFIG_ALLOW_CROSS=1
PKG_CONFIG_PATH=/home/user/SDK/2.3.2/sysroots/mips32r2el-nf-poky-linux/usr/lib/pkgconfig:/home/user/SDK/2.3.2/sysroots/mips32r2el-nf-poky-linux/usr/share/pkgconfig
PKG_CONFIG_SYSROOT_DIR=/home/user/SDK/2.3.2/sysroots/mips32r2el-nf-poky-linux
RANLIB=mipsel-poky-linux-ranlib
RUST_TARGET_PATH=/home/user/Repositories/hello-rust/target-specs
STRIP=mipsel-poky-linux-strip
TARGET_PREFIX=mipsel-poky-linux-
TARGET_RUST=mipsel-poky-linux

mipsel-poky-linux.json:

{
    "executables": true, 
    "features": "+mips32r2,+soft-float", 
    "max-atomic-width": 32, 
    "linker-is-gnu": true, 
    "linker": "mipsel-poky-linux-gcc", 
    "ar": "mipsel-poky-linux-ar", 
    "vendor": "unknown", 
    "target-family": "unix", 
    "dynamic-linking": true, 
    "data-layout": "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64", 
    "env": "gnu", 
    "target-c-int-width": "32", 
    "position-independent-executables": true, 
    "linker-flavor": "gcc", 
    "target-endian": "little", 
    "has-rpath": true, 
    "arch": "mips", 
    "relro-level": "full", 
    "llvm-target": "mipsel-unknown-linux-gnu", 
    "has-elf-tls": true, 
    "target-pointer-width": "32", 
    "os": "linux", 
    "cpu": "mips32r2", 
    "pre-link-args": {
        "gcc": [
            "--sysroot=/home/user/SDK/2.3.2/sysroots/mips32r2el-nf-poky-linux", 
            "-Wl,-O1"
        ]
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.