-
Notifications
You must be signed in to change notification settings - Fork 4
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
Update Cargo.toml #7
Conversation
Usage of zlib backend for flate2 causes a compilation failure. One should use a rust_backend instead. Signed-off-by: Lev Veyde <[email protected]>
Forced-pushed the same patch with Signed-off-by added, to make the DCO happy. |
The issue seems to be related to this one: issue 172 Basically, on many platforms the llvm/clang doesn't support wasm32. |
Hmm @CaptainVincent can you help review this? Thanks. |
Signed-off-by: Lev Veyde <[email protected]>
@lveyde Because I am unable to reproduce the issue locally and I'll also give your PR a try later, but I'd like to confirm what issue we're addressing first. Thank you. |
Yes, certainly. Im using it as a dependency in my own project, and it gets compiled together with other dependency tree. I'm using CentOS 7.9, and the main issue is that it's llvm/clang version doesn't support compilation into wasm targets. Requiring flate2/zlib as a direct dependency of mysql_async_wasi is causing the inclusion of libz-sys crate (which is a wrapper around zlib), even if one uses a feature option to choose a different configuration, i.e. "default", which normally was not supposed to include zlib. I think that using a rust_backend instead provides a good solution in this case. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I add one suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two minor changes are needed. I've reviewed the rest part, and it looks fine.
README.md
Outdated
flate2 = { version = "*", default-features = false, features = ["rust_backend"] } | ||
``` | ||
|
||
* `default` – enables the following set of crate's and dependencies' features: | ||
|
||
- `native-tls-tls` | ||
- `flate2/zlib" | ||
- `flate2/rust_backend" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flate2/rust_backend
this too.
Reworked the features, and updated the README.md file to reflect the changes in the default configuration. Also fixed some references to the original crate. Signed-off-by: Lev Veyde <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. @juntao Could your help ship this.
Signed-off-by: Michael Yuan <[email protected]>
I increased the minor version number so that I can publish this crate. Thank you! |
Sure, no problem! |
Usage of zlib backend for flate2 causes a compilation failure. One should use a rust_backend instead.
Otherwise a libz-sys crate compilation error similar to this will occur:
Compiling libz-sys v1.1.12
Checking priority-queue v1.3.2
The following warnings were emitted during compilation:
warning: error: unknown target triple 'wasm32-wasi', please use -triple or -arch
error: failed to run custom build command for
libz-sys v1.1.12
Caused by:
process didn't exit successfully:
/home/lveyde/git/rust/Create_a_Microservice_in_Rust/lveyde-a-stateful-microservice-lp/order_management/target/debug/build/libz-sys-0ed89978f8121fe7/build-script-build
(exit status: 1)--- stdout
cargo:rerun-if-env-changed=LIBZ_SYS_STATIC
cargo:rerun-if-changed=build.rs
cargo:rerun-if-env-changed=ZLIB_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_wasm32-wasi
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_wasm32_wasi
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_ALLOW_CROSS
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS
cargo:rerun-if-env-changed=PKG_CONFIG_wasm32-wasi
cargo:rerun-if-env-changed=PKG_CONFIG_wasm32_wasi
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_wasm32-wasi
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_wasm32_wasi
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
cargo-warning=pkg-config has not been configured to support cross-compilation.
Install a sysroot for the target platform and configure it via
PKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_PATH, or install a
cross-compiling wrapper for pkg-config and set it via
PKG_CONFIG environment variable.
TARGET = Some("wasm32-wasi")
OPT_LEVEL = Some("0")
HOST = Some("x86_64-unknown-linux-gnu")
cargo:rerun-if-env-changed=CC_wasm32-wasi
CC_wasm32-wasi = None
cargo:rerun-if-env-changed=CC_wasm32_wasi
CC_wasm32_wasi = None
cargo:rerun-if-env-changed=TARGET_CC
TARGET_CC = None
cargo:rerun-if-env-changed=CC
CC = None
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
cargo:rerun-if-env-changed=CFLAGS_wasm32-wasi
CFLAGS_wasm32-wasi = None
cargo:rerun-if-env-changed=CFLAGS_wasm32_wasi
CFLAGS_wasm32_wasi = None
cargo:rerun-if-env-changed=TARGET_CFLAGS
TARGET_CFLAGS = None
cargo:rerun-if-env-changed=CFLAGS
CFLAGS = None
running: "clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "--target=wasm32-wasi" "-I" "src/zlib" "-fvisibility=hidden" "-DZ_SOLO" "-DSTDC" "-D_LARGEFILE64_SOURCE" "-D_POSIX_SOURCE" "-o" "/home/lveyde/git/rust/Create_a_Microservice_in_Rust/lveyde-a-stateful-microservice-lp/order_management/target/wasm32-wasi/debug/build/libz-sys-7cf7184cfca6fdb6/out/lib/src/zlib/adler32.o" "-c" "src/zlib/adler32.c"
cargo:warning=error: unknown target triple 'wasm32-wasi', please use -triple or -arch
exit status: 1
--- stderr
error occurred: Command "clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "--target=wasm32-wasi" "-I" "src/zlib" "-fvisibility=hidden" "-DZ_SOLO" "-DSTDC" "-D_LARGEFILE64_SOURCE" "-D_POSIX_SOURCE" "-o" "/home/lveyde/git/rust/Create_a_Microservice_in_Rust/lveyde-a-stateful-microservice-lp/order_management/target/wasm32-wasi/debug/build/libz-sys-7cf7184cfca6fdb6/out/lib/src/zlib/adler32.o" "-c" "src/zlib/adler32.c" with args "clang" did not execute successfully (status code exit status: 1).
warning: build failed, waiting for other jobs to finish...