Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unrecognized command line option '-m64' when compiling backtrace-sys #14

Open
legokichi opened this issue Jun 5, 2018 · 2 comments
Open

Comments

@legokichi
Copy link

legokichi commented Jun 5, 2018

host

$ uname -a
Linux mylaptop 4.15.0-22-generic #24-Ubuntu SMP Wed May 16 12:15:17 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04 LTS
Release:	18.04
Codename:	bionic

target (raspberry pi zero w)

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Raspbian
Description:	Raspbian GNU/Linux 9.4 (stretch)
Release:	9.4
Codename:	stretch
$ uname -a
Linux mypi 4.14.34+ #1110 Mon Apr 16 14:51:42 BST 2018 armv6l GNU/Linux

first i try

$ docker run -it --rm -v $(pwd):/source dlecan/rust-crosscompiler-arm:stable

...

error: failed to run custom build command for `backtrace-sys v0.1.23`
process didn't exit successfully: `/source/target/release/build/backtrace-sys-5a024342905aa44a/build-script-build` (exit code: 101)
--- stdout
TARGET = Some("x86_64-unknown-linux-gnu")
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("arm-linux-gnueabihf-gcc-with-link-search")
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("false")
running: "arm-linux-gnueabihf-gcc-with-link-search" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "src/libbacktrace" "-I" "/source/target/release/build/backtrace-sys-1d83a1a263993106/out" "-fvisibility=hidden" "-DBACKTRACE_ELF_SIZE=64" "-DBACKTRACE_SUPPORTED=1" "-DBACKTRACE_USES_MALLOC=1" "-DBACKTRACE_SUPPORTS_THREADS=0" "-DBACKTRACE_SUPPORTS_DATA=0" "-DHAVE_DL_ITERATE_PHDR=1" "-D_GNU_SOURCE=1" "-D_LARGE_FILES=1" "-Dbacktrace_full=__rbt_backtrace_full" "-Dbacktrace_dwarf_add=__rbt_backtrace_dwarf_add" "-Dbacktrace_initialize=__rbt_backtrace_initialize" "-Dbacktrace_pcinfo=__rbt_backtrace_pcinfo" "-Dbacktrace_syminfo=__rbt_backtrace_syminfo" "-Dbacktrace_get_view=__rbt_backtrace_get_view" "-Dbacktrace_release_view=__rbt_backtrace_release_view" "-Dbacktrace_alloc=__rbt_backtrace_alloc" "-Dbacktrace_free=__rbt_backtrace_free" "-Dbacktrace_vector_finish=__rbt_backtrace_vector_finish" "-Dbacktrace_vector_grow=__rbt_backtrace_vector_grow" "-Dbacktrace_vector_release=__rbt_backtrace_vector_release" "-Dbacktrace_close=__rbt_backtrace_close" "-Dbacktrace_open=__rbt_backtrace_open" "-Dbacktrace_print=__rbt_backtrace_print" "-Dbacktrace_simple=__rbt_backtrace_simple" "-Dbacktrace_qsort=__rbt_backtrace_qsort" "-Dbacktrace_create_state=__rbt_backtrace_create_state" "-Dbacktrace_uncompress_zdebug=__rbt_backtrace_uncompress_zdebug" "-o" "/source/target/release/build/backtrace-sys-1d83a1a263993106/out/src/libbacktrace/alloc.o" "-c" "src/libbacktrace/alloc.c"
cargo:warning=arm-linux-gnueabihf-gcc: error: unrecognized command line option '-m64'
exit code: 1

--- stderr
thread 'main' panicked at '

Internal error occurred: Command "arm-linux-gnueabihf-gcc-with-link-search" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "src/libbacktrace" "-I" "/source/target/release/build/backtrace-sys-1d83a1a263993106/out" "-fvisibility=hidden" "-DBACKTRACE_ELF_SIZE=64" "-DBACKTRACE_SUPPORTED=1" "-DBACKTRACE_USES_MALLOC=1" "-DBACKTRACE_SUPPORTS_THREADS=0" "-DBACKTRACE_SUPPORTS_DATA=0" "-DHAVE_DL_ITERATE_PHDR=1" "-D_GNU_SOURCE=1" "-D_LARGE_FILES=1" "-Dbacktrace_full=__rbt_backtrace_full" "-Dbacktrace_dwarf_add=__rbt_backtrace_dwarf_add" "-Dbacktrace_initialize=__rbt_backtrace_initialize" "-Dbacktrace_pcinfo=__rbt_backtrace_pcinfo" "-Dbacktrace_syminfo=__rbt_backtrace_syminfo" "-Dbacktrace_get_view=__rbt_backtrace_get_view" "-Dbacktrace_release_view=__rbt_backtrace_release_view" "-Dbacktrace_alloc=__rbt_backtrace_alloc" "-Dbacktrace_free=__rbt_backtrace_free" "-Dbacktrace_vector_finish=__rbt_backtrace_vector_finish" "-Dbacktrace_vector_grow=__rbt_backtrace_vector_grow" "-Dbacktrace_vector_release=__rbt_backtrace_vector_release" "-Dbacktrace_close=__rbt_backtrace_close" "-Dbacktrace_open=__rbt_backtrace_open" "-Dbacktrace_print=__rbt_backtrace_print" "-Dbacktrace_simple=__rbt_backtrace_simple" "-Dbacktrace_qsort=__rbt_backtrace_qsort" "-Dbacktrace_create_state=__rbt_backtrace_create_state" "-Dbacktrace_uncompress_zdebug=__rbt_backtrace_uncompress_zdebug" "-o" "/source/target/release/build/backtrace-sys-1d83a1a263993106/out/src/libbacktrace/alloc.o" "-c" "src/libbacktrace/alloc.c" with args "arm-linux-gnueabihf-gcc-with-link-search" did not execute successfully (status code exit code: 1).

', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/cc-1.0.17/src/lib.rs:2180:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

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

then arm-linux-gnueabihf-gcc: error: unrecognized command line option '-m64'.

I found this issue rust-lang/backtrace-rs#106 so I try

$ docker run -it --rm -v $(pwd):/source dlecan/rust-crosscompiler-arm:stable \
  env CC=gcc CC_arm_unknown_linux_gnu=arm-linux-gnueabihf-gcc-with-link-search \
  cargo build --release

...

error: failed to run custom build command for `backtrace-sys v0.1.23`
process didn't exit successfully: `/source/target/release/build/backtrace-sys-5a024342905aa44a/build-script-build` (exit code: 101)
--- stdout
TARGET = Some("arm-unknown-linux-gnueabihf")
OPT_LEVEL = Some("3")
TARGET = Some("arm-unknown-linux-gnueabihf")
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("arm-unknown-linux-gnueabihf")
TARGET = Some("arm-unknown-linux-gnueabihf")
HOST = Some("x86_64-unknown-linux-gnu")
CC_arm-unknown-linux-gnueabihf = None
CC_arm_unknown_linux_gnueabihf = None
TARGET_CC = None
CC = Some("gcc")
TARGET = Some("arm-unknown-linux-gnueabihf")
HOST = Some("x86_64-unknown-linux-gnu")
CFLAGS_arm-unknown-linux-gnueabihf = None
CFLAGS_arm_unknown_linux_gnueabihf = None
TARGET_CFLAGS = None
CFLAGS = None
DEBUG = Some("false")
running: "gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-march=armv6" "-marm" "-I" "src/libbacktrace" "-I" "/source/target/arm-unknown-linux-gnueabihf/release/build/backtrace-sys-a4d1a21be0afc81f/out" "-fvisibility=hidden" "-DBACKTRACE_ELF_SIZE=32" "-DBACKTRACE_SUPPORTED=1" "-DBACKTRACE_USES_MALLOC=1" "-DBACKTRACE_SUPPORTS_THREADS=0" "-DBACKTRACE_SUPPORTS_DATA=0" "-DHAVE_DL_ITERATE_PHDR=1" "-D_GNU_SOURCE=1" "-D_LARGE_FILES=1" "-Dbacktrace_full=__rbt_backtrace_full" "-Dbacktrace_dwarf_add=__rbt_backtrace_dwarf_add" "-Dbacktrace_initialize=__rbt_backtrace_initialize" "-Dbacktrace_pcinfo=__rbt_backtrace_pcinfo" "-Dbacktrace_syminfo=__rbt_backtrace_syminfo" "-Dbacktrace_get_view=__rbt_backtrace_get_view" "-Dbacktrace_release_view=__rbt_backtrace_release_view" "-Dbacktrace_alloc=__rbt_backtrace_alloc" "-Dbacktrace_free=__rbt_backtrace_free" "-Dbacktrace_vector_finish=__rbt_backtrace_vector_finish" "-Dbacktrace_vector_grow=__rbt_backtrace_vector_grow" "-Dbacktrace_vector_release=__rbt_backtrace_vector_release" "-Dbacktrace_close=__rbt_backtrace_close" "-Dbacktrace_open=__rbt_backtrace_open" "-Dbacktrace_print=__rbt_backtrace_print" "-Dbacktrace_simple=__rbt_backtrace_simple" "-Dbacktrace_qsort=__rbt_backtrace_qsort" "-Dbacktrace_create_state=__rbt_backtrace_create_state" "-Dbacktrace_uncompress_zdebug=__rbt_backtrace_uncompress_zdebug" "-o" "/source/target/arm-unknown-linux-gnueabihf/release/build/backtrace-sys-a4d1a21be0afc81f/out/src/libbacktrace/alloc.o" "-c" "src/libbacktrace/alloc.c"
cargo:warning=gcc: error: unrecognized command line option '-marm'
exit code: 1

--- stderr
thread 'main' panicked at '

Internal error occurred: Command "gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-march=armv6" "-marm" "-I" "src/libbacktrace" "-I" "/source/target/arm-unknown-linux-gnueabihf/release/build/backtrace-sys-a4d1a21be0afc81f/out" "-fvisibility=hidden" "-DBACKTRACE_ELF_SIZE=32" "-DBACKTRACE_SUPPORTED=1" "-DBACKTRACE_USES_MALLOC=1" "-DBACKTRACE_SUPPORTS_THREADS=0" "-DBACKTRACE_SUPPORTS_DATA=0" "-DHAVE_DL_ITERATE_PHDR=1" "-D_GNU_SOURCE=1" "-D_LARGE_FILES=1" "-Dbacktrace_full=__rbt_backtrace_full" "-Dbacktrace_dwarf_add=__rbt_backtrace_dwarf_add" "-Dbacktrace_initialize=__rbt_backtrace_initialize" "-Dbacktrace_pcinfo=__rbt_backtrace_pcinfo" "-Dbacktrace_syminfo=__rbt_backtrace_syminfo" "-Dbacktrace_get_view=__rbt_backtrace_get_view" "-Dbacktrace_release_view=__rbt_backtrace_release_view" "-Dbacktrace_alloc=__rbt_backtrace_alloc" "-Dbacktrace_free=__rbt_backtrace_free" "-Dbacktrace_vector_finish=__rbt_backtrace_vector_finish" "-Dbacktrace_vector_grow=__rbt_backtrace_vector_grow" "-Dbacktrace_vector_release=__rbt_backtrace_vector_release" "-Dbacktrace_close=__rbt_backtrace_close" "-Dbacktrace_open=__rbt_backtrace_open" "-Dbacktrace_print=__rbt_backtrace_print" "-Dbacktrace_simple=__rbt_backtrace_simple" "-Dbacktrace_qsort=__rbt_backtrace_qsort" "-Dbacktrace_create_state=__rbt_backtrace_create_state" "-Dbacktrace_uncompress_zdebug=__rbt_backtrace_uncompress_zdebug" "-o" "/source/target/arm-unknown-linux-gnueabihf/release/build/backtrace-sys-a4d1a21be0afc81f/out/src/libbacktrace/alloc.o" "-c" "src/libbacktrace/alloc.c" with args "gcc" did not execute successfully (status code exit code: 1).

', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/cc-1.0.17/src/lib.rs:2180:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

