mirror of
https://github.com/leanprover/lean4.git
synced 2026-03-17 10:24:07 +00:00
fix: Unicode path support for Lean Windows executables (#10133)
This PR fixes compatibility of Lean-generated executables with Unicode file system paths on Windows Fixes #2554
This commit is contained in:
committed by
GitHub
parent
4d5fb31dfb
commit
697ea0bc01
@@ -40,7 +40,9 @@ Interesting options:
|
||||
let cflags := getCFlags root
|
||||
let mut cflagsInternal := getInternalCFlags root
|
||||
let mut ldflagsInternal := getInternalLinkerFlags root
|
||||
let ldflags := getLinkerFlags root linkStatic
|
||||
let mut ldflags := getLinkerFlags root linkStatic
|
||||
if System.Platform.isWindows && !args.contains "-shared" then
|
||||
ldflags := ldflags ++ #["-Wl,--whole-archive", "-lleanmanifest", "-Wl,--no-whole-archive"]
|
||||
|
||||
for arg in args do
|
||||
match arg with
|
||||
|
||||
@@ -82,13 +82,15 @@ The arguments to pass to `leanc` when linking the binary executable.
|
||||
|
||||
By default, the package's plus the executable's `moreLinkArgs`.
|
||||
If `supportInterpreter := true`, Lake prepends `-rdynamic` on non-Windows
|
||||
systems.
|
||||
systems. On Windows, it links in a manifest for Unicode path support.
|
||||
-/
|
||||
public def linkArgs (self : LeanExe) : Array String :=
|
||||
public def linkArgs (self : LeanExe) : Array String := Id.run do
|
||||
let mut linkArgs := self.pkg.moreLinkArgs ++ self.config.moreLinkArgs
|
||||
if self.config.supportInterpreter && !Platform.isWindows then
|
||||
#["-rdynamic"] ++ self.pkg.moreLinkArgs ++ self.config.moreLinkArgs
|
||||
else
|
||||
self.pkg.moreLinkArgs ++ self.config.moreLinkArgs
|
||||
linkArgs := #["-rdynamic"] ++ linkArgs
|
||||
else if System.Platform.isWindows then
|
||||
linkArgs := linkArgs ++ #["-Wl,--whole-archive", "-lleanmanifest", "-Wl,--no-whole-archive"]
|
||||
return linkArgs
|
||||
|
||||
/--
|
||||
Whether the Lean shared library should be dynamically linked to the executable.
|
||||
|
||||
4
tests/compiler/utf8Path.lean
Normal file
4
tests/compiler/utf8Path.lean
Normal file
@@ -0,0 +1,4 @@
|
||||
/-! Lean executables should be able to handle UTF 8 paths. -/
|
||||
|
||||
def main : IO Unit := do
|
||||
assert! (← System.FilePath.pathExists "../lean/run/utf8英語.lean")
|
||||
0
tests/compiler/utf8Path.lean.expected.out
Normal file
0
tests/compiler/utf8Path.lean.expected.out
Normal file
Reference in New Issue
Block a user