Skip to content

Errors when building on Windows (with temp fix) #387

@cizmic

Description

@cizmic

First, thank you for building this library - this is exactly what I need for one of my research projects.

Building on macOS and Linux works perfectly, but when I try to build from source on a Windows 11 machine, I come across two errors caused by (1) a missing library in encoderfile/src/builder/base_binary/mod.rs, and (2) a linker error triggered by the transient dependency esaxx-rs.

Fortunately, I was able to build and run everything okay with two small fixes. Apologies for the crudeness of these patches - I am just a medical student and clearly not a skilled programmer! But I hope this will be helpful as a temporary fix to anyone else who comes across the same issues.

First, I commented out the base binary validation code (lines 108–120) in the encoderfile/src/builder/base_binary/mod.rs file since it references std::os::unix, which is not available on Windows.

use std::os::unix::fs::PermissionsExt;
let meta = fs::metadata(path)
.with_context(|| format!("base binary missing at {}", path.display()))?;
if !meta.is_file() {
anyhow::bail!("base binary is not a file: {}", path.display());
}
let mode = meta.permissions().mode();
if mode & 0o111 == 0 {
anyhow::bail!("base binary is not executable: {}", path.display());
}

Then, I addressed the linker error (apparently caused by a conflict between static and dynamic linking) by adding this patch to the Cargo.toml file:

[patch.crates-io]
esaxx-rs = { git = "https://github.com/thewh1teagle/esaxx-rs.git", branch = "feat/dynamic-msvc-link" }

After that, I was able to compile and use the "encoderfile" and "encoderfile-runtime" files without issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions