From b4a4bd5de7f3526ef64a1802232aeccc2816a678 Mon Sep 17 00:00:00 2001 From: Yu-hsin Wang Date: Fri, 8 Jul 2022 17:22:19 +0800 Subject: [PATCH] ext: force to use gem5 gtest library In normal gtest package, libgtest and libgtest_main are two separated libraries, while gem5 built libgtest and libgtest_main into one libgtest library. If the system has installed the gtest package, current build script would use the system one. This makes link error because of missing main function. Since the gem5 libgtest is special, we should specify using it explicitly. Change-Id: I46c791743e3e59edd4bbdff7cd7a6f148a907f2a Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/61152 Tested-by: kokoro Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power --- ext/googletest/SConscript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/googletest/SConscript b/ext/googletest/SConscript index 21830f0308..3bd5ab8d10 100644 --- a/ext/googletest/SConscript +++ b/ext/googletest/SConscript @@ -52,6 +52,6 @@ gmock_all = genv.Object(gmock_src.File('gmock-all.cc')) gtest_main = genv.StaticLibrary(target='libgtest', source=[ gtest_all, gmock_all, gtest_src.File('gtest_main.cc')]) -env['GTEST_LIBS'] = ['libgtest', 'pthread'] +env['GTEST_LIBS'] = [gtest_main[0], 'pthread'] env['GTEST_CPPFLAGS'] = [ '-pthread', '-DUSE_GMOCK', '-Wno-undef', '-isystem', gtest_include.abspath]