From 4238aaf5e5a453d629c445216fd4e50dbc7587ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Goens?= Date: Wed, 28 Feb 2024 14:23:58 +0100 Subject: [PATCH] add PIC for linux builds --- lakefile.lean | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lakefile.lean b/lakefile.lean index 4bf453e988..fcd247553d 100644 --- a/lakefile.lean +++ b/lakefile.lean @@ -14,7 +14,7 @@ target importTarget pkg : FilePath := do let oFile := pkg.buildDir / "c" / "ffi.o" let srcJob ← inputFile <| pkg.dir / "C" / "ffi.c" buildFileAfterDep oFile srcJob fun srcFile => do - let flags := #["-I", toString (← getLeanIncludeDir)] + let flags := #["-I", toString (← getLeanIncludeDir), "-fPIC"] compileO "ffi.c" oFile srcFile flags extern_lib ffi pkg := do @@ -23,7 +23,7 @@ extern_lib ffi pkg := do buildStaticLib libFile #[job] extern_lib egg_for_lean pkg := do - proc { cmd := "cargo", args := #["build", "--release"], cwd := pkg.dir / "Rust" } + proc { cmd := "cargo", args := #["rustc", "--release", "--", "-C", "relocation-model=pic"], cwd := pkg.dir / "Rust" } let name := nameToStaticLib "egg_for_lean" let srcPath := pkg.dir / "Rust" / "target" / "release" / name IO.FS.createDirAll pkg.nativeLibDir