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

Fix compiling libstd with emscripten target. #31985

Merged
merged 1 commit into from
Mar 2, 2016
Merged

Fix compiling libstd with emscripten target. #31985

merged 1 commit into from
Mar 2, 2016

Conversation

ashleysommer
Copy link
Contributor

Was getting error:

running: "sh" "/home/flubba86/rust/src/libstd/../libbacktrace/configure" "--with-pic" "--disable-multilib" "--disable-shared" "--disable-host-shared" "--host=asmjs-unknown-emscripten" "--build=x86_64-unknown-linux-gnu"
...
Invalid configuration `asmjs-unknown-emscripten': system `emscripten' not recognized

This commit adds the emscripten target to the libbacktrace configure script so it is no longer unrecognized.

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @brson (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@alexcrichton
Copy link
Member

This is actually code that we don't ourselves control because it comes from upstream, but we also shouldn't try to compile libbacktrace when compiling for emscripten. Could you elaborate on how you ran into this error?

@ashleysommer
Copy link
Contributor Author

Just doing cargo build --target=asmjs-unknown-emscripten --release in the libstd directory.
Full error:

flubba86@localhost:~/rust/src/libstd$ /usr/local/rustjs/bin/cargo build --target=asmjs-unknown-emscripten --release
Adding directories to PATH:
PATH += /mnt/mint/home/flubba86/Downloads/emsdk_portable
PATH += /mnt/mint/home/flubba86/Downloads/emsdk_portable/emscripten/incoming

Setting environment variables:
EM_CONFIG = /home/flubba86/.emscripten
EMSCRIPTEN = /mnt/mint/home/flubba86/Downloads/emsdk_portable/emscripten/incoming

   Compiling gcc v0.3.25
   Compiling libc v0.0.0 (file:///home/flubba86/rust/src/libstd)
   Compiling build_helper v0.1.0 (file:///home/flubba86/rust/src/libstd)
   Compiling core v0.0.0 (file:///home/flubba86/rust/src/libstd)
   Compiling std v0.0.0 (file:///home/flubba86/rust/src/libstd)
Build failed, waiting for other jobs to finish...
failed to run custom build command for `std v0.0.0 (file:///home/flubba86/rust/src/libstd)`
Process didn't exit successfully: `/home/flubba86/rust/src/libstd/target/release/build/std-f43ff7732835f762/build-script-build` (exit code: 1)
--- stdout
cargo:rustc-cfg=cargobuild
cargo:rustc-link-lib=static=backtrace
cargo:rustc-link-search=native=/home/flubba86/rust/src/libstd/target/asmjs-unknown-emscripten/release/build/std-f43ff7732835f762/out/.libs
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: "sh" "/home/flubba86/rust/src/libstd/../libbacktrace/configure" "--with-pic" "--disable-multilib" "--disable-shared" "--disable-host-shared" "--host=asmjs-unknown-emscripten" "--build=x86_64-unknown-linux-gnu"
checking build system type... x86_64-unknown-linux-gnu
checking host system type... 

command did not execute successfully: "sh" "/home/flubba86/rust/src/libstd/../libbacktrace/configure" "--with-pic" "--disable-multilib" "--disable-shared" "--disable-host-shared" "--host=asmjs-unknown-emscripten" "--build=x86_64-unknown-linux-gnu"
expected success, got: exit code: 1



--- stderr
Invalid configuration `asmjs-unknown-emscripten': system `emscripten' not recognized
configure: error: /bin/sh /home/flubba86/rust/src/libstd/../libbacktrace/config.sub asmjs-unknown-emscripten failed

@alexcrichton
Copy link
Member

Aha I had a feeling this might be using rustbuild...

Anyway, using cargo is not currently a supported build system for all targets which is why this isn't working. The main build system disables compiling libbacktrace for emscripten, and we just need to update src/libstd/build.rs to do the same. Could you retarget this patch to that file instead?

@ashleysommer
Copy link
Contributor Author

Thanks for the clarification. I restored libbacktrace/config.sub back to how it was, and added an additional compile-time check to libstd/build.rs to not compile libbacktrace during a rustbuild of libstd.

@alexcrichton
Copy link
Member

Thanks! Can you also squash the commits together?

Was getting error:
```
running: "sh" "/home/flubba86/rust/src/libstd/../libbacktrace/configure" "--with-pic" "--disable-multilib" "--disable-shared" "--disable-host-shared" "--host=asmjs-unknown-emscripten" "--build=x86_64-unknown-linux-gnu"
...
Invalid configuration `asmjs-unknown-emscripten': system `emscripten' not recognized
```

Undo change to libbacktrace configure script.
Modify libstd build.rs to not build libbacktrace in the case of targeting emscripten.
@ashleysommer
Copy link
Contributor Author

So now I know how to squash commits in a pull-request :)

@alexcrichton
Copy link
Member

@bors: r+ d846f49

Manishearth added a commit to Manishearth/rust that referenced this pull request Mar 2, 2016
…n_fix, r=alexcrichton

Was getting error:
```
running: "sh" "/home/flubba86/rust/src/libstd/../libbacktrace/configure" "--with-pic" "--disable-multilib" "--disable-shared" "--disable-host-shared" "--host=asmjs-unknown-emscripten" "--build=x86_64-unknown-linux-gnu"
...
Invalid configuration `asmjs-unknown-emscripten': system `emscripten' not recognized
```
This commit adds the emscripten target to the libbacktrace configure script so it is no longer unrecognized.
bors added a commit that referenced this pull request Mar 2, 2016
@bors bors merged commit d846f49 into rust-lang:master Mar 2, 2016
@ashleysommer ashleysommer deleted the libbackgrace_emscripten_fix branch March 8, 2016 04:08
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

Successfully merging this pull request may close these issues.

5 participants