From d90eb6e1bac78f8b04d1fa33f992a433f1f2ea36 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Tue, 27 Dec 2022 17:58:08 +0200 Subject: [PATCH] Gather more system path information for GnuLinker --- source/gnulinker.cpp | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/source/gnulinker.cpp b/source/gnulinker.cpp index 1931333..591c80b 100644 --- a/source/gnulinker.cpp +++ b/source/gnulinker.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -109,6 +110,7 @@ void GnuLinker::do_prepare(ToolData &tool) const { ExternalTask::Arguments argv; argv.push_back(exe->get_path().str()); + argv.push_back("-v"); argv.push_back("-Wl,--verbose"); argv.push_back("-nostdlib"); if(!sysroot.empty()) @@ -118,6 +120,23 @@ void GnuLinker::do_prepare(ToolData &tool) const try { string output = ExternalTask::run_and_capture_output(argv, FS::Path(), true); + + string::size_type lib_path = output.find("LIBRARY_PATH="); + if(lib_path!=string::npos) + { + string::size_type newline = output.find('\n', lib_path); + for(const string &p: split(output.substr(lib_path+13, newline-lib_path-13), ':')) + { + FS::Path path = strip(p); + if(!any_equals(tool.system_path, path)) + { + builder.get_logger().log("tools", "Got %s frontend system path: %s", tool_tag, path); + tool.system_path.push_back(path); + } + path_found = true; + } + } + string::size_type start = 0; while(start