All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] jack2: use -j only when is PARALLEL_JOBS is defined
@ 2015-03-29  7:35 Fabio Porcedda
  2015-03-29  7:35 ` [Buildroot] [PATCH 2/2] boost: " Fabio Porcedda
  2015-03-29 13:17 ` [Buildroot] [PATCH 1/2] jack2: " Thomas Petazzoni
  0 siblings, 2 replies; 4+ messages in thread
From: Fabio Porcedda @ 2015-03-29  7:35 UTC (permalink / raw)
  To: buildroot

When top-level parallel makefile is being used the PARALLEL_JOBS is
empty but the build system of jack2 does not accept a -j without an
argument so don't use the -j option when PARALLEL_JOBS is empty.

Fix build failure:
waf: error: -j option requires an argument
<snip>
make: *** [/home/tetsuya/buildroot/br2/output/build/jack2-ab409a65df95bc261ff72b52d6b3f4a65cf3266a/.stamp_built] Error 2

Signed-off-by: Fabio Porcedda <fabio.porcedda@gmail.com>
---
 package/jack2/jack2.mk | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/package/jack2/jack2.mk b/package/jack2/jack2.mk
index 3f52ff4..a472df2 100644
--- a/package/jack2/jack2.mk
+++ b/package/jack2/jack2.mk
@@ -10,6 +10,10 @@ JACK2_LICENSE = GPLv2+ (jack server), LGPLv2.1+ (jack library)
 JACK2_DEPENDENCIES = libsamplerate libsndfile alsa-lib host-python
 JACK2_INSTALL_STAGING = YES
 
+ifneq ($(PARALLEL_JOBS),)
+ JACK2_PARALLEL_JOBS = -j$(PARALLEL_JOBS)
+endif
+
 define JACK2_CONFIGURE_CMDS
 	(cd $(@D); \
 		$(TARGET_CONFIGURE_OPTS)	\
@@ -20,7 +24,8 @@ define JACK2_CONFIGURE_CMDS
 endef
 
 define JACK2_BUILD_CMDS
-	(cd $(@D); $(HOST_DIR)/usr/bin/python2 ./waf build -j $(PARALLEL_JOBS))
+	(cd $(@D); $(HOST_DIR)/usr/bin/python2 \
+		./waf build $(JACK2_PARALLEL_JOBS))
 endef
 
 define JACK2_INSTALL_TARGET_CMDS
-- 
2.3.4

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

* [Buildroot] [PATCH 2/2] boost: use -j only when is PARALLEL_JOBS is defined
  2015-03-29  7:35 [Buildroot] [PATCH 1/2] jack2: use -j only when is PARALLEL_JOBS is defined Fabio Porcedda
@ 2015-03-29  7:35 ` Fabio Porcedda
  2015-03-29 13:17 ` [Buildroot] [PATCH 1/2] jack2: " Thomas Petazzoni
  1 sibling, 0 replies; 4+ messages in thread
From: Fabio Porcedda @ 2015-03-29  7:35 UTC (permalink / raw)
  To: buildroot

When top-level parallel makefile is being used the PARALLEL_JOBS is
empty but the b2 command of boost does not accept a -j without an
argument so don't use the -j option when PARALLEL_JOBS is empty.

Fix install failure:
Invalid value for the '-j' option, valid values are 1 through 256.
make: *** [/home/tetsuya/buildroot/br2/output/build/boost-1.57.0/.stamp_staging_installed] Error 1

Signed-off-by: Fabio Porcedda <fabio.porcedda@gmail.com>
---
 package/boost/boost.mk | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/package/boost/boost.mk b/package/boost/boost.mk
index 56a6c34..a8f5c9a 100644
--- a/package/boost/boost.mk
+++ b/package/boost/boost.mk
@@ -23,6 +23,10 @@ HOST_BOOST_FLAGS = --without-icu \
 	iostreams locale log math mpi program_options python random regex \
 	serialization signals system test thread timer wave)
 
+ifneq ($(PARALLEL_JOBS),)
+BOOST_PARALLEL_JOBS = -j$(PARALLEL_JOBS)
+endif
+
 # coroutine breaks on some weak toolchains and it's new for 1.54+
 BOOST_WITHOUT_FLAGS = coroutine
 
@@ -121,7 +125,7 @@ define HOST_BOOST_CONFIGURE_CMDS
 endef
 
 define BOOST_INSTALL_TARGET_CMDS
-	(cd $(@D) && ./b2 -j$(PARALLEL_JOBS) -q -d+1 \
+	(cd $(@D) && ./b2 $(BOOST_PARALLEL_JOBS) -q -d+1 \
 	--user-config=$(@D)/user-config.jam \
 	$(BOOST_OPTS) \
 	--prefix=$(TARGET_DIR)/usr \
@@ -130,7 +134,7 @@ define BOOST_INSTALL_TARGET_CMDS
 endef
 
 define HOST_BOOST_BUILD_CMDS
-	(cd $(@D) && ./b2 -j$(PARALLEL_JOBS) -q -d+1 \
+	(cd $(@D) && ./b2 $(BOOST_PARALLEL_JOBS) -q -d+1 \
 	--user-config=$(@D)/user-config.jam \
 	$(HOST_BOOST_OPTS) \
 	--ignore-site-config \
@@ -138,7 +142,7 @@ define HOST_BOOST_BUILD_CMDS
 endef
 
 define HOST_BOOST_INSTALL_CMDS
-	(cd $(@D) && ./b2 -j$(PARALLEL_JOBS) -q -d+1 \
+	(cd $(@D) && ./b2 $(BOOST_PARALLEL_JOBS) -q -d+1 \
 	--user-config=$(@D)/user-config.jam \
 	$(HOST_BOOST_OPTS) \
 	--prefix=$(HOST_DIR)/usr \
@@ -147,7 +151,7 @@ define HOST_BOOST_INSTALL_CMDS
 endef
 
 define BOOST_INSTALL_STAGING_CMDS
-	(cd $(@D) && ./bjam -j$(PARALLEL_JOBS) -d+1 \
+	(cd $(@D) && ./bjam $(BOOST_PARALLEL_JOBS) -d+1 \
 	--user-config=$(@D)/user-config.jam \
 	$(BOOST_OPTS) \
 	--prefix=$(STAGING_DIR)/usr \
-- 
2.3.4

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

* [Buildroot] [PATCH 1/2] jack2: use -j only when is PARALLEL_JOBS is defined
  2015-03-29  7:35 [Buildroot] [PATCH 1/2] jack2: use -j only when is PARALLEL_JOBS is defined Fabio Porcedda
  2015-03-29  7:35 ` [Buildroot] [PATCH 2/2] boost: " Fabio Porcedda
@ 2015-03-29 13:17 ` Thomas Petazzoni
  2015-04-01  7:23   ` Fabio Porcedda
  1 sibling, 1 reply; 4+ messages in thread
From: Thomas Petazzoni @ 2015-03-29 13:17 UTC (permalink / raw)
  To: buildroot

Dear Fabio Porcedda,

On Sun, 29 Mar 2015 09:35:33 +0200, Fabio Porcedda wrote:
> When top-level parallel makefile is being used the PARALLEL_JOBS is
> empty but the build system of jack2 does not accept a -j without an
> argument so don't use the -j option when PARALLEL_JOBS is empty.

This is not quite true. PARALLEL_JOBS is empty because your
recommendation of using:

	make BR2_JLEVEL= -j$((`getconf _NPROCESSORS_ONLN`+1))

for top-level parallel build is maybe not the most appropriate one.

In addition, even when top-level parallel build is used, using purely
sequential build in each package may not be the good solution. Imagine
you have a number of packages to build, and one of them is particularly
long: if you don't build this package in parallel, the build time may
be increased.

So I believe that with the introduction of top-level parallel build, we
need a way of calculating a default reasonable BR2_JLEVEL, preferably
taking into account the make -jX value passed to the top-level make. We
indeed need to play on the number of jobs at the top-level, and the
number of jobs at the per-package level.

Also, your patch series does not handle all packages that use
$(PARALLEL_JOBS) :

package/boost/boost.mk: (cd $(@D) && ./b2 -j$(PARALLEL_JOBS) -q -d+1 \
package/boost/boost.mk: (cd $(@D) && ./b2 -j$(PARALLEL_JOBS) -q -d+1 \
package/boost/boost.mk: (cd $(@D) && ./b2 -j$(PARALLEL_JOBS) -q -d+1 \
package/boost/boost.mk: (cd $(@D) && ./bjam -j$(PARALLEL_JOBS) -d+1 \
package/cmake/cmake.mk:                 --parallel=$(PARALLEL_JOBS) -- \
package/jack2/jack2.mk: (cd $(@D); $(HOST_DIR)/usr/bin/python2 ./waf build -j $(PARALLEL_JOBS))
package/midori/midori.mk:       (cd $(@D); $(HOST_DIR)/usr/bin/python2 ./waf build -j $(PARALLEL_JOBS))
package/qt/qt.mk:               MAKEFLAGS="$(MAKEFLAGS) -j$(PARALLEL_JOBS)" ./configure \
package/qt5/qt5base/qt5base.mk:         MAKEFLAGS="$(MAKEFLAGS) -j$(PARALLEL_JOBS)" \

We probably need to convert all of these to:

	$(if $(PARALLEL_JOBS),-j$(PARALLEL_JOBS))

like is done for the global $(MAKE) variable.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] [PATCH 1/2] jack2: use -j only when is PARALLEL_JOBS is defined
  2015-03-29 13:17 ` [Buildroot] [PATCH 1/2] jack2: " Thomas Petazzoni
@ 2015-04-01  7:23   ` Fabio Porcedda
  0 siblings, 0 replies; 4+ messages in thread
From: Fabio Porcedda @ 2015-04-01  7:23 UTC (permalink / raw)
  To: buildroot

On Sun, Mar 29, 2015 at 3:17 PM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Dear Fabio Porcedda,
>
> On Sun, 29 Mar 2015 09:35:33 +0200, Fabio Porcedda wrote:
>> When top-level parallel makefile is being used the PARALLEL_JOBS is
>> empty but the build system of jack2 does not accept a -j without an
>> argument so don't use the -j option when PARALLEL_JOBS is empty.
>
> This is not quite true. PARALLEL_JOBS is empty because your
> recommendation of using:
>
>         make BR2_JLEVEL= -j$((`getconf _NPROCESSORS_ONLN`+1))
>
> for top-level parallel build is maybe not the most appropriate one.

Good idea!

> In addition, even when top-level parallel build is used, using purely
> sequential build in each package may not be the good solution. Imagine
> you have a number of packages to build, and one of them is particularly
> long: if you don't build this package in parallel, the build time may
> be increased.
>
> So I believe that with the introduction of top-level parallel build, we
> need a way of calculating a default reasonable BR2_JLEVEL, preferably
> taking into account the make -jX value passed to the top-level make. We
> indeed need to play on the number of jobs at the top-level, and the
> number of jobs at the per-package level.

About taking in account the value passed to -j i don't know an
automatic way to do it.

At least checking the MAKEFLAGS we can know if the -j options was used
so we can use something like this:

diff --git a/package/Makefile.in b/package/Makefile.in
index 803b162..698626f 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -18,7 +18,7 @@ PARALLEL_JOBS := $(BR2_JLEVEL)
 endif

 MAKE1 := $(HOSTMAKE) -j1
-MAKE := $(HOSTMAKE) $(if $(PARALLEL_JOBS),-j$(PARALLEL_JOBS))
+override MAKE = $(HOSTMAKE) $(if $(findstring j,$(filter-out
--%,$(MAKEFLAGS))),,-j$(PARALLEL_JOBS))

 ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
 TARGET_VENDOR = $(call qstrip,$(BR2_TOOLCHAIN_BUILDROOT_VENDOR))

With this change we use can use the followin command line:
  make -jX

That way we  don't need to set as empty the BR2_JLEVEL  variable and
we can leave unchanged the lines that use the PARALLEL_JOBS variable.

> Also, your patch series does not handle all packages that use
> $(PARALLEL_JOBS) :
>
> package/boost/boost.mk: (cd $(@D) && ./b2 -j$(PARALLEL_JOBS) -q -d+1 \
> package/boost/boost.mk: (cd $(@D) && ./b2 -j$(PARALLEL_JOBS) -q -d+1 \
> package/boost/boost.mk: (cd $(@D) && ./b2 -j$(PARALLEL_JOBS) -q -d+1 \
> package/boost/boost.mk: (cd $(@D) && ./bjam -j$(PARALLEL_JOBS) -d+1 \
> package/cmake/cmake.mk:                 --parallel=$(PARALLEL_JOBS) -- \
> package/jack2/jack2.mk: (cd $(@D); $(HOST_DIR)/usr/bin/python2 ./waf build -j $(PARALLEL_JOBS))
> package/midori/midori.mk:       (cd $(@D); $(HOST_DIR)/usr/bin/python2 ./waf build -j $(PARALLEL_JOBS))
> package/qt/qt.mk:               MAKEFLAGS="$(MAKEFLAGS) -j$(PARALLEL_JOBS)" ./configure \
> package/qt5/qt5base/qt5base.mk:         MAKEFLAGS="$(MAKEFLAGS) -j$(PARALLEL_JOBS)" \
>
> We probably need to convert all of these to:
>
>         $(if $(PARALLEL_JOBS),-j$(PARALLEL_JOBS))
>
> like is done for the global $(MAKE) variable.

You are right.

Thanks for reviewing.
-- 
Fabio Porcedda

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

end of thread, other threads:[~2015-04-01  7:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-29  7:35 [Buildroot] [PATCH 1/2] jack2: use -j only when is PARALLEL_JOBS is defined Fabio Porcedda
2015-03-29  7:35 ` [Buildroot] [PATCH 2/2] boost: " Fabio Porcedda
2015-03-29 13:17 ` [Buildroot] [PATCH 1/2] jack2: " Thomas Petazzoni
2015-04-01  7:23   ` Fabio Porcedda

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.