warning: build failed, waiting for other jobs to finish...
error: failed to run custom build command for `brotli-sys v0.3.2`
process didn't exit successfully: `/source/target/release/build/brotli-sys-3a3f972ddefcc2e2/build-script-build` (exit code: 101)
--- stdout
cargo:include=/root/.cargo/registry/src/github.com-1ecc6299db9ec823/brotli-sys-0.3.2/brotli/include
TARGET = Some("arm-unknown-linux-gnueabihf")
OPT_LEVEL = Some("3")
TARGET = Some("arm-unknown-linux-gnueabihf")
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("arm-unknown-linux-gnueabihf")
TARGET = Some("arm-unknown-linux-gnueabihf")
HOST = Some("x86_64-unknown-linux-gnu")
CC_arm-unknown-linux-gnueabihf = None
CC_arm_unknown_linux_gnueabihf = None
TARGET_CC = None
CC = Some("gcc")
TARGET = Some("arm-unknown-linux-gnueabihf")
HOST = Some("x86_64-unknown-linux-gnu")
CFLAGS_arm-unknown-linux-gnueabihf = None
CFLAGS_arm_unknown_linux_gnueabihf = None
TARGET_CFLAGS = None
CFLAGS = None
DEBUG = Some("false")
running: "gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-march=armv6" "-marm" "-I" "brotli/include" "-o" "/source/target/arm-unknown-linux-gnueabihf/release/build/brotli-sys-6d34026ac06d4834/out/brotli/common/dictionary.o" "-c" "brotli/common/dictionary.c"
cargo:warning=gcc: error: unrecognized command line option '-marm'
exit code: 1

--- stderr
thread 'main' panicked at '

Internal error occurred: Command "gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-march=armv6" "-marm" "-I" "brotli/include" "-o" "/source/target/arm-unknown-linux-gnueabihf/release/build/brotli-sys-6d34026ac06d4834/out/brotli/common/dictionary.o" "-c" "brotli/common/dictionary.c" with args "gcc" did not execute successfully (status code exit code: 1).

', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/cc-1.0.17/src/lib.rs:2180:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

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

and then gcc: error: unrecognized command line option '-marm'.

finaly this setting works

$ docker run -it --rm -v $(pwd):/source dlecan/rust-crosscompiler-arm:stable \
  env CC=arm-linux-gnueabihf-gcc CC_arm_unknown_linux_gnu=arm-linux-gnueabihf-gcc-with-link-search \
  cargo build --release

it works!

@theronic
Copy link

I'm seeing the same error trying to compile for RPi Zero, with or without your env settings.

   Compiling wiringpi v0.2.4
error: failed to run custom build command for `backtrace-sys v0.1.24`
process didn't exit successfully: `/source/target/release/build/backtrace-sys-723f8a9620720191/build-script-build` (exit code: 101)
--- stdout
TARGET = Some("x86_64-unknown-linux-gnu")
OPT_LEVEL = Some("3")
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("arm-linux-gnueabihf-gcc")
CFLAGS_x86_64-unknown-linux-gnu = None
CFLAGS_x86_64_unknown_linux_gnu = None
HOST_CFLAGS = None
CFLAGS = None
DEBUG = Some("false")
running: "arm-linux-gnueabihf-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "src/libbacktrace" "-I" "/source/target/release/build/backtrace-sys-9444549bf911ecd5/out" "-fvisibility=hidden" "-DBACKTRACE_ELF_SIZE=64" "-DBACKTRACE_SUPPORTED=1" "-DBACKTRACE_USES_MALLOC=1" "-DBACKTRACE_SUPPORTS_THREADS=0" "-DBACKTRACE_SUPPORTS_DATA=0" "-DHAVE_DL_ITERATE_PHDR=1" "-D_GNU_SOURCE=1" "-D_LARGE_FILES=1" "-Dbacktrace_full=__rbt_backtrace_full" "-Dbacktrace_dwarf_add=__rbt_backtrace_dwarf_add" "-Dbacktrace_initialize=__rbt_backtrace_initialize" "-Dbacktrace_pcinfo=__rbt_backtrace_pcinfo" "-Dbacktrace_syminfo=__rbt_backtrace_syminfo" "-Dbacktrace_get_view=__rbt_backtrace_get_view" "-Dbacktrace_release_view=__rbt_backtrace_release_view" "-Dbacktrace_alloc=__rbt_backtrace_alloc" "-Dbacktrace_free=__rbt_backtrace_free" "-Dbacktrace_vector_finish=__rbt_backtrace_vector_finish" "-Dbacktrace_vector_grow=__rbt_backtrace_vector_grow" "-Dbacktrace_vector_release=__rbt_backtrace_vector_release" "-Dbacktrace_close=__rbt_backtrace_close" "-Dbacktrace_open=__rbt_backtrace_open" "-Dbacktrace_print=__rbt_backtrace_print" "-Dbacktrace_simple=__rbt_backtrace_simple" "-Dbacktrace_qsort=__rbt_backtrace_qsort" "-Dbacktrace_create_state=__rbt_backtrace_create_state" "-Dbacktrace_uncompress_zdebug=__rbt_backtrace_uncompress_zdebug" "-o" "/source/target/release/build/backtrace-sys-9444549bf911ecd5/out/src/libbacktrace/alloc.o" "-c" "src/libbacktrace/alloc.c"
cargo:warning=arm-linux-gnueabihf-gcc: error: unrecognized command line option '-m64'
exit code: 1

--- stderr
thread 'main' panicked at '

Internal error occurred: Command "arm-linux-gnueabihf-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "src/libbacktrace" "-I" "/source/target/release/build/backtrace-sys-9444549bf911ecd5/out" "-fvisibility=hidden" "-DBACKTRACE_ELF_SIZE=64" "-DBACKTRACE_SUPPORTED=1" "-DBACKTRACE_USES_MALLOC=1" "-DBACKTRACE_SUPPORTS_THREADS=0" "-DBACKTRACE_SUPPORTS_DATA=0" "-DHAVE_DL_ITERATE_PHDR=1" "-D_GNU_SOURCE=1" "-D_LARGE_FILES=1" "-Dbacktrace_full=__rbt_backtrace_full" "-Dbacktrace_dwarf_add=__rbt_backtrace_dwarf_add" "-Dbacktrace_initialize=__rbt_backtrace_initialize" "-Dbacktrace_pcinfo=__rbt_backtrace_pcinfo" "-Dbacktrace_syminfo=__rbt_backtrace_syminfo" "-Dbacktrace_get_view=__rbt_backtrace_get_view" "-Dbacktrace_release_view=__rbt_backtrace_release_view" "-Dbacktrace_alloc=__rbt_backtrace_alloc" "-Dbacktrace_free=__rbt_backtrace_free" "-Dbacktrace_vector_finish=__rbt_backtrace_vector_finish" "-Dbacktrace_vector_grow=__rbt_backtrace_vector_grow" "-Dbacktrace_vector_release=__rbt_backtrace_vector_release" "-Dbacktrace_close=__rbt_backtrace_close" "-Dbacktrace_open=__rbt_backtrace_open" "-Dbacktrace_print=__rbt_backtrace_print" "-Dbacktrace_simple=__rbt_backtrace_simple" "-Dbacktrace_qsort=__rbt_backtrace_qsort" "-Dbacktrace_create_state=__rbt_backtrace_create_state" "-Dbacktrace_uncompress_zdebug=__rbt_backtrace_uncompress_zdebug" "-o" "/source/target/release/build/backtrace-sys-9444549bf911ecd5/out/src/libbacktrace/alloc.o" "-c" "src/libbacktrace/alloc.c" with args "arm-linux-gnueabihf-gcc" did not execute successfully (status code exit code: 1).

', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/cc-1.0.25/src/lib.rs:2260:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

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

Any ideas?

@theronic
Copy link

theronic commented Jan 22, 2019

Made some progress by setting CC=gcc instead of CC=arm-linux-gnueabihf-gcc, but now I get this for hidapi and wiringpi:

error: failed to run custom build command for `wiringpi v0.2.4`
process didn't exit successfully: `/source/target/debug/build/wiringpi-abf2f2b7d89fa679/build-script-build` (exit code: 101)
--- stdout
TARGET = Some("arm-unknown-linux-gnueabihf")
OPT_LEVEL = Some("0")
HOST = Some("x86_64-unknown-linux-gnu")
CC_arm-unknown-linux-gnueabihf = None
CC_arm_unknown_linux_gnueabihf = None
TARGET_CC = None
CC = Some("gcc")
CFLAGS_arm-unknown-linux-gnueabihf = None
CFLAGS_arm_unknown_linux_gnueabihf = None
TARGET_CFLAGS = None
CFLAGS = None
DEBUG = Some("true")
running: "gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-march=armv6" "-marm" "-static" "-I" "wiringPi/" "-I" "wiringPi/wiringPi/" "-Wall" "-Wextra" "-o" "/source/target/arm-unknown-linux-gnueabihf/debug/build/wiringpi-88ef79ea228b60a2/out/wiringPi/wiringPi/ads1115.o" "-c" "wiringPi/wiringPi/ads1115.c"
cargo:warning=gcc: error: unrecognized command line option '-marm'
exit code: 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants