woboq / tr

Translation tools for rust
58 stars 10 forks source link

Compilation error with xtr on windows #10

Open emperor-limitless opened 2 years ago

emperor-limitless commented 2 years ago

Hello

When I try to install xtr via cargo install xtr, It errors with this

Updating crates.io index

Installing xtr v0.1.6 Compiling winapi v0.3.9 Compiling autocfg v1.0.1 Compiling memchr v2.4.1 Compiling cc v1.0.72 Compiling proc-macro2 v1.0.32 Compiling libc v0.2.108 Compiling regex-syntax v0.6.25 Compiling lazy_static v1.4.0 Compiling unicode-xid v0.2.2 Compiling unicode-width v0.1.9 Compiling syn v1.0.82 Compiling anyhow v1.0.48 Compiling vec_map v0.8.2 Compiling strsim v0.8.0 Compiling bitflags v1.3.2 Compiling num-traits v0.2.14 Compiling num-integer v0.1.44 Compiling textwrap v0.11.0 Compiling gettext-sys v0.19.9 error: failed to run custom build command for gettext-sys v0.19.9

Caused by: process didn't exit successfully: C:\Users\mohamed\AppData\Local\Temp\cargo-installoPAaZH\release\build\gettext-sys-45ecaebce0a0101f\build-script-build (exit code: 101) --- stdout cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_MSVC_GETTEXT_DIR cargo:rerun-if-env-changed=GETTEXT_DIR cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_MSVC_GETTEXT_BIN_DIR cargo:rerun-if-env-changed=GETTEXT_BIN_DIR cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_MSVC_GETTEXT_LIB_DIR cargo:rerun-if-env-changed=GETTEXT_LIB_DIR cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_MSVC_GETTEXT_INCLUDE_DIR cargo:rerun-if-env-changed=GETTEXT_INCLUDE_DIR OPT_LEVEL = Some("3") TARGET = Some("x86_64-pc-windows-msvc") HOST = Some("x86_64-pc-windows-msvc") CC_x86_64-pc-windows-msvc = None CC_x86_64_pc_windows_msvc = None HOST_CC = None CC = None CFLAGS_x86_64-pc-windows-msvc = None CFLAGS_x86_64_pc_windows_msvc = None HOST_CFLAGS = None CFLAGS = None CRATE_CC_NO_DEFAULTS = None CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2") DEBUG = Some("false") running: "tar" "xJf" "C:\Users\mohamed\.cargo\registry\src\github.com-1ecc6299db9ec823\gettext-sys-0.19.9\gettext-0.19.8.1.tar.xz" "--strip-components" "1" "--force-local"

--- stderr tar: Option --force-local is not supported Usage: List: tar -tf Extract: tar -xf Create: tar -cf [filenames...] Help: tar --help thread 'main' panicked at ' command did not execute successfully, got: exit code: 1

build script failed, must exit now', C:\Users\mohamed.cargo\registry\src\github.com-1ecc6299db9ec823\gettext-sys-0.19.9\build.rs:251:5 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace warning: build failed, waiting for other jobs to finish... error: failed to compile xtr v0.1.6, intermediate artifacts can be found at C:\Users\mohamed\AppData\Local\Temp\cargo-installoPAaZH

Caused by: build failed

It seems it wants some kind of headers or something, But I really have no idea from where can I get those.

Anything I'm doing wrong? Should I download something? If yes then from where?

Thanks.

ogoffart commented 2 years ago

Looks like the gettext-sys crate failed to compile.

It tries to use the system library but it fails running tar because the "--force-local" argument is not supported, it says. That argument is set by the gettext-sys crate's build script, so i guess the bug should be reported there

https://github.com/Koka/gettext-rs/blob/93cdd86501a9e9493037615730249c55a0e16f59/gettext-sys/build.rs#L192

Otherwise, the gettext-rs is an optional dependency of the tr crate, and there is also a gettext feature on the tr crate that use a pure rust implementation. Unfortunately, you will need to edit the Cargo.toml to change these feature. It would be nice if the features could be somehow changed differently without having to forward the feature on all the dependees.

ogoffart commented 2 years ago

Actually, it was already reported in https://github.com/Koka/gettext-rs/issues/12

emperor-limitless commented 2 years ago

Yeah, I got the same issue with tr but setting default_features to false and features to gettext fixed it, However since xtr doesn't have any features I didn't have any choice except opening an issue here.

It seems the issue was opened over a month ago, I wonder if they're still looking into it, But I wonder is searching for another version of tar that supports force would be an option or it would break windows, Maybe I just should try.

Minoru commented 2 years ago

@mohamedSulaimanAlmarzooqi I'm a co-maintainer of gettext-rs and gettext-sys. We actually reached a decision on that issue a while ago, just haven't implemented it yet. I don't think I'll find time for it this weekend, so feel free to send a PR ;)

emperor-limitless commented 2 years ago

@Minoru Sadly though I think I'm unsure about where to go with that, I have no idea on how that could be implemented because I never worked on this kind of stuff before.

emperor-limitless commented 2 years ago

So is there a way to perhaps change xtr when doing cargo install to use the pure rust implementation of gettext instead of gettext-rs?

caesay commented 5 months ago

Just for visibility here, I was able to compile xtr by the following steps

xtr can now compile. Note that this breaks the i18n functionality built into xtr, but I didn't need that.