Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Francis Laniel <flaniel@linux.microsoft.com>
To: buildroot@buildroot.org, Arnout Vandecappelle <arnout@mind.be>
Cc: Angelo Compagnucci <angelo.compagnucci@gmail.com>,
	bradford barr <bradford@density.io>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [Buildroot] [RFC PATCH v1 1/2] tbb: new package
Date: Mon, 11 Apr 2022 19:06:52 +0100	[thread overview]
Message-ID: <2625093.mvXUDI8C0e@pwmachine> (raw)
In-Reply-To: <fc1b7c76-80b2-51a5-d0f5-7afaf05a9a0a@mind.be>

Le samedi 9 avril 2022, 14:42:59 BST Arnout Vandecappelle a écrit :
>   Hi Francis,

Hi

>   Thank you for this patch. I applied to master but with quite a few
> changes.

You are welcome and thank you for the modifications, they made the contribution 
better and I learnt some few tricks to make better buildroot contribution!

> On 07/04/2022 20:24, Francis Laniel wrote:
> > From: bradford barr <bradford@density.io>
> > 
> > Intel Threading Building Blocks (TBB), is a C++ library to help developers
> > write highly parallelized applications. OpenCV uses it to accelerate some
> > of it's more heavy weight procedures.
> > 
> > Signed-off-by: bradford barr <bradford@density.io>
> > Signed-off-by: Francis Laniel <flaniel@linux.microsoft.com>
> > ---
> > 
> >   DEVELOPERS                                    |  1 +
> >   package/Config.in                             |  1 +
> >   .../0001-tbb-Enable-cross-compilation.patch   | 55 +++++++++++++++++++
> >   package/tbb/Config.in                         | 16 ++++++
> >   package/tbb/tbb.hash                          |  2 +
> >   package/tbb/tbb.mk                            | 39 +++++++++++++
> >   6 files changed, 114 insertions(+)
> >   create mode 100644 package/tbb/0001-tbb-Enable-cross-compilation.patch
> >   create mode 100644 package/tbb/Config.in
> >   create mode 100644 package/tbb/tbb.hash
> >   create mode 100644 package/tbb/tbb.mk
> > 
> > diff --git a/DEVELOPERS b/DEVELOPERS
> > index a66b9d7eee..ef4ddcab50 100644
> > --- a/DEVELOPERS
> > +++ b/DEVELOPERS
> > @@ -970,6 +970,7 @@ F:	package/odhcploc/
> > 
> >   N:	Francis Laniel <flaniel@linux.microsoft.com>
> >   F:	package/pahole/
> > 
> > +F:	package/tbb/
> > 
> >   N:	Francisco Gonzalez <gzmorell@gmail.com>
> >   F:	package/ser2net/
> > 
> > diff --git a/package/Config.in b/package/Config.in
> > index 0d5d763180..24f7af5ea8 100644
> > --- a/package/Config.in
> > +++ b/package/Config.in
> > @@ -2044,6 +2044,7 @@ endif
> > 
> >   	source "package/skalibs/Config.in"
> >   	source "package/sphinxbase/Config.in"
> >   	source "package/startup-notification/Config.in"
> > 
> > +	source "package/tbb/Config.in"
> > 
> >   	source "package/tinycbor/Config.in"
> >   	source "package/tz/Config.in"
> >   	source "package/tzdata/Config.in"
> > 
> > diff --git a/package/tbb/0001-tbb-Enable-cross-compilation.patch
> > b/package/tbb/0001-tbb-Enable-cross-compilation.patch new file mode
> > 100644
> > index 0000000000..652d59c47b
> > --- /dev/null
> > +++ b/package/tbb/0001-tbb-Enable-cross-compilation.patch
> > @@ -0,0 +1,55 @@
> > +From 42c3faff14917f687aab405d8f571e352ffdf3f5 Mon Sep 17 00:00:00 2001
> > +From: Francis Laniel <flaniel@linux.microsoft.com>
> > +Date: Wed, 6 Apr 2022 15:58:02 +0100
> > +Subject: [PATCH] tbb: Enable cross-compilation.
> > +
> > +This patch replaces hardcoded value for CPLUS and CONLY with $(CXX) and
> > $(CC). +So, by defining CC= it is possible to cross compile this library
> > using a +cross-compiler.
> > +
> > +This patch was originally written by:
> > +Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
> > +and taken from:
> > +https://github.com/intel/luv-yocto/blob/3b0688bc9a5e8d52b6ca461b15fb4abd3
> > eaaf7a8/meta-oe/recipes-support/tbb/tbb/cross-compile.patch +
> > +Signed-off-by: Francis Laniel <flaniel@linux.microsoft.com>
> > +---
> > + build/linux.clang.inc | 5 +++--
> > + build/linux.gcc.inc   | 5 +++--
> > + 2 files changed, 6 insertions(+), 4 deletions(-)
> > +
> > +diff --git a/build/linux.clang.inc b/build/linux.clang.inc
> > +index 5a459ef5..a0777db5 100644
> > +--- a/build/linux.clang.inc
> > ++++ b/build/linux.clang.inc
> > +@@ -31,8 +31,9 @@ DYLIB_KEY = -shared
> > + EXPORT_KEY = -Wl,--version-script,
> > + LIBDL = -ldl
> > +
> > +-CPLUS = clang++
> > +-CONLY = clang
> > ++CPLUS = $(CXX)
> > ++CONLY = $(CC)
> > ++CPLUS_FLAGS = $(CXXFLAGS)
> 
>   I dropped this patch. Instead, I simply passed CPLUS, CONLY and
> CPLUS_FLAGS in the $(MAKE) call.
> 
> > + LIB_LINK_FLAGS = $(DYLIB_KEY) -Wl,-soname=$(BUILDING_LIBRARY)
> > + LIBS += -lpthread -lrt
> > + LINK_FLAGS = -Wl,-rpath-link=. -rdynamic
> > +diff --git a/build/linux.gcc.inc b/build/linux.gcc.inc
> > +index 786c4153..30242a82 100644
> > +--- a/build/linux.gcc.inc
> > ++++ b/build/linux.gcc.inc
> > +@@ -32,8 +32,9 @@ DYLIB_KEY = -shared
> > + EXPORT_KEY = -Wl,--version-script,
> > + LIBDL = -ldl
> > +
> > +-CPLUS = g++
> > +-CONLY = gcc
> > ++CPLUS = $(CXX)
> > ++CONLY = $(CC)
> > ++CPLUS_FLAGS = $(CXXFLAGS)
> > + LIB_LINK_FLAGS = $(DYLIB_KEY) -Wl,-soname=$(BUILDING_LIBRARY)
> > + LIBS += -lpthread -lrt
> > + LINK_FLAGS = -Wl,-rpath-link=. -rdynamic
> > +--
> > +2.25.1
> > +
> > diff --git a/package/tbb/Config.in b/package/tbb/Config.in
> > new file mode 100644
> > index 0000000000..0f40b74d31
> > --- /dev/null
> > +++ b/package/tbb/Config.in
> > @@ -0,0 +1,16 @@
> > +config BR2_PACKAGE_TBB
> > +	bool "tbb"
> > +	depends on BR2_TOOLCHAIN_USES_GLIBC
> > +	depends on !BR2_STATIC_LIBS
> > +	depends on BR2_TOOLCHAIN_HAS_THREADS
> > +	depends on BR2_INSTALL_LIBSTDCPP
> > +	help
> > +	  Intel(R) Threading Building Blocks (Intel(R) TBB) lets you
> > +	  easily write parallel C++ programs that take full advantage
> > +	  of multicore performance, that are portable, composable and
> > +	  have future-proof scalability.
> > +
> > +	  https://www.threadingbuildingblocks.org/
> > +
> > +comment "tbb needs a glibc toolchain w/ dynamic library, threads, C++"
> > +	depends on !BR2_TOOLCHAIN_USES_GLIBC || BR2_STATIC_LIBS ||
> > !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP diff --git
> > a/package/tbb/tbb.hash b/package/tbb/tbb.hash
> > new file mode 100644
> > index 0000000000..e9fb7511b8
> > --- /dev/null
> > +++ b/package/tbb/tbb.hash
> > @@ -0,0 +1,2 @@
> > +# Locally calculated
> > +sha256  b8dbab5aea2b70cf07844f86fa413e549e099aa3205b6a04059ca92ead93a372 
> > tbb-2018_U5.tar.gz
>   You also need to include a hash for the license file.
> 
> > diff --git a/package/tbb/tbb.mk b/package/tbb/tbb.mk
> > new file mode 100644
> > index 0000000000..cf06579b98
> > --- /dev/null
> > +++ b/package/tbb/tbb.mk
> > @@ -0,0 +1,39 @@
> > +#########################################################################
> > ####### +#
> > +# tbb
> > +#
> > +#########################################################################
> > ####### +
> > +TBB_VERSION = 2018_U5
> > +TBB_SITE = $(call github,01org,tbb,$(TBB_VERSION))
> > +TBB_INSTALL_STAGING = YES
> > +TBB_LICENSE = Apache-2.0
> > +TBB_LICENSE_FILES = LICENSE
> > +
> > +TBB_SO_VERSION = 2
> > +TBB_LIBS = libtbb libtbbmalloc libtbbmalloc_proxy
> > +TBB_BIN_PATH = $(@D)/build/linux_*
> > +
> > +define TBB_BUILD_CMDS
> > +	$(MAKE) $(TARGET_CONFIGURE_OPTS) arch=$(BR2_ARCH) -C $(@D)
> 
>   The values for arch that are used by tbb are different from the values
> that BR2_ARCH has. I studied this in more detail:
> 
> # arch is normally set based on uname -m with some conversions. However,
> # it is not really used for much:
> # - to decide between 32 or 64-bit files (based on '64' in the name)
> # - to decide on some arch-specific CFLAGS like -m32, which we don't
> actually want # - to set DO_ITT_NOTIFY if it's x86 (32 or 64 bit)
> # - to include assembler source, but it only exists for ia64
> # The only thing we actually want from the above is the 32/64-bit, and
> # DO_ITT_NOTIFY. Therefore, set arch to a fixed value which is unknown to
> # the tbb build system, and set DO_ITT_NOTIFY explicitly.
> 
>   Regards,
>   Arnout
> 
> > +endef
> > +
> > +define TBB_INSTALL_LIBS
> > +	$(foreach lib,$(TBB_LIBS),
> > +		$(INSTALL) -D -m 0755 $(TBB_BIN_PATH)/$(lib).so.$
(TBB_SO_VERSION) \
> > +			$(1)/usr/lib/$(lib).so.$(TBB_SO_VERSION) ;
> > +		ln -sf $(lib).so.$(TBB_SO_VERSION) $(1)/usr/lib/$(lib).so
> > +	)
> > +endef
> > +
> > +define TBB_INSTALL_STAGING_CMDS
> > +	mkdir -p $(STAGING_DIR)/usr/include/
> > +	cp -a $(@D)/include/* $(STAGING_DIR)/usr/include/
> > +	$(call TBB_INSTALL_LIBS,$(STAGING_DIR))
> > +endef
> > +
> > +define TBB_INSTALL_TARGET_CMDS
> > +	$(call TBB_INSTALL_LIBS,$(TARGET_DIR))
> > +endef
> > +
> > +$(eval $(generic-package))




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

  reply	other threads:[~2022-04-11 18:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-07 18:24 [Buildroot] [RFC PATCH v1 0/2] Fix sysdig build errors Francis Laniel
2022-04-07 18:24 ` [Buildroot] [RFC PATCH v1 1/2] tbb: new package Francis Laniel
2022-04-09 13:42   ` Arnout Vandecappelle
2022-04-11 18:06     ` Francis Laniel [this message]
2022-04-07 18:24 ` [Buildroot] [RFC PATCH v1 2/2] package/sysdig: bump version to 0.27.1 Francis Laniel
2022-04-09 14:40   ` Arnout Vandecappelle
2022-04-11 18:11     ` Francis Laniel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2625093.mvXUDI8C0e@pwmachine \
    --to=flaniel@linux.microsoft.com \
    --cc=angelo.compagnucci@gmail.com \
    --cc=arnout@mind.be \
    --cc=bradford@density.io \
    --cc=buildroot@buildroot.org \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox