From bab3d151b74cf649fcba20c525a3ea972d70dd5f Mon Sep 17 00:00:00 2001 From: Shinwoo Kim Date: Mon, 18 Mar 2019 13:05:53 +0900 Subject: [PATCH] Fix ASAN build error MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit There is a build error with following build option for ASAN. $ gbs build -A armv7l --include-all --extra-packs asan-force-options,asan-build-env --define 'asan 1' [Build Error] multiple definition of `child_pid' [How to Fix] This occurs when –fno-common flag is added to compiler (which is default in asan-force-options) some linking may fail with error like above. The reason of the bug is that global is defined in more than one compilation unit without extern or static. When using default –fcommon option global variables with the same name are merged into the same variable without signaling errors. When -fno-common option is enabled all global variables are treated separately as they supposed to be. It means that each global variable should be defined only once. Otherwise means an error in source code and is reported at linking stage. It must be fixed by modifying each declaration as static or merging into an extern declaration and a definition in a single .c file. Change-Id: If913d75c4b212f129e5535eb4f332e7721611215 --- tests/atk_test_util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/atk_test_util.h b/tests/atk_test_util.h index b2376d5..26462ed 100644 --- a/tests/atk_test_util.h +++ b/tests/atk_test_util.h @@ -36,7 +36,7 @@ #include #include "atk_suite.h" -pid_t child_pid; +static pid_t child_pid; void run_app (const char *file_name); AtspiAccessible *get_root_obj (const char *file_name); -- 2.34.1