Re: [PATCH 2/2] Makefile: Fix build of utest on systems with --as-needed enabled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 20 Jul 2020 19:44:53 +0300
Vitaly Chikunov <vt@xxxxxxxxxxxx> 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@xxxxxxxxxxxx>
> Cc: Dmitry V. Levin <ldv@xxxxxxxxxxxx>

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




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux