aocc: help compiler find include paths and libstdc++.so (#40450)

Add --gcc-toolchain option by default.
Only add these paths if c++ libs and include files are available and the compiler was built with gcc
This commit is contained in:
Stephen Sachs 2023-11-22 18:59:20 +01:00 committed by GitHub
parent 3c54177c5d
commit e49f55ba53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -91,3 +91,13 @@ def license_reminder(self):
def install(self, spec, prefix): def install(self, spec, prefix):
print("Installing AOCC Compiler ... ") print("Installing AOCC Compiler ... ")
install_tree(".", prefix) install_tree(".", prefix)
@run_after("install")
def cfg_files(self):
# Add path to gcc/g++ such that clang/clang++ can always find a full gcc installation
# including libstdc++.so and header files.
if self.spec.satisfies("%gcc") and self.compiler.cxx is not None:
compiler_options = "--gcc-toolchain={}".format(self.compiler.prefix)
for compiler in ["clang", "clang++"]:
with open(join_path(self.prefix.bin, "{}.cfg".format(compiler)), "w") as f:
f.write(compiler_options)