Parse g++ version instead of using string matching (#72)

This commit is contained in:
Sam 2023-05-31 13:44:36 -04:00 committed by GitHub
parent 97bc7e3fb6
commit dea1bf3d04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -155,8 +155,8 @@ def update_dependencies():
# On some Linux distributions, g++ may not exist or be the wrong version to compile GPTQ-for-LLaMa # On some Linux distributions, g++ may not exist or be the wrong version to compile GPTQ-for-LLaMa
if sys.platform.startswith("linux"): if sys.platform.startswith("linux"):
gxx_output = run_cmd("g++ --version", environment=True, capture_output=True) gxx_output = run_cmd("g++ -dumpfullversion -dumpversion", environment=True, capture_output=True)
if gxx_output.returncode != 0 or b"g++ (GCC) 12" in gxx_output.stdout: if gxx_output.returncode != 0 or int(gxx_output.stdout.strip().split(b".")[0]) > 11:
# Install the correct version of g++ # Install the correct version of g++
run_cmd("conda install -y -k gxx_linux-64=11.2.0", environment=True) run_cmd("conda install -y -k gxx_linux-64=11.2.0", environment=True)