Ogeon / rustful

[OUTDATED] A light HTTP framework for Rust
https://docs.rs/rustful
Apache License 2.0
862 stars 52 forks source link

Compiling for ios simulator fails #110

Closed andrewspinks closed 8 years ago

andrewspinks commented 8 years ago

When building for the ios simulator a library which with rustful as a dependency I get the following error.

cargo build --target=x86_64-apple-ios
...
Compiling rustful v0.8.0
rustful-0.8.0/src/file.rs:7:1: 7:48 error: couldn't read "/../target/x86_64-apple-ios/debug/build/rustful-b24589c9846c5b80/out/mime.rs": No such file or directory (os error 2)
rustful-0.8.0/src/file.rs:7 include!(concat!(env!("OUT_DIR"), "/mime.rs"));

(note, I chopped some of the paths above) When I remove the --target flag, it works fine.

uglyog commented 8 years ago

Cross compiling fails for the same reason.

uglyog commented 8 years ago
$ cargo build --release --target i686-pc-windows-gnu
Build failed, waiting for other jobs to finish...
error: failed to run custom build command for `rustful v0.8.0`
Process didn't exit successfully: `/home/ronald/Development/Projects/Pact/pact-reference/rust/v1/pact_mock_server_cli/target/release/build/rustful-b24589c9846c5b80/build-script-main` (exit code: 101)
--- stderr
thread '<main>' panicked at 'could not create '/home/ronald/Development/Projects/Pact/pact-reference/rust/v1/pact_mock_server_cli/target/release/build/rustful-b24589c9846c5b80/out/mime.rs': No such file or directory (os error 2)', /home/ronald/.cargo/registry/src/github.com-88ac128001ac3a9a/rustful-0.8.0/build/mime.rs:21
note: Run with `RUST_BACKTRACE=1` for a backtrace.
Ogeon commented 8 years ago

Thank you, guys, for taking your time to report this. I have managed to reproduce it with the i686-pc-windows-gnu target and it looks like the value of OUT_DIR is different when running the build script and when compiling the final library. This post says that it's due to the use of env! instead of env::var (strange that I haven't seen it before), so it's indeed a bug, but it will be a quick fix. I'll see if I can patch it up in a moment.

Ogeon commented 8 years ago

There's a fixed version in the fix_build_script branch that you can try. I would appreciate it if you could verify that it works for you. Just change your Cargo.toml to include Rustful like this:

[dependencies.rustful]
git = "https://github.com/Ogeon/rustful"
branch = "fix_build_script"
andrewspinks commented 8 years ago

@Ogeon Yep, that fixes it for me. Thanks!

Ogeon commented 8 years ago

Great! Then I'll make a release later today.