From 912795afd3cea17c10c561fd7edbc9b37a08f95e Mon Sep 17 00:00:00 2001 From: Melissa Jost Date: Thu, 13 Apr 2023 11:40:37 -0700 Subject: [PATCH] scons: Add stdc++fs and libc++experimental for clang LIBS env This change fixes a failure in the compiler tests: https://jenkins.gem5.org/job/compiler-checks/573/ These tests were failing due to the use of `std::filesystem`, which requires 'stdc++fs' to be linked for clang versions 6 through 10. Change-Id: I4fa03923e8dc616046dead939c77d49b301de36b Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/69777 Reviewed-by: Bobby Bruce Maintainer: Bobby Bruce Tested-by: kokoro --- SConstruct | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/SConstruct b/SConstruct index 7e8f177418..b784a045ec 100755 --- a/SConstruct +++ b/SConstruct @@ -512,6 +512,18 @@ for variant_path in variant_paths: env.Append(TCMALLOC_CCFLAGS=['-fno-builtin']) + if compareVersions(env['CXXVERSION'], "11") < 0: + # `libstdc++fs`` must be explicitly linked for `std::filesystem`` + # in clang versions 6 through 10. + # + # In addition, for these versions, the + # `std::filesystem` is under the `experimental` + # namespace(`std::experimental::filesystem`). + # + # Note: gem5 does not support clang versions < 6. + env.Append(LIBS=['stdc++fs']) + + # On Mac OS X/Darwin we need to also use libc++ (part of XCode) as # opposed to libstdc++, as the later is dated. if sys.platform == "darwin":