From 55ee0e272473d43dd27f89a8e886c2eba1b14d5c Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 26 May 2023 15:37:54 +0800 Subject: [PATCH] build: preserve $libs when linking a single testing executable if we just want to build a single test and scylla executables, we might want to use `configure.py` like: ./configure.py --mode debug --compiler clang++ --with scylla --with test/boost/database_test which generates `build.ninja` for us, with following rules: build $builddir/debug/test/boost/database_test_g: link.debug ... | $builddir/debug/seastar/libseastar.so $builddir/debug/seastar/libseastar_testing.so libs = $seastar_libs_debug $libs -lthrift -lboost_system $seastar_testing_libs_debug libs = $seastar_libs_debug but the last line prevents database_test_g for linking against the third-party libraries like libabsl, which could have been pulled in by $libs. but the second assignment expression just makes the value of `libs` identical to that of `seastar_libs_debug`. but that library does not include the libraries which are only used by scylla. so we could run into link failure with the `build.ninja` generated with this command line. like: ``` FAILED: build/debug/test/boost/database_test_g ... ld.lld: error: undefined symbol: seastar::testing::entry_point(int, char**) >>> referenced by scylla_test_case.hh:22 (./test/lib/scylla_test_case.hh:22) >>> build/debug/test/boost/database_test.o:(main) ... ld.lld: error: undefined symbol: boost::unit_test::unit_test_log_t::set_checkpoint(boost::unit_test::basic_cstring, unsigned long, boost::unit_tes t::basic_cstring) >>> referenced by database_test.cc:298 (test/boost/database_test.cc:298) >>> build/debug/test/boost/database_test.o:(require_exist(seastar::basic_sstring const&, bool)) ... ``` with this change, the extra assignment expression is dropped. this should not cause any regression. as f'$seastar_libs_{mode}' as been included as a part of `local_libs` before the grand if-the-else block in the for loop before this `f.write()` statement. Signed-off-by: Kefu Chai Closes #14041 --- configure.py | 1 - 1 file changed, 1 deletion(-) diff --git a/configure.py b/configure.py index e2d7802ceb..fa5e1be146 100755 --- a/configure.py +++ b/configure.py @@ -2008,7 +2008,6 @@ with open(buildfile, 'w') as f: rust_headers[hh] = src else: raise Exception('No rule for ' + src) - f.write(' libs = $seastar_libs_{}\n'.format(mode)) f.write( 'build {mode}-objects: phony {objs}\n'.format( mode=mode,