Skip to content

Commit f77086a

Browse files
committed
fix(link): platform-aware dep archive name (Windows .lib, not hardcoded .a)
The dep static archive was named lib<pkg>.a on every platform; Windows uses static_lib_ext=.lib / empty lib_prefix, so the hardcoded name broke the Windows test link. Use platform::lib_prefix + static_lib_ext (mirrors target_output), placed in bin/. e2e 07 (static lib) is requires:elf so this archive path was never exercised on Windows before.
1 parent 8411adb commit f77086a

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/build/plan.cppm

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,13 @@ BuildPlan make_plan(const mcpp::manifest::Manifest& manifest,
418418
LinkUnit ar;
419419
ar.targetName = qname;
420420
ar.kind = LinkUnit::StaticLibrary;
421-
ar.output = std::filesystem::path("lib" + sanitize(qname) + ".a");
421+
// Platform-aware archive name (libfoo.a on ELF/Mach-O, foo.lib on
422+
// Windows) — mirrors target_output() so the toolchain's `ar` + lld
423+
// accept it on every platform. (Hardcoding `.a` broke Windows, whose
424+
// static_lib_ext is `.lib`.)
425+
ar.output = std::filesystem::path("bin") /
426+
std::format("{}{}{}", mcpp::platform::lib_prefix, sanitize(qname),
427+
mcpp::platform::static_lib_ext);
422428
ar.objects = std::move(archiveObjs);
423429
staticDepPackages.insert(qname);
424430
staticDepArchives.push_back({qname, ar.output});

0 commit comments

Comments
 (0)