Skip to content

Need help compiling this crate  #30

@dayfine

Description

@dayfine

I cannot compile this crate. I am depending on it through https://crates.io/crates/mockall and building using https://bazel.build/ with https://github.com/google/cargo-raze. The commit is dayfine/xlab@9f9bf1e.

The error I see is:

NFO: Found 1 target...
ERROR: /private/var/tmp/_bazel_difan/f78d9d7b4392e86afba7ecb9acf5e2e3/external/raze__float_cmp__0_9_0/BUILD.bazel:34:13: Compiling Rust rlib float_cmp v0.9.0 (6 files) failed: (Exit 1): sandbox-exec failed: error executing command
  (cd /private/var/tmp/_bazel_difan/f78d9d7b4392e86afba7ecb9acf5e2e3/sandbox/darwin-sandbox/1694/execroot/xlab && \
  exec env - \
    CARGO_CFG_TARGET_ARCH=x86_64 \
    CARGO_CFG_TARGET_OS=darwin \
    CARGO_CRATE_NAME=float_cmp \
    CARGO_MANIFEST_DIR='${pwd}/external/raze__float_cmp__0_9_0' \
    CARGO_PKG_AUTHORS='' \
    CARGO_PKG_DESCRIPTION='' \
    CARGO_PKG_HOMEPAGE='' \
    CARGO_PKG_NAME=float_cmp \
    CARGO_PKG_VERSION=0.9.0 \
    CARGO_PKG_VERSION_MAJOR=0 \
    CARGO_PKG_VERSION_MINOR=9 \
    CARGO_PKG_VERSION_PATCH=0 \
    CARGO_PKG_VERSION_PRE='' \
    SYSROOT=bazel-out/darwin-fastbuild/bin/external/rust_darwin_x86_64/toolchain_for_x86_64-apple-darwin_impl \
    TMPDIR=/var/folders/yn/sjqdt0f50hbfg723kw354ng00000gn/T/ \
  /usr/bin/sandbox-exec -f /private/var/tmp/_bazel_difan/f78d9d7b4392e86afba7ecb9acf5e2e3/sandbox/darwin-sandbox/1694/sandbox.sb /var/tmp/_bazel_difan/install/ebbb2540c6000feeb8873385c487a79c/process-wrapper '--timeout=0' '--kill_delay=15' bazel-out/darwin-opt-exec-2B5CBBC6/bin/external/rules_rust/util/process_wrapper/process_wrapper --arg-file bazel-out/darwin-fastbuild/bin/external/raze__num_traits__0_2_15/num_traits_build_script.linksearchpaths --subst 'pwd=${pwd}' -- bazel-out/darwin-fastbuild/bin/external/rust_darwin_x86_64/toolchain_for_x86_64-apple-darwin_impl/bin/rustc external/raze__float_cmp__0_9_0/src/lib.rs '--crate-name=float_cmp' '--crate-type=rlib' '--error-format=human' '--codegen=metadata=-2829191614' '--codegen=extra-filename=-2829191614' '--out-dir=bazel-out/darwin-fastbuild/bin/external/raze__float_cmp__0_9_0' '--codegen=opt-level=0' '--codegen=debuginfo=0' '--remap-path-prefix=${pwd}=.' '--emit=dep-info,link' '--color=always' '--target=x86_64-apple-darwin' -L bazel-out/darwin-fastbuild/bin/external/rust_darwin_x86_64/toolchain_for_x86_64-apple-darwin_impl/lib/rustlib/x86_64-apple-darwin/lib '--cap-lints=allow' '--edition=2018' '--extern=num_traits=bazel-out/darwin-fastbuild/bin/external/raze__num_traits__0_2_15/libnum_traits-784186115.rlib' '-Ldependency=bazel-out/darwin-fastbuild/bin/external/raze__num_traits__0_2_15')
error[E0599]: no method named `abs` found for type `f32` in the current scope
   --> external/raze__float_cmp__0_9_0/src/eq.rs:100:29
    |
100 |             ((self - other).abs() <= margin.epsilon) ||
    |                             ^^^ method not found in `f32`

error[E0599]: no method named `abs` found for type `f64` in the current scope
   --> external/raze__float_cmp__0_9_0/src/eq.rs:226:29
    |
226 |             ((self - other).abs() <= margin.epsilon) ||
    |                             ^^^ method not found in `f64`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0599`.

I know this is rust-lang/rust#50145, and I also saw #25. I am not familiar with no_std so I am not sure what's the right thing to do, e.g.:

  • It seems I am compiling using num_traits. Do I want num_traits or not?
  • Could this be fixed if I force enable std feature? I don't think I've actually been able to do that

Currently I might need to not using mockall and this crate, but I suppose there might be an easy fix that I cannot find.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions