Skip to content

Commit 56e4637

Browse files
committed
fix(codegen): use -Wl, prefix to forward system libs to MSVC link.exe
clang.exe treats bare 'ws2_32.lib' as a file path and fails with 'no such file or directory'. The -Wl, prefix forwards the name directly to MSVC's link.exe which resolves it from the system library path.
1 parent 859c4ef commit 56e4637

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

compiler/mesh-codegen/src/link.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ pub(crate) fn link_with_plan(
121121
LinkTargetKind::WindowsMsvc => {
122122
cmd.arg(&plan.rt_path).arg("-o").arg(output_path);
123123
// mesh_rt.lib is a Rust staticlib whose transitive deps (ureq/TLS,
124-
// sqlite, crossbeam, rand, std) need these Windows system libraries.
125-
// Pass via -Wl, so clang forwards them to link.exe.
124+
// sqlite, crossbeam, rand, Rust std) need these Windows system libraries.
125+
// Use -Wl, to forward them directly to MSVC's link.exe.
126126
for lib in &[
127127
"ws2_32.lib",
128128
"userenv.lib",
@@ -133,7 +133,7 @@ pub(crate) fn link_with_plan(
133133
"msvcrt.lib",
134134
"synchronization.lib",
135135
] {
136-
cmd.arg(lib);
136+
cmd.arg(format!("-Wl,{lib}"));
137137
}
138138
// Verbose mode so link failures show the full link.exe invocation.
139139
cmd.arg("-v");

0 commit comments

Comments
 (0)