germangb / minimp3-rs

minimp3 rust bindings + wrapper
MIT License
66 stars 22 forks source link

Hope to support Windows #15

Closed tingfeng-key closed 4 years ago

tingfeng-key commented 5 years ago

Hope to support Windows

germangb commented 5 years ago

It should build on windows (as long as you have the MSVC toolchain installed)

I haven't tested myself, but maybe take a look at #3 and #9. Did you run into any issues?

tingfeng-key commented 5 years ago

hi, I try to run the command in mac book: cargo build --release --target i686-pc-windows-msvc, it tipped:

error: failed to run custom build command for `minimp3-sys v0.3.1`
process didn't exit successfully: `/Users/wzl/learn/rust/ts_rose/ts_music_player/target/release/build/minimp3-sys-338c40d8762c245a/build-script-build` (exit code: 1)
--- stdout
TARGET = Some("i686-pc-windows-msvc")
OPT_LEVEL = Some("3")
HOST = Some("x86_64-apple-darwin")
CC_i686-pc-windows-msvc = None
CC_i686_pc_windows_msvc = None
TARGET_CC = None
CC = None
CROSS_COMPILE = None
CFLAGS_i686-pc-windows-msvc = None
CFLAGS_i686_pc_windows_msvc = None
TARGET_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("false")
CARGO_CFG_TARGET_FEATURE = Some("fxsr,mmx,sse,sse2")
running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m32" "-I" "minimp3/" "-Wall" "-Wextra" "-DMINIMP3_IMPLEMENTATION" "/Fo/Users/wzl/learn/rust/ts_rose/ts_music_player/target/i686-pc-windows-msvc/release/build/minimp3-sys-fb59b10caf91dff5/out/minimp3.o" "/c" "minimp3.c"
cargo:warning=clang: error: no such file or directory: '/Fo/Users/wzl/learn/rust/ts_rose/ts_music_player/target/i686-pc-windows-msvc/release/build/minimp3-sys-fb59b10caf91dff5/out/minimp3.o'
cargo:warning=clang: error: no such file or directory: '/c'
exit code: 1

--- stderr

error occurred: Command "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m32" "-I" "minimp3/" "-Wall" "-Wextra" "-DMINIMP3_IMPLEMENTATION" "/Fo/Users/wzl/learn/rust/ts_rose/ts_music_player/target/i686-pc-windows-msvc/release/build/minimp3-sys-fb59b10caf91dff5/out/minimp3.o" "/c" "minimp3.c" with args "cc" did not execute successfully (status code exit code: 1).

warning: build failed, waiting for other jobs to finish...
germangb commented 5 years ago

Weird. I don't have experience with cross compilation. Perhaps the current build.rs doesn't support it. I'm using the cc crate to build the C files, which states:

CRATE_CC_NO_DEFAULTS - the default compiler flags may cause conflicts in some cross compiling scenarios. Setting this variable will disable the generation of default compiler flags.

Can you try building with the CRATE_CC_NO_DEFAULTS environment variable?

$ CRATE_CC_NO_DEFAULTS=1 cargo build --release --target i686-pc-windows-msvc
Boscop commented 4 years ago

It builds on windows. Can this be closed?