* [PATCH 1/2] Makefile: Fix CUNIT_INSTALLED test to work with make 4.3 and dash
@ 2020-07-20 16:44 Vitaly Chikunov
2020-07-20 16:44 ` [PATCH 2/2] Makefile: Fix build of utest on systems with --as-needed enabled Vitaly Chikunov
0 siblings, 1 reply; 3+ messages in thread
From: Vitaly Chikunov @ 2020-07-20 16:44 UTC (permalink / raw)
To: Steven Rostedt, linux-trace-devel; +Cc: Vitaly Chikunov, Dmitry V . Levin
In GNU Make 4.3 there is backward incompatible change that there is no need
to quote '#' in shell invocations anymore. If quoted, backslash character is
passed into gcc making cunit (and vsock) tests fail to compile.
Also, `echo -e' is replaced with `printf' to interpret '\n', because, on
Debian dash's `echo' does not support `-e', thus having `-e' passed into
test source making gcc fail to compile the test.
make test error message:
Makefile:342: *** CUnit framework not installed, cannot build unit tests. Stop.
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
Cc: Dmitry V. Levin <ldv@altlinux.org>
---
Makefile | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 4b72a04..6b606da 100644
--- a/Makefile
+++ b/Makefile
@@ -86,6 +86,8 @@ plugin_traceevent_dir_SQ = $(subst ','\'',$(plugin_traceevent_dir))
plugin_tracecmd_dir_SQ = $(subst ','\'',$(plugin_tracecmd_dir))
python_dir_SQ = $(subst ','\'',$(python_dir))
+pound := \#
+
VAR_DIR = -DVAR_DIR="$(var_dir)"
VAR_DIR_SQ = '$(subst ','\'',$(VAR_DIR))'
var_dir_SQ = '$(subst ','\'',$(var_dir))'
@@ -233,14 +235,14 @@ CFLAGS ?= -g -Wall
CPPFLAGS ?=
LDFLAGS ?=
-VSOCK_DEFINED := $(shell if (echo "\#include <linux/vm_sockets.h>" | $(CC) -E - >/dev/null 2>&1) ; then echo 1; else echo 0 ; fi)
+VSOCK_DEFINED := $(shell if (echo "$(pound)include <linux/vm_sockets.h>" | $(CC) -E - >/dev/null 2>&1) ; then echo 1; else echo 0 ; fi)
export VSOCK_DEFINED
ifeq ($(VSOCK_DEFINED), 1)
CFLAGS += -DVSOCK
endif
-CUNIT_INSTALLED := $(shell if (echo -e "\#include <CUnit/Basic.h>\n void main(){CU_initialize_registry();}" | $(CC) -x c -lcunit - >/dev/null 2>&1) ; then echo 1; else echo 0 ; fi)
+CUNIT_INSTALLED := $(shell if (printf "$(pound)include <CUnit/Basic.h>\n void main(){CU_initialize_registry();}" | $(CC) -x c -lcunit - >/dev/null 2>&1) ; then echo 1; else echo 0 ; fi)
export CUNIT_INSTALLED
export CFLAGS
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] Makefile: Fix build of utest on systems with --as-needed enabled
2020-07-20 16:44 [PATCH 1/2] Makefile: Fix CUNIT_INSTALLED test to work with make 4.3 and dash Vitaly Chikunov
@ 2020-07-20 16:44 ` Vitaly Chikunov
2020-07-22 21:58 ` Steven Rostedt
0 siblings, 1 reply; 3+ messages in thread
From: Vitaly Chikunov @ 2020-07-20 16:44 UTC (permalink / raw)
To: Steven Rostedt, linux-trace-devel; +Cc: Vitaly Chikunov, Dmitry V . Levin
On systems (such as ALT Linux) where `--as-needed' is passed to ld by
default, building tests fail due to CUNIT_INSTALLED test failure to link
with libcunit, becasue `-lcunit' is passed before input file (which is
`-'). Move `-lcunit' after '-' to link it properly.
To reproduce `make CC='gcc -Wl,--as-needed' test`. Error message:
Makefile:344: *** CUnit framework not installed, cannot build unit tests. Stop.
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
Cc: Dmitry V. Levin <ldv@altlinux.org>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 6b606da..83e5646 100644
--- a/Makefile
+++ b/Makefile
@@ -242,7 +242,7 @@ ifeq ($(VSOCK_DEFINED), 1)
CFLAGS += -DVSOCK
endif
-CUNIT_INSTALLED := $(shell if (printf "$(pound)include <CUnit/Basic.h>\n void main(){CU_initialize_registry();}" | $(CC) -x c -lcunit - >/dev/null 2>&1) ; then echo 1; else echo 0 ; fi)
+CUNIT_INSTALLED := $(shell if (printf "$(pound)include <CUnit/Basic.h>\n void main(){CU_initialize_registry();}" | $(CC) -x c - -lcunit >/dev/null 2>&1) ; then echo 1; else echo 0 ; fi)
export CUNIT_INSTALLED
export CFLAGS
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] Makefile: Fix build of utest on systems with --as-needed enabled
2020-07-20 16:44 ` [PATCH 2/2] Makefile: Fix build of utest on systems with --as-needed enabled Vitaly Chikunov
@ 2020-07-22 21:58 ` Steven Rostedt
0 siblings, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2020-07-22 21:58 UTC (permalink / raw)
To: Vitaly Chikunov; +Cc: linux-trace-devel, Dmitry V . Levin
On Mon, 20 Jul 2020 19:44:53 +0300
Vitaly Chikunov <vt@altlinux.org> wrote:
> On systems (such as ALT Linux) where `--as-needed' is passed to ld by
> default, building tests fail due to CUNIT_INSTALLED test failure to link
> with libcunit, becasue `-lcunit' is passed before input file (which is
> `-'). Move `-lcunit' after '-' to link it properly.
>
> To reproduce `make CC='gcc -Wl,--as-needed' test`. Error message:
>
> Makefile:344: *** CUnit framework not installed, cannot build unit tests. Stop.
>
> Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
> Cc: Dmitry V. Levin <ldv@altlinux.org>
I applied both these patches and released 2.9.1.
Thanks Vitaly!
-- Steve
> ---
> Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index 6b606da..83e5646 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -242,7 +242,7 @@ ifeq ($(VSOCK_DEFINED), 1)
> CFLAGS += -DVSOCK
> endif
>
> -CUNIT_INSTALLED := $(shell if (printf "$(pound)include <CUnit/Basic.h>\n void main(){CU_initialize_registry();}" | $(CC) -x c -lcunit - >/dev/null 2>&1) ; then echo 1; else echo 0 ; fi)
> +CUNIT_INSTALLED := $(shell if (printf "$(pound)include <CUnit/Basic.h>\n void main(){CU_initialize_registry();}" | $(CC) -x c - -lcunit >/dev/null 2>&1) ; then echo 1; else echo 0 ; fi)
> export CUNIT_INSTALLED
>
> export CFLAGS
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-07-22 21:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-20 16:44 [PATCH 1/2] Makefile: Fix CUNIT_INSTALLED test to work with make 4.3 and dash Vitaly Chikunov
2020-07-20 16:44 ` [PATCH 2/2] Makefile: Fix build of utest on systems with --as-needed enabled Vitaly Chikunov
2020-07-22 21:58 ` Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).