* [Buildroot] [PATCHv2 0/3] Improved static/shared library handling
@ 2014-12-11 22:50 Thomas Petazzoni
2014-12-11 22:50 ` [Buildroot] [PATCHv2 1/3] Turn the static lib option into a choice with more options Thomas Petazzoni
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2014-12-11 22:50 UTC (permalink / raw)
To: buildroot
Hello,
This series contains the remaining patches for the improved
static/shared library handling.
Changes since v1:
* On the first patch, take into account the various comments made by
Yann (on the commit log, on defining a 'bool' type for the choice,
on the prompts for the options of the choice, on the help texts,
etc.)
* Split out the ncurses changes in another patch.
* Add Acked-by from Yann on the patch making "shared only" the
default.
Thanks,
Thomas
Thomas Petazzoni (3):
Turn the static lib option into a choice with more options
ncurses: better handling for shared/static library
Build shared libraries only as the default
Config.in | 45 ++++++++++++++++++++++++++++++++++++---------
arch/Config.in | 1 -
package/Makefile.in | 4 +++-
package/ncurses/ncurses.mk | 9 ++++++++-
4 files changed, 47 insertions(+), 12 deletions(-)
--
2.1.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [PATCHv2 1/3] Turn the static lib option into a choice with more options
2014-12-11 22:50 [Buildroot] [PATCHv2 0/3] Improved static/shared library handling Thomas Petazzoni
@ 2014-12-11 22:50 ` Thomas Petazzoni
2014-12-11 23:05 ` Yann E. MORIN
2014-12-11 22:50 ` [Buildroot] [PATCHv2 2/3] ncurses: better handling for shared/static library Thomas Petazzoni
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Thomas Petazzoni @ 2014-12-11 22:50 UTC (permalink / raw)
To: buildroot
This commit turns the single static option into a choice, which offers
various possibilities:
1. Build and use static libraries only;
2. Build both shared and static libraries, but use shared libraries;
3. Build and use shared libraries only.
On most platforms, (2) is currently the default, and kept as the
default in this commit. Of course, on certain platforms (Blackfin,
m68k), only option (1) will be available.
In addition to the introduction of the Config.in options, this commit
also:
* Removes the 'select BR2_STATIC_LIBS' from 'BR2_BINFMT_FLAT', since
with the use of a choice, we are guaranteed that BR2_STATIC_LIBS
will be selected when the binary format is BR2_BINFMT_FLAT, since
BR2_STATIC_LIBS will be the only possible solution in the choice.
* Changes package/Makefile.in to use the proper
--{enable,disable}-{shared,static} options for autotools packages.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
Config.in | 45 ++++++++++++++++++++++++++++++++++++---------
arch/Config.in | 1 -
package/Makefile.in | 4 +++-
3 files changed, 39 insertions(+), 11 deletions(-)
diff --git a/Config.in b/Config.in
index cdc5f0f..a647283 100644
--- a/Config.in
+++ b/Config.in
@@ -525,19 +525,46 @@ config BR2_ENABLE_SSP
comment "enabling Stack Smashing Protection requires support in the toolchain"
depends on !BR2_TOOLCHAIN_HAS_SSP
+choice
+
+ bool "libraries"
+ default BR2_SHARED_STATIC_LIBS if BR2_BINFMT_SUPPORTS_SHARED
+ default BR2_STATIC_LIBS if !BR2_BINFMT_SUPPORTS_SHARED
+ help
+ Select the type of libraries you want to use on the target.
+
+ The default is to build dynamic libraries and use those on
+ the target filesystem, except when the architecture and/or
+ the selected binary format does not support shared
+ libraries.
+
config BR2_STATIC_LIBS
- bool "build statically linked applications, no dynamic libraries"
+ bool "static only"
help
- Build all applications for the target statically linked.
- This potentially increases your filesystem size and should only be
- used if you know what you do.
+ Build and use only static libraries. No shared libraries
+ will be instaled on the target. This potentially increases
+ your code size and should only be used if you know what you
+ are doing. Note that some packages may not be available when
+ this option is enabled, due to their need for dynamic
+ library support.
- Note that some applications cannot be build statically and so are
- intentionally disabled.
+config BR2_SHARED_LIBS
+ bool "shared only"
+ depends on BR2_BINFMT_SUPPORTS_SHARED
+ help
+ Build and use only shared libraries. This is the recommended
+ solution as it saves space and build time.
+
+config BR2_SHARED_STATIC_LIBS
+ bool "both static and shared"
+ depends on BR2_BINFMT_SUPPORTS_SHARED
+ help
+ Build both shared and static libraries, but link executables
+ dynamically. While building both shared and static libraries
+ take more time and more disk space, having static libraries
+ may be useful to link some of the applications statically.
- The default (if this option is disabled) is to build dynamic
- libraries and dynamically link applications to use those on the
- target filesystem.
+endchoice
config BR2_PACKAGE_OVERRIDE_FILE
diff --git a/arch/Config.in b/arch/Config.in
index d06ab5e..890e7e2 100644
--- a/arch/Config.in
+++ b/arch/Config.in
@@ -284,7 +284,6 @@ config BR2_BINFMT_FDPIC
config BR2_BINFMT_FLAT
bool "FLAT"
depends on BR2_bfin || BR2_m68k
- select BR2_STATIC_LIBS
help
FLAT binary is a relatively simple and lightweight executable format
based on the original a.out format. It is widely used in environment
diff --git a/package/Makefile.in b/package/Makefile.in
index 50f86ad..a63a2e8 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -394,7 +394,9 @@ SHARED_STATIC_LIBS_OPTS = --enable-static --disable-shared
TARGET_CFLAGS += -static
TARGET_CXXFLAGS += -static
TARGET_LDFLAGS += -static
-else
+else ifeq ($(BR2_SHARED_LIBS),y)
+SHARED_STATIC_LIBS_OPTS = --disable-static --enable-shared
+else ifeq ($(BR2_SHARED_STATIC_LIBS),y)
SHARED_STATIC_LIBS_OPTS = --enable-static --enable-shared
endif
--
2.1.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Buildroot] [PATCHv2 2/3] ncurses: better handling for shared/static library
2014-12-11 22:50 [Buildroot] [PATCHv2 0/3] Improved static/shared library handling Thomas Petazzoni
2014-12-11 22:50 ` [Buildroot] [PATCHv2 1/3] Turn the static lib option into a choice with more options Thomas Petazzoni
@ 2014-12-11 22:50 ` Thomas Petazzoni
2014-12-11 23:06 ` Yann E. MORIN
2014-12-11 22:50 ` [Buildroot] [PATCHv2 3/3] Build shared libraries only as the default Thomas Petazzoni
2014-12-11 23:13 ` [Buildroot] [PATCHv2 0/3] Improved static/shared library handling Thomas Petazzoni
3 siblings, 1 reply; 7+ messages in thread
From: Thomas Petazzoni @ 2014-12-11 22:50 UTC (permalink / raw)
To: buildroot
Now that we have clear options for the three cases of shared only,
static only and shared+static, let's use them in ncurses to pass the
appropriate --{with,without}-{shared,normal} options.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
package/ncurses/ncurses.mk | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/package/ncurses/ncurses.mk b/package/ncurses/ncurses.mk
index 645c25c..f54f379 100644
--- a/package/ncurses/ncurses.mk
+++ b/package/ncurses/ncurses.mk
@@ -15,7 +15,6 @@ NCURSES_LICENSE_FILES = README
NCURSES_CONFIG_SCRIPTS = ncurses$(NCURSES_LIB_SUFFIX)5-config
NCURSES_CONF_OPTS = \
- $(if $(BR2_STATIC_LIBS),--without-shared,--with-shared) \
--without-cxx \
--without-cxx-binding \
--without-ada \
@@ -36,6 +35,14 @@ ifeq ($(BR2_PACKAGE_BUSYBOX),y)
NCURSES_DEPENDENCIES += busybox
endif
+ifeq ($(BR2_STATIC_LIBS),y)
+NCURSES_CONF_OPTS += --without-shared --with-normal
+else ifeq ($(BR2_SHARED_LIBS),y)
+NCURSES_CONF_OPTS += --with-shared --without-normal
+else ifeq ($(BR2_SHARED_STATIC_LIBS),y)
+NCURSES_CONF_OPTS += --with-shared --with-normal
+endif
+
ifeq ($(BR2_PACKAGE_NCURSES_WCHAR),y)
NCURSES_CONF_OPTS += --enable-widec
NCURSES_LIB_SUFFIX = w
--
2.1.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Buildroot] [PATCHv2 3/3] Build shared libraries only as the default
2014-12-11 22:50 [Buildroot] [PATCHv2 0/3] Improved static/shared library handling Thomas Petazzoni
2014-12-11 22:50 ` [Buildroot] [PATCHv2 1/3] Turn the static lib option into a choice with more options Thomas Petazzoni
2014-12-11 22:50 ` [Buildroot] [PATCHv2 2/3] ncurses: better handling for shared/static library Thomas Petazzoni
@ 2014-12-11 22:50 ` Thomas Petazzoni
2014-12-11 23:13 ` [Buildroot] [PATCHv2 0/3] Improved static/shared library handling Thomas Petazzoni
3 siblings, 0 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2014-12-11 22:50 UTC (permalink / raw)
To: buildroot
Now that we have more options in terms of static/shared libraries,
switch from the existing default of building both shared and static
libraries to building shared libraries only (of course only on
platforms that support shared libraries).
Building both shared and static takes time (since the shared objects
must be built with -fPIC, while static objects are generally built
without, as -fPIC has some performance impact) and consumes a little
bit more disk space.
For example, a static+shared build of libglib2 takes 1 minutes and 59
seconds, with a final build directory of 96 MB. A shared-only build of
libglib2 takes only 1 minutes and 31 seconds (almost a 25% reduction
of the build time), and the final build directory weights 89 MB (a
reduction of almost 8%).
So, switching to a shared library only build brings some useful build
time and build size benefits.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
Config.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Config.in b/Config.in
index a647283..53142ce 100644
--- a/Config.in
+++ b/Config.in
@@ -528,7 +528,7 @@ comment "enabling Stack Smashing Protection requires support in the toolchain"
choice
bool "libraries"
- default BR2_SHARED_STATIC_LIBS if BR2_BINFMT_SUPPORTS_SHARED
+ default BR2_SHARED_LIBS if BR2_BINFMT_SUPPORTS_SHARED
default BR2_STATIC_LIBS if !BR2_BINFMT_SUPPORTS_SHARED
help
Select the type of libraries you want to use on the target.
--
2.1.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Buildroot] [PATCHv2 1/3] Turn the static lib option into a choice with more options
2014-12-11 22:50 ` [Buildroot] [PATCHv2 1/3] Turn the static lib option into a choice with more options Thomas Petazzoni
@ 2014-12-11 23:05 ` Yann E. MORIN
0 siblings, 0 replies; 7+ messages in thread
From: Yann E. MORIN @ 2014-12-11 23:05 UTC (permalink / raw)
To: buildroot
Thomas, All,
On 2014-12-11 23:50 +0100, Thomas Petazzoni spake thusly:
> This commit turns the single static option into a choice, which offers
> various possibilities:
>
> 1. Build and use static libraries only;
> 2. Build both shared and static libraries, but use shared libraries;
> 3. Build and use shared libraries only.
>
> On most platforms, (2) is currently the default, and kept as the
> default in this commit. Of course, on certain platforms (Blackfin,
> m68k), only option (1) will be available.
>
> In addition to the introduction of the Config.in options, this commit
> also:
>
> * Removes the 'select BR2_STATIC_LIBS' from 'BR2_BINFMT_FLAT', since
> with the use of a choice, we are guaranteed that BR2_STATIC_LIBS
> will be selected when the binary format is BR2_BINFMT_FLAT, since
> BR2_STATIC_LIBS will be the only possible solution in the choice.
>
> * Changes package/Makefile.in to use the proper
> --{enable,disable}-{shared,static} options for autotools packages.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
> Config.in | 45 ++++++++++++++++++++++++++++++++++++---------
> arch/Config.in | 1 -
> package/Makefile.in | 4 +++-
> 3 files changed, 39 insertions(+), 11 deletions(-)
>
> diff --git a/Config.in b/Config.in
> index cdc5f0f..a647283 100644
> --- a/Config.in
> +++ b/Config.in
> @@ -525,19 +525,46 @@ config BR2_ENABLE_SSP
> comment "enabling Stack Smashing Protection requires support in the toolchain"
> depends on !BR2_TOOLCHAIN_HAS_SSP
>
> +choice
> +
As discussed on IRC: supperfluous empty line
Otherwise:
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> + bool "libraries"
> + default BR2_SHARED_STATIC_LIBS if BR2_BINFMT_SUPPORTS_SHARED
> + default BR2_STATIC_LIBS if !BR2_BINFMT_SUPPORTS_SHARED
> + help
> + Select the type of libraries you want to use on the target.
> +
> + The default is to build dynamic libraries and use those on
> + the target filesystem, except when the architecture and/or
> + the selected binary format does not support shared
> + libraries.
> +
> config BR2_STATIC_LIBS
> - bool "build statically linked applications, no dynamic libraries"
> + bool "static only"
> help
> - Build all applications for the target statically linked.
> - This potentially increases your filesystem size and should only be
> - used if you know what you do.
> + Build and use only static libraries. No shared libraries
> + will be instaled on the target. This potentially increases
> + your code size and should only be used if you know what you
> + are doing. Note that some packages may not be available when
> + this option is enabled, due to their need for dynamic
> + library support.
>
> - Note that some applications cannot be build statically and so are
> - intentionally disabled.
> +config BR2_SHARED_LIBS
> + bool "shared only"
> + depends on BR2_BINFMT_SUPPORTS_SHARED
> + help
> + Build and use only shared libraries. This is the recommended
> + solution as it saves space and build time.
> +
> +config BR2_SHARED_STATIC_LIBS
> + bool "both static and shared"
> + depends on BR2_BINFMT_SUPPORTS_SHARED
> + help
> + Build both shared and static libraries, but link executables
> + dynamically. While building both shared and static libraries
> + take more time and more disk space, having static libraries
> + may be useful to link some of the applications statically.
>
> - The default (if this option is disabled) is to build dynamic
> - libraries and dynamically link applications to use those on the
> - target filesystem.
> +endchoice
>
>
> config BR2_PACKAGE_OVERRIDE_FILE
> diff --git a/arch/Config.in b/arch/Config.in
> index d06ab5e..890e7e2 100644
> --- a/arch/Config.in
> +++ b/arch/Config.in
> @@ -284,7 +284,6 @@ config BR2_BINFMT_FDPIC
> config BR2_BINFMT_FLAT
> bool "FLAT"
> depends on BR2_bfin || BR2_m68k
> - select BR2_STATIC_LIBS
> help
> FLAT binary is a relatively simple and lightweight executable format
> based on the original a.out format. It is widely used in environment
> diff --git a/package/Makefile.in b/package/Makefile.in
> index 50f86ad..a63a2e8 100644
> --- a/package/Makefile.in
> +++ b/package/Makefile.in
> @@ -394,7 +394,9 @@ SHARED_STATIC_LIBS_OPTS = --enable-static --disable-shared
> TARGET_CFLAGS += -static
> TARGET_CXXFLAGS += -static
> TARGET_LDFLAGS += -static
> -else
> +else ifeq ($(BR2_SHARED_LIBS),y)
> +SHARED_STATIC_LIBS_OPTS = --disable-static --enable-shared
> +else ifeq ($(BR2_SHARED_STATIC_LIBS),y)
> SHARED_STATIC_LIBS_OPTS = --enable-static --enable-shared
> endif
>
> --
> 2.1.0
>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [PATCHv2 2/3] ncurses: better handling for shared/static library
2014-12-11 22:50 ` [Buildroot] [PATCHv2 2/3] ncurses: better handling for shared/static library Thomas Petazzoni
@ 2014-12-11 23:06 ` Yann E. MORIN
0 siblings, 0 replies; 7+ messages in thread
From: Yann E. MORIN @ 2014-12-11 23:06 UTC (permalink / raw)
To: buildroot
Thomas, All,
On 2014-12-11 23:50 +0100, Thomas Petazzoni spake thusly:
> Now that we have clear options for the three cases of shared only,
> static only and shared+static, let's use them in ncurses to pass the
> appropriate --{with,without}-{shared,normal} options.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Regards,
Yann E. MORIN.
> ---
> package/ncurses/ncurses.mk | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/package/ncurses/ncurses.mk b/package/ncurses/ncurses.mk
> index 645c25c..f54f379 100644
> --- a/package/ncurses/ncurses.mk
> +++ b/package/ncurses/ncurses.mk
> @@ -15,7 +15,6 @@ NCURSES_LICENSE_FILES = README
> NCURSES_CONFIG_SCRIPTS = ncurses$(NCURSES_LIB_SUFFIX)5-config
>
> NCURSES_CONF_OPTS = \
> - $(if $(BR2_STATIC_LIBS),--without-shared,--with-shared) \
> --without-cxx \
> --without-cxx-binding \
> --without-ada \
> @@ -36,6 +35,14 @@ ifeq ($(BR2_PACKAGE_BUSYBOX),y)
> NCURSES_DEPENDENCIES += busybox
> endif
>
> +ifeq ($(BR2_STATIC_LIBS),y)
> +NCURSES_CONF_OPTS += --without-shared --with-normal
> +else ifeq ($(BR2_SHARED_LIBS),y)
> +NCURSES_CONF_OPTS += --with-shared --without-normal
> +else ifeq ($(BR2_SHARED_STATIC_LIBS),y)
> +NCURSES_CONF_OPTS += --with-shared --with-normal
> +endif
> +
> ifeq ($(BR2_PACKAGE_NCURSES_WCHAR),y)
> NCURSES_CONF_OPTS += --enable-widec
> NCURSES_LIB_SUFFIX = w
> --
> 2.1.0
>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [PATCHv2 0/3] Improved static/shared library handling
2014-12-11 22:50 [Buildroot] [PATCHv2 0/3] Improved static/shared library handling Thomas Petazzoni
` (2 preceding siblings ...)
2014-12-11 22:50 ` [Buildroot] [PATCHv2 3/3] Build shared libraries only as the default Thomas Petazzoni
@ 2014-12-11 23:13 ` Thomas Petazzoni
3 siblings, 0 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2014-12-11 23:13 UTC (permalink / raw)
To: buildroot
Hello,
On Thu, 11 Dec 2014 23:50:08 +0100, Thomas Petazzoni wrote:
> Thomas Petazzoni (3):
> Turn the static lib option into a choice with more options
> ncurses: better handling for shared/static library
> Build shared libraries only as the default
Series applied, with the minor comment on PATCH 1/3 from Yann addressed.
As you can imagine PATCH 3/3 might cause quite a bit of autobuilder
failures. Do not hesitate to monitor them and help fix them if needed.
Thanks!
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-12-11 23:13 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-11 22:50 [Buildroot] [PATCHv2 0/3] Improved static/shared library handling Thomas Petazzoni
2014-12-11 22:50 ` [Buildroot] [PATCHv2 1/3] Turn the static lib option into a choice with more options Thomas Petazzoni
2014-12-11 23:05 ` Yann E. MORIN
2014-12-11 22:50 ` [Buildroot] [PATCHv2 2/3] ncurses: better handling for shared/static library Thomas Petazzoni
2014-12-11 23:06 ` Yann E. MORIN
2014-12-11 22:50 ` [Buildroot] [PATCHv2 3/3] Build shared libraries only as the default Thomas Petazzoni
2014-12-11 23:13 ` [Buildroot] [PATCHv2 0/3] Improved static/shared library handling Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox