From b9f0e0cfa3ba12cbf077beed1dcb429930657f73 Mon Sep 17 00:00:00 2001 From: OS-of-S Date: Thu, 26 Dec 2024 23:36:42 +0700 Subject: [PATCH] Fixed Mold-search in older systems --- platform/linuxbsd/detect.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/platform/linuxbsd/detect.py b/platform/linuxbsd/detect.py index a421d5697da9..3ff81d5de29a 100644 --- a/platform/linuxbsd/detect.py +++ b/platform/linuxbsd/detect.py @@ -123,10 +123,16 @@ def configure(env: "SConsEnvironment"): found_wrapper = True break if not found_wrapper: - print_error( - "Couldn't locate mold installation path. Make sure it's installed in /usr or /usr/local." - ) - sys.exit(255) + for path in os.environ["PATH"].split(os.pathsep): + if os.path.isfile(path + "/ld.mold"): + env.Append(LINKFLAGS=["-B" + path]) + found_wrapper = True + break + if not found_wrapper: + print_error( + "Couldn't locate mold installation path. Make sure it's installed in /usr, /usr/local or in PATH environment variable." + ) + sys.exit(255) else: env.Append(LINKFLAGS=["-fuse-ld=mold"]) else: