Commit c8a3a59b by Martin Boos Committed by Tianqi Chen

use LLVM linker (#2713)

* use LLVM linker

* error message improved in case of filenotfound

* linting error fixed
parent ada760a4
...@@ -85,13 +85,13 @@ BOOL APIENTRY DllMain( HMODULE hModule,\ ...@@ -85,13 +85,13 @@ BOOL APIENTRY DllMain( HMODULE hModule,\
cl_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) cl_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
(out, _) = proc.communicate() (out, _) = proc.communicate()
except FileNotFoundError: except FileNotFoundError:
raise RuntimeError("can not found cl.exe," raise RuntimeError("Can not find cl.exe,"
"please run this in Vistual Studio Command Prompt.") "please run this in Vistual Studio Command Prompt.")
if proc.returncode != 0: if proc.returncode != 0:
msg = "Compilation error:\n" msg = "Compilation error:\n"
msg += py_str(out) msg += py_str(out)
raise RuntimeError(msg) raise RuntimeError(msg)
link_cmd = ["link"] link_cmd = ["lld-link"]
link_cmd += ["-dll", "-FORCE:MULTIPLE"] link_cmd += ["-dll", "-FORCE:MULTIPLE"]
for obj in objects: for obj in objects:
...@@ -111,8 +111,11 @@ BOOL APIENTRY DllMain( HMODULE hModule,\ ...@@ -111,8 +111,11 @@ BOOL APIENTRY DllMain( HMODULE hModule,\
link_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) link_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
(out, _) = proc.communicate() (out, _) = proc.communicate()
except FileNotFoundError: except FileNotFoundError:
raise RuntimeError("can not found link.exe," raise RuntimeError("Can not find the LLVM linker for Windows (lld-link.exe)."
"please run this in Vistual Studio Command Prompt.") "Make sure it's installed"
" and the installation directory is in the %PATH% environment "
"variable. Prebuilt binaries can be found at: https://llvm.org/"
"For building the linker on your own see: https://lld.llvm.org/#build")
if proc.returncode != 0: if proc.returncode != 0:
msg = "Compilation error:\n" msg = "Compilation error:\n"
msg += py_str(out) msg += py_str(out)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment