rustyhorde / vergen

Generate cargo instructions at compile time in build scripts for use with the env! or option_env! macros
Apache License 2.0
396 stars 56 forks source link

Slotmap capacity error #381

Open xangelix opened 1 month ago

xangelix commented 1 month ago

I wish I was able to provide more details but I'm unable to replicate this issue outside of the gitlab-runner environment-- so maybe it has to do with an environment variable gitlab introduces? Hopefully I'm not overlooking something obvious here.

I have a workspace with a few crates that each use vergen_gix in the following way:

use vergen_gix::{BuildBuilder, CargoBuilder, Emitter, GixBuilder, RustcBuilder};

pub fn main() {
    let build = BuildBuilder::all_build().unwrap();
    let cargo = CargoBuilder::all_cargo().unwrap();
    let gix = GixBuilder::all_git().unwrap();
    let rustc = RustcBuilder::all_rustc().unwrap();

    Emitter::default()
        .add_instructions(&build)
        .unwrap()
        .add_instructions(&cargo)
        .unwrap()
        .add_instructions(&gix)
        .unwrap()
        .add_instructions(&rustc)
        .unwrap()
        .emit()
        .unwrap();
}
[build-dependencies]
vergen-gix = { version = "1.0.2", features = [
    "build",
    "rustc",
    "cargo",
], default-features = false }

But I get the following errors only when building in the CICD environment.

warning: mylib@1.0.0-alpha.1: The slotmap turned out to be too small with 32 entries, would need 4 more
warning: mylib@1.0.0-alpha.1: VERGEN_GIT_BRANCH set to default
warning: mylib@1.0.0-alpha.1: VERGEN_GIT_COMMIT_AUTHOR_EMAIL set to default
warning: mylib@1.0.0-alpha.1: VERGEN_GIT_COMMIT_AUTHOR_NAME set to default
warning: mylib@1.0.0-alpha.1: VERGEN_GIT_COMMIT_COUNT set to default
warning: mylib@1.0.0-alpha.1: VERGEN_GIT_COMMIT_DATE set to default
warning: mylib@1.0.0-alpha.1: VERGEN_GIT_COMMIT_MESSAGE set to default
warning: mylib@1.0.0-alpha.1: VERGEN_GIT_COMMIT_TIMESTAMP set to default
warning: mylib@1.0.0-alpha.1: VERGEN_GIT_DESCRIBE set to default
warning: mylib@1.0.0-alpha.1: VERGEN_GIT_SHA set to default

Any ideas what would be causing a slotmap error like this?

jasonozias commented 1 month ago

I've never seen that before. I will try to figure out where that is coming from this weekend.

glennsl commented 1 month ago

I suddenly started getting this as well after updating my Arch system, although only when building in a Docker container.

My build script is:

use std::error::Error;
use vergen::EmitBuilder;

fn main() -> Result<(), Box<dyn Error>> {
    EmitBuilder::builder()
        .git_branch()
        .git_sha(false)
        .build_date()
        .rustc_semver()
        .sysinfo_user()
        .fail_on_error()
        .emit()?;
    Ok(())
}

And in Cargo.toml:

[build-dependencies]
vergen = { version = "8.1.3", features = ["build", "cargo", "rustc", "si", "git", "gitoxide"] }