All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2, 1/1] package/zstd: fix build without threads
@ 2022-06-12  8:56 Fabrice Fontaine
  2022-06-12 14:56 ` Yann E. MORIN
  0 siblings, 1 reply; 2+ messages in thread
From: Fabrice Fontaine @ 2022-06-12  8:56 UTC (permalink / raw)
  To: buildroot; +Cc: Andrey Smirnov, Fabrice Fontaine

Move libzstd.pc in ZSTD_BUILD_LIBS so it will be suffixed by -nomt
without threads. As a result, libzstd.pc will not contain -pthread in
Libs.Private which will avoid the following static build failure with
zchunk) raised since commit 0f0e913f10caf21f23c2e46f210519a7a3bc0b32:

/home/buildroot/autobuild/instance-2/output-1/host/bin/aarch64_be-buildroot-linux-uclibc-gcc  -o src/unzck src/unzck.p/unzck.c.o src/unzck.p/util_common.c.o -Wl,--as-needed -Wl,--no-undefined -static -Wl,--start-group src/lib/libzck.a -largp /home/buildroot/autobuild/instance-2/output-1/host/aarch64_be-buildroot-linux-uclibc/sysroot/usr/lib/libzstd.a -pthread /home/buildroot/autobuild/instance-2/output-1/host/aarch64_be-buildroot-linux-uclibc/sysroot/usr/lib/libssl.a /home/buildroot/autobuild/instance-2/output-1/host/aarch64_be-buildroot-linux-uclibc/sysroot/usr/lib/libcrypto.a -Wl,--end-group
/home/buildroot/autobuild/instance-2/output-1/host/lib/gcc/aarch64_be-buildroot-linux-uclibc/10.3.0/../../../../aarch64_be-buildroot-linux-uclibc/bin/ld: cannot find -lpthread

Fixes:
 - http://autobuild.buildroot.org/results/481d1979920daaecac48dec763151e124651740f

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
Changes v1 -> v2:
 - Fix the following check-package error:
  package/zstd/zstd.mk:67: conditional override of variable ZSTD_BUILD_LIBS
  package/zstd/zstd.mk:70: conditional override of variable ZSTD_BUILD_LIBS

 package/zstd/zstd.mk | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/package/zstd/zstd.mk b/package/zstd/zstd.mk
index bef46deae8..b885506cca 100644
--- a/package/zstd/zstd.mk
+++ b/package/zstd/zstd.mk
@@ -39,13 +39,13 @@ endif
 ZSTD_OPTS += MOREFLAGS="$(TARGET_OPTIMIZATION) -D_GNU_SOURCE"
 
 ifeq ($(BR2_STATIC_LIBS),y)
-ZSTD_BUILD_LIBS = libzstd.a
+ZSTD_BUILD_LIBS = libzstd.a libzstd.pc
 ZSTD_INSTALL_LIBS = install-static
 else ifeq ($(BR2_SHARED_LIBS),y)
-ZSTD_BUILD_LIBS = lib
+ZSTD_BUILD_LIBS = lib libzstd.pc
 ZSTD_INSTALL_LIBS = install-shared
 else
-ZSTD_BUILD_LIBS = lib
+ZSTD_BUILD_LIBS = lib libzstd.pc
 ZSTD_INSTALL_LIBS = install-static install-shared
 endif
 
@@ -73,7 +73,7 @@ ZSTD_BUILD_LIBS := $(addsuffix -release,$(ZSTD_BUILD_LIBS))
 
 define ZSTD_BUILD_CMDS
 	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
-		-C $(@D)/lib $(ZSTD_BUILD_LIBS) libzstd.pc
+		-C $(@D)/lib $(ZSTD_BUILD_LIBS)
 	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
 		-C $(@D)/programs $(ZSTD_BUILD_PROG_TARGET)
 endef
-- 
2.35.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Buildroot] [PATCH v2, 1/1] package/zstd: fix build without threads
  2022-06-12  8:56 [Buildroot] [PATCH v2, 1/1] package/zstd: fix build without threads Fabrice Fontaine
@ 2022-06-12 14:56 ` Yann E. MORIN
  0 siblings, 0 replies; 2+ messages in thread
From: Yann E. MORIN @ 2022-06-12 14:56 UTC (permalink / raw)
  To: Fabrice Fontaine; +Cc: Andrey Smirnov, buildroot

Fabrice, All,

On 2022-06-12 10:56 +0200, Fabrice Fontaine spake thusly:
> Move libzstd.pc in ZSTD_BUILD_LIBS so it will be suffixed by -nomt
> without threads. As a result, libzstd.pc will not contain -pthread in
> Libs.Private which will avoid the following static build failure with
> zchunk) raised since commit 0f0e913f10caf21f23c2e46f210519a7a3bc0b32:
> 
> /home/buildroot/autobuild/instance-2/output-1/host/bin/aarch64_be-buildroot-linux-uclibc-gcc  -o src/unzck src/unzck.p/unzck.c.o src/unzck.p/util_common.c.o -Wl,--as-needed -Wl,--no-undefined -static -Wl,--start-group src/lib/libzck.a -largp /home/buildroot/autobuild/instance-2/output-1/host/aarch64_be-buildroot-linux-uclibc/sysroot/usr/lib/libzstd.a -pthread /home/buildroot/autobuild/instance-2/output-1/host/aarch64_be-buildroot-linux-uclibc/sysroot/usr/lib/libssl.a /home/buildroot/autobuild/instance-2/output-1/host/aarch64_be-buildroot-linux-uclibc/sysroot/usr/lib/libcrypto.a -Wl,--end-group
> /home/buildroot/autobuild/instance-2/output-1/host/lib/gcc/aarch64_be-buildroot-linux-uclibc/10.3.0/../../../../aarch64_be-buildroot-linux-uclibc/bin/ld: cannot find -lpthread
> 
> Fixes:
>  - http://autobuild.buildroot.org/results/481d1979920daaecac48dec763151e124651740f
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> ---
> Changes v1 -> v2:
>  - Fix the following check-package error:
>   package/zstd/zstd.mk:67: conditional override of variable ZSTD_BUILD_LIBS
>   package/zstd/zstd.mk:70: conditional override of variable ZSTD_BUILD_LIBS

You weantr my opinion in this? Those := overrides are wrong to begin
with.

So we should probably have:

    ZSTD_BUILD_LIBS_BASENAMES = libzstd.pc
    ifeq ($(BR2_STATIC_LIBS),y)
    ZSTD_BUILD_LIBS_BASENAMES += libzstd.a
    ZSTD_INSTALL_LIBS = install-static
    else ifeq ($(BR2_SHARED_LIBS),y)
    ZSTD_BUILD_LIBS_BASENAMES += lib
    ZSTD_INSTALL_LIBS = install-shared
    else
    ZSTD_BUILD_LIBS_BASENAMES += lib
    ZSTD_INSTALL_LIBS = install-static install-shared
    endif

    ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
    ZSTD_OPTS += HAVE_THREAD=1
    ZSTD_BUILD_LIBS_THREAD_SUFFIX = -mt
    else
    ZSTD_OPTS += HAVE_THREAD=0
    ZSTD_BUILD_LIBS_THREAD_SUFFIX = --nomt
    endif

    ZSTD_BUILD_LIBS = \
        $(addsuffix -release, \
            $(addsuffix $(ZSTD_BUILD_LIBS_THREAD_SUFFIX),\
                $(ZSTD_BUILD_LIBS_BASENAMES)))

And that would be a much better code, much easier to understand, and
that would not deviate from our usual coding style.

Regards,
Yann E. MORIN.

>  package/zstd/zstd.mk | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/package/zstd/zstd.mk b/package/zstd/zstd.mk
> index bef46deae8..b885506cca 100644
> --- a/package/zstd/zstd.mk
> +++ b/package/zstd/zstd.mk
> @@ -39,13 +39,13 @@ endif
>  ZSTD_OPTS += MOREFLAGS="$(TARGET_OPTIMIZATION) -D_GNU_SOURCE"
>  
>  ifeq ($(BR2_STATIC_LIBS),y)
> -ZSTD_BUILD_LIBS = libzstd.a
> +ZSTD_BUILD_LIBS = libzstd.a libzstd.pc
>  ZSTD_INSTALL_LIBS = install-static
>  else ifeq ($(BR2_SHARED_LIBS),y)
> -ZSTD_BUILD_LIBS = lib
> +ZSTD_BUILD_LIBS = lib libzstd.pc
>  ZSTD_INSTALL_LIBS = install-shared
>  else
> -ZSTD_BUILD_LIBS = lib
> +ZSTD_BUILD_LIBS = lib libzstd.pc
>  ZSTD_INSTALL_LIBS = install-static install-shared
>  endif
>  
> @@ -73,7 +73,7 @@ ZSTD_BUILD_LIBS := $(addsuffix -release,$(ZSTD_BUILD_LIBS))
>  
>  define ZSTD_BUILD_CMDS
>  	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
> -		-C $(@D)/lib $(ZSTD_BUILD_LIBS) libzstd.pc
> +		-C $(@D)/lib $(ZSTD_BUILD_LIBS)
>  	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
>  		-C $(@D)/programs $(ZSTD_BUILD_PROG_TARGET)
>  endef
> -- 
> 2.35.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-12 14:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-12  8:56 [Buildroot] [PATCH v2, 1/1] package/zstd: fix build without threads Fabrice Fontaine
2022-06-12 14:56 ` Yann E. MORIN

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.