diff options
| author | IMXEren <[email protected]> | 2025-07-09 18:50:44 +0530 |
|---|---|---|
| committer | IMXEren <[email protected]> | 2025-07-09 18:50:44 +0530 |
| commit | f1858dac8ef6e7a9f74a116610e5911b7941e72a (patch) | |
| tree | 968dfe6ea46bf1b3aae82a68e87d47cb90ad5000 /xmake/rules/rust/xmake.lua | |
| parent | 1dfed55f3b621c81672894eeea80b11c37b29df8 (diff) | |
fix: rust libstd not found in non-windows
- In non-windows, it's located at <sysroot>/lib
Diffstat (limited to 'xmake/rules/rust/xmake.lua')
| -rw-r--r-- | xmake/rules/rust/xmake.lua | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/xmake/rules/rust/xmake.lua b/xmake/rules/rust/xmake.lua index 7dbd0c488..3875f10ff 100644 --- a/xmake/rules/rust/xmake.lua +++ b/xmake/rules/rust/xmake.lua @@ -105,10 +105,17 @@ rule("rust.build") assert(rc, "rustc not found. Failed to add libstd in env") local outdata, errdata = os.iorunv(rc.program, {"--print=sysroot"}) assert(not errdata or errdata == "", "failed to find rust sysroot:\n" .. errdata) - local libstd = path.join(outdata:trim(), "bin") - target:add("runenvs", "PATH", libstd) - target:add("runenvs", "LD_LIBRARY_PATH", libstd) - target:add("runenvs", "DYLD_LIBRARY_PATH", libstd) + local rustc_sysroot = outdata:trim() + if target:is_plat("windows") then + local libstd = path.join(rustc_sysroot, "bin") + target:add("runenvs", "PATH", libstd) + elseif target:is_plat("macosx") then + local libstd = path.join(rustc_sysroot, "lib") + target:add("runenvs", "DYLD_LIBRARY_PATH", libstd) + else + local libstd = path.join(rustc_sysroot, "lib") + target:add("runenvs", "LD_LIBRARY_PATH", libstd) + end end) rule("rust") |
