fix(c-api): handle newer Cargo build-script directory layout in shared_object_dir - #6852
Closed
Arshia001 wants to merge 1 commit into
Closed
fix(c-api): handle newer Cargo build-script directory layout in shared_object_dir#6852Arshia001 wants to merge 1 commit into
Arshia001 wants to merge 1 commit into
Conversation
…d_object_dir shared_object_dir() assumed OUT_DIR always nests as build/<pkg>-<hash>/out (package name and hash in one hyphenated directory). Newer Cargo/nightly toolchains instead lay it out as build/<pkg>/<hash>/out (package name and hash as separate nested directories), which broke the hardcoded assertion and failed the build script outright. Detect which layout is in play by checking whether the directory popped after "out" already starts with "wasmer-c-api"; if not, pop once more to reach it. Verified against both layouts: the default toolchain (old layout) and a newer nightly (new layout) both build wasmer-c-api successfully now.
Collaborator
|
Already part of existing PR: #6839. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Build docs.rsCI job, which has been failing since chore: bump napi: make GuestHeap the only V8 allocation path #6844 with a panic inlib/c-api/build.rs:assertion failed: shared_object_dir.file_name()...starts_with("wasmer-c-api").shared_object_dir()assumedOUT_DIRalways nests asbuild/<pkg>-<hash>/out(package name and hash combined into one hyphenated directory component). Newer Cargo/nightly toolchains instead lay out the build-script fingerprint directory asbuild/<pkg>/<hash>/out— package name and hash as two separate nested directories. Under that layout the hardcoded assertion fails because the component right afteroutis just the hash, which doesn't start with"wasmer-c-api".nightly-2025-09-27) is below the MSRV several dependencies now require (rustc 1.94), socargo +nightly(a separate, unpinned toolchain reference used bymake test-build-docs-rs-ci) ends up resolving to whatever nightly is currently available — new enough to build the project, but also new enough to hit this directory-layout change."out"already starts with"wasmer-c-api"; if not, pop once more to reach it, matching either layout.Test plan
RUSTDOCFLAGS="--cfg=docsrs" cargo doc --manifest-path lib/c-api/Cargo.toml --no-deps --locked— passes on both the repo's default (stable) toolchain (old directory layout) and a newer nightly (new directory layout, previously reproduced the panic before this fix, confirmed clean after).cargo build -p wasmer-c-api --features wat,sys-default,compiler,wasi,middlewares,webc_runner— normal (non-doc) build still succeeds.Stacked on #6850.