bitemyapp / brotli2-rs

Brotli encoders/decoers for Rust
Apache License 2.0
28 stars 13 forks source link

Error when trying to cross-compile brotli from windows 10 to linux #20

Open warnp opened 6 years ago

warnp commented 6 years ago

Hello, I'm trying to cross compile brotli (wich is shipped in my project) from windows 10 to linux. I installed the toolchain stable-x86_64_unknown-linux-gnu, minGW and gcc via win-builds. I used this command cargo build --target=x86_64_unknown-linux-gnu.

And th compilation fail at brotli with this message :

error: failed to run custom build command for brotli-sys v0.2.1 process didn't exit successfully: D:\Documents\projets_rust\vision_rs\target\debug\build\brotli-sys-7ff947327f076eab\build-script-build (exit code: 101) --- stdout cargo:dec_include=C:\Users\romain.cargo\registry\src\github.com-1ecc6299db9ec823\brotli-sys-0.2.1\brotli/dec cargo:enc_include=C:\Users\romain.cargo\registry\src\github.com-1ecc6299db9ec823\brotli-sys-0.2.1\brotli/enc TARGET = Some("x86_64-unknown-linux-gnu") OPT_LEVEL = Some("0") TARGET = Some("x86_64-unknown-linux-gnu") HOST = Some("x86_64-pc-windows-msvc") TARGET = Some("x86_64-unknown-linux-gnu") TARGET = Some("x86_64-unknown-linux-gnu") HOST = Some("x86_64-pc-windows-msvc") CC_x86_64-unknown-linux-gnu = None CC_x86_64_unknown_linux_gnu = None TARGET_CC = None CC = None HOST = Some("x86_64-pc-windows-msvc") CROSS_COMPILE = None TARGET = Some("x86_64-unknown-linux-gnu") HOST = Some("x86_64-pc-windows-msvc") CFLAGS_x86_64-unknown-linux-gnu = None CFLAGS_x86_64_unknown_linux_gnu = None TARGET_CFLAGS = None CFLAGS = None DEBUG = Some("true") running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-m64" "-Wall" "-Wextra" "-o" "D:\Documents\projets_rust\vision_rs\target\x86_64-unknown-linux-gnu\debug\build\brotli-sys-0fa5776450382a16\out\brotli/common\dictionary.o" "-c" "brotli/common/dictionary.c" cargo:warning=brotli/common/dictionary.c:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default] cargo:warning= /* Copyright 2013 Google Inc. All Rights Reserved. cargo:warning= ^ cargo:warning=cc: error: CreateProcess: No such file or directory exit code: 1

--- stderr fatal: Not a git repository (or any of the parent directories): .git thread 'main' panicked at '

Internal error occurred: Command "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-m64" "-Wall" "-Wextra" "-o" "D:\Documents\projets_rust\vision_rs\target\x86_64-unknown-linux-gnu\debug\build\brotli-sys-0fa5776450382a16\out\brotli/common\dictionary.o" "-c" "brotli/common/dictionary.c" with args "cc" did not execute successfully (status code exit code: 1).

Do you have any clue? Kind regards.

alexcrichton commented 6 years ago

Thanks for the report! I believe the error is that you typically can't compile for Linux from Windows unless you have a compiler set up, in this case the program cc isn't found which is a compiler targeting linux.

shijunti19 commented 4 years ago

Compiling url v2.1.1 error: failed to run custom build command for backtrace-sys v0.1.35

Caused by: process didn't exit successfully: Z:\rust\demo\web\target\debug\build\backtrace-sys-c4175e5320fe378f\build-script-build (exit code: 1) --- stdout cargo:rustc-cfg=rbt TARGET = Some("armv7-unknown-linux-gnueabihf") OPT_LEVEL = Some("0") HOST = Some("x86_64-pc-windows-msvc") CC_armv7-unknown-linux-gnueabihf = None CC_armv7_unknown_linux_gnueabihf = None TARGET_CC = None CC = None CROSS_COMPILE = None CFLAGS_armv7-unknown-linux-gnueabihf = None CFLAGS_armv7_unknown_linux_gnueabihf = None TARGET_CFLAGS = None CFLAGS = None CRATE_CC_NO_DEFAULTS = None

siliangZ commented 3 years ago

Do we have any updates on this issue? I have similar issue when I try to cross compile it for aarch64 on my x86-64 host machine. Here is my error message. _error occurred: Command "aarch64-xilinx-linux-gcc" "-march=armv8-a+crc" "-mtune=cortex-a72.cortex-a53" "--sysroot=/opt/sysroots/aarch64-xilinx-linux" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-O2" "-pipe" "-g" "-feliminate-unused-debug-types" "-I" "brotli/include" "-o" "/home/envision/production/device/APU/src/vitis_ai_rs/target/debug/build/brotli-sys-93b780aede5c3282/out/brotli/common/dictionary.o" "-c" "brotli/common/dictionary.c" with args "aarch64-xilinx-linux-gcc" did not execute successfully (status code exit code: 1)._

akkuankka commented 2 years ago

I've had the same thing cross-compiling from x64 linux to x86_64-pc-windows-gcc. I suspect in my case it could be due to me not having a linker or something because I know that can be necessary sometimes -- I don't have any stuff other than the cargo target installed.

Error message is process didn't exit successfully: `/home/[redacted]/target/debug/build/brotli-sys-52c75b398ed63a05/build-script-build` (exit status: 1) --- stdout cargo:include=/home/[redacted]/.cargo/registry/src/github.com-1ecc6299db9ec823/brotli-sys-0.3.2/brotli/include TARGET = Some("x86_64-pc-windows-gnu") OPT_LEVEL = Some("0") HOST = Some("x86_64-unknown-linux-gnu") CC_x86_64-pc-windows-gnu = None CC_x86_64_pc_windows_gnu = None TARGET_CC = None CC = None CROSS_COMPILE = None CFLAGS_x86_64-pc-windows-gnu = None CFLAGS_x86_64_pc_windows_gnu = None TARGET_CFLAGS = None CFLAGS = None CRATE_CC_NO_DEFAULTS = None DEBUG = Some("true") CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2") running: "x86_64-w64-mingw32-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m64" "-I" "brotli/include" "-o" "/home/[redacted]/target/x86_64-pc-windows-gnu/debug/build/brotli-sys-17fb0b616cd0f3fc/out/brotli/common/dictionary.o" "-c" "brotli/common/dictionary.c"

EDIT: This was resolved in my case by installing the mingw-w64 package through the system package manager. This suggests it might due to not having the cc for whatever target is being built for, at least in my case.