Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] Static build changes
@ 2011-12-20 16:11 ANDY KENNEDY
  2012-01-09  7:12 ` Arnout Vandecappelle
  2012-01-09  8:04 ` Thomas Petazzoni
  0 siblings, 2 replies; 8+ messages in thread
From: ANDY KENNEDY @ 2011-12-20 16:11 UTC (permalink / raw)
  To: buildroot

The affected files are:

Makefile
package/ethtool/ethtool.mk
package/htop/htop.mk
package/i2c-tools/i2c-tools.mk
package/kexec/kexec.mk
package/libgcrypt/libgcrypt.mk
package/libgpg-error/libgpg-error.mk
package/makedevs/makedevs.mk
package/mtd/mtd.mk
package/ncurses/ncurses.mk
package/portmap/portmap.mk
package/proftpd/proftpd.mk
toolchain/uClibc/uclibc.mk

In the system I am building, we want to use all static applications in
place of using eglibc for the target.  I prefer to use uClibC for
busybox, and the applications you see above.  To prevent from having
dynamically linked applications, without having installed libraries, I
have modified these to either not install the application (in the case
of uClibC installing ldconfig, libgcrypt installing iconv, etc), or
build the target binary static.  In the case of a couple of libraries,
the install was modified to prevent the libraries from being installed
to the target when all that is needed is for another application being
installed.

Signed-off-by: Andy Kennedy <Andy.Kennedy@Adtran.com>

---
diff -Naur a/Makefile b/Makefile
--- a/Makefile  2011-12-14 15:54:04.000000000 -0600
+++ b/Makefile  2011-12-20 09:39:59.000000000 -0600
@@ -236,7 +236,10 @@
 endif

 ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
-BASE_TARGETS += uclibc-configured host-binutils cross_compiler uclibc-target-utils kernel-headers
+BASE_TARGETS += uclibc-configured host-binutils cross_compiler kernel-headers
+ifneq ($(BR2_PREFER_STATIC_LIB),y)
+BASE_TARGETS += uclibc-target-utils
+endif
 else
 BASE_TARGETS += uclibc
 endif
diff -Naur a/package/ethtool/ethtool.mk b/package/ethtool/ethtool.mk
--- a/package/ethtool/ethtool.mk        2011-12-14 15:54:04.000000000 -0600
+++ b/package/ethtool/ethtool.mk        2011-12-20 09:41:40.000000000 -0600
@@ -7,4 +7,8 @@
 ETHTOOL_VERSION = 3.0
 ETHTOOL_SITE = $(BR2_KERNEL_MIRROR)/software/network/ethtool/

+ifeq ($(BR2_PREFER_STATIC_LIB),y)
+ETHTOOL_CONF_ENV += LDFLAGS+=-static
+endif
+
 $(eval $(call AUTOTARGETS))
diff -Naur a/package/htop/htop.mk b/package/htop/htop.mk
--- a/package/htop/htop.mk      2011-12-14 15:54:04.000000000 -0600
+++ b/package/htop/htop.mk      2011-12-20 09:44:06.000000000 -0600
@@ -11,4 +11,9 @@
 HTOP_AUTORECONF = YES
 HTOP_CONF_OPT += --disable-unicode

+ifeq ($(BR2_PREFER_STATIC_LIB),y)
+HTOP_CONF_ENV += LDFLAGS+="--static -lpthread"
+HTOP_CONF_OPT += "'--enable-static' --disable-shared"
+endif
+
 $(eval $(call AUTOTARGETS))
diff -Naur a/package/i2c-tools/i2c-tools.mk b/package/i2c-tools/i2c-tools.mk
--- a/package/i2c-tools/i2c-tools.mk    2011-12-14 15:54:04.000000000 -0600
+++ b/package/i2c-tools/i2c-tools.mk    2011-12-20 09:44:25.000000000 -0600
@@ -8,6 +8,10 @@
 I2C_TOOLS_SOURCE = i2c-tools-$(I2C_TOOLS_VERSION).tar.bz2
 I2C_TOOLS_SITE = http://dl.lm-sensors.org/i2c-tools/releases/

+ifeq ($(BR2_PREFER_STATIC_LIB),y)
+I2C_TOOLS_CONF_OPTS += LDFLAGS+=-static
+endif
+
 define I2C_TOOLS_BUILD_CMDS
  $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D)
 endef
diff -Naur a/package/kexec/kexec.mk b/package/kexec/kexec.mk
--- a/package/kexec/kexec.mk    2011-12-14 15:54:04.000000000 -0600
+++ b/package/kexec/kexec.mk    2011-12-20 09:45:47.000000000 -0600
@@ -14,6 +14,11 @@
 KEXEC_CONF_OPT += --without-zlib
 endif

+# This does not build kdump static (for some reason)
+ifeq ($(BR2_PREFER_STATIC_LIB),y)
+KEXEC_CONF_ENV += LDFLAGS+=-static CFLAGS+=-static
+endif
+
 define KEXEC_REMOVE_LIB_TOOLS
        rm -rf $(TARGET_DIR)/usr/lib/kexec-tools
 endef
diff -Naur a/package/libgcrypt/libgcrypt.mk b/package/libgcrypt/libgcrypt.mk
--- a/package/libgcrypt/libgcrypt.mk    2011-12-14 15:54:04.000000000 -0600
+++ b/package/libgcrypt/libgcrypt.mk    2011-12-20 09:46:12.000000000 -0600
@@ -9,6 +9,12 @@
 LIBGCRYPT_SITE = ftp://ftp.gnupg.org/gcrypt/libgcrypt
 LIBGCRYPT_INSTALL_STAGING = YES

+ifneq ($(BR2_PREFER_STATIC_LIB),y)
+LIBGCRYPT_INSTALL_TARGET = YES
+else
+LIBGCRYPT_INSTALL_TARGET = NO
+endif
+
 LIBGCRYPT_CONF_ENV = \
        ac_cv_sys_symbol_underscore=no
 LIBGCRYPT_CONF_OPT = \
diff -Naur a/package/libgpg-error/libgpg-error.mk b/package/libgpg-error/libgpg-error.mk
--- a/package/libgpg-error/libgpg-error.mk      2011-12-14 15:54:04.000000000 -0600
+++ b/package/libgpg-error/libgpg-error.mk      2011-12-20 09:46:32.000000000 -0600
@@ -7,5 +7,8 @@
 LIBGPG_ERROR_VERSION = 1.10
 LIBGPG_ERROR_SITE = ftp://ftp.gnupg.org/gcrypt/libgpg-error
 LIBGPG_ERROR_INSTALL_STAGING = YES
+ifeq ($(BR2_PREFER_STATIC_LIB),y)
+LIBGPG_ERROR_INSTALL_TARGET = NO
+endif

 $(eval $(call AUTOTARGETS))
diff -Naur a/package/makedevs/makedevs.mk b/package/makedevs/makedevs.mk
--- a/package/makedevs/makedevs.mk      2011-12-14 15:54:04.000000000 -0600
+++ b/package/makedevs/makedevs.mk      2011-12-20 09:46:57.000000000 -0600
@@ -8,6 +8,10 @@
 MAKEDEVS_SOURCE =
 HOST_MAKEDEVS_SOURCE =

+ifeq ($(BR2_PREFER_STATIC_LIB),y)
+MAKEDEVS_TARGET_LDFLAGS += LDFLAGS+=-static
+endif
+
 define MAKEDEVS_BUILD_CMDS
        $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) \
                package/makedevs/makedevs.c -o $(@D)/makedevs
diff -Naur a/package/mtd/mtd.mk b/package/mtd/mtd.mk
--- a/package/mtd/mtd.mk        2011-12-14 15:54:04.000000000 -0600
+++ b/package/mtd/mtd.mk        2011-12-20 09:49:28.000000000 -0600
@@ -64,6 +64,10 @@

 MTD_TARGETS_y += $(addprefix ubi-utils/,$(MTD_TARGETS_UBI_y))

+ifeq ($(BR2_PREFER_STATIC_LIB),y)
+MTD_MAKE_COMMON_FLAGS += LDFLAGS+=-static
+endif
+
 define MTD_BUILD_CMDS
        $(MAKE1) $(TARGET_CONFIGURE_OPTS) CROSS=$(TARGET_CROSS) \
                BUILDDIR=$(@D) WITHOUT_XATTR=1 WITHOUT_LARGEFILE=1 -C $(@D) \
diff -Naur a/package/ncurses/ncurses.mk b/package/ncurses/ncurses.mk
--- a/package/ncurses/ncurses.mk        2011-12-14 15:54:04.000000000 -0600
+++ b/package/ncurses/ncurses.mk        2011-12-20 09:51:11.000000000 -0600
@@ -29,7 +29,6 @@
 NCURSES_DEPENDENCIES = host-ncurses
 
 NCURSES_CONF_OPT = \
-       --with-shared \
        --without-cxx \
        --without-cxx-binding \
        --without-ada \
@@ -41,8 +40,17 @@
        --enable-echo \
        --enable-const \
        --enable-overwrite \
-       --enable-broken_linker \
+       --enable-broken_linker
+
+ifeq ($(BR2_PREFER_STATIC_LIB),y)
+NCURSES_CONF_OPT += \
+       --without-shared \
+       --enable-static
+else
+NCURSES_CONF_OPT += \
+       --with-shared \
        --disable-static
+endif

 ifneq ($(BR2_ENABLE_DEBUG),y)
 NCURSES_CONF_OPT += --without-debug
@@ -79,27 +87,33 @@
 endef
 endif

+ifneq ($(BR2_PREFER_STATIC_LIB),y)
 ifeq ($(BR2_PACKAGE_NCURSES_TARGET_PANEL),y)
 define NCURSES_INSTALL_TARGET_PANEL
        cp -dpf $(NCURSES_DIR)/lib/libpanel.so* $(TARGET_DIR)/usr/lib/
 endef
 endif
+endif

+ifneq ($(BR2_PREFER_STATIC_LIB),y)
 ifeq ($(BR2_PACKAGE_NCURSES_TARGET_FORM),y)
 define NCURSES_INSTALL_TARGET_FORM
        cp -dpf $(NCURSES_DIR)/lib/libform.so* $(TARGET_DIR)/usr/lib/
 endef
 endif
+endif

+ifneq ($(BR2_PREFER_STATIC_LIB),y)
 ifeq ($(BR2_PACKAGE_NCURSES_TARGET_MENU),y)
 define NCURSES_INSTALL_TARGET_MENU
        cp -dpf $(NCURSES_DIR)/lib/libmenu.so* $(TARGET_DIR)/usr/lib/
 endef
 endif
+endif

 define NCURSES_INSTALL_TARGET_CMDS
        mkdir -p $(TARGET_DIR)/usr/lib
-       cp -dpf $(NCURSES_DIR)/lib/libncurses.so* $(TARGET_DIR)/usr/lib/
+       -cp -dpf $(NCURSES_DIR)/lib/libncurses.so* $(TARGET_DIR)/usr/lib/
        $(NCURSES_INSTALL_TARGET_PANEL)
        $(NCURSES_INSTALL_TARGET_FORM)
        $(NCURSES_INSTALL_TARGET_MENU)
diff -Naur a/package/portmap/portmap.mk b/package/portmap/portmap.mk
--- a/package/portmap/portmap.mk        2011-12-14 15:54:04.000000000 -0600
+++ b/package/portmap/portmap.mk        2011-12-20 09:51:30.000000000 -0600
@@ -14,6 +14,10 @@
 PORTMAP_FLAGS += NO_FORK=1
 endif

+ifeq ($(BR2_PREFER_STATIC_LIB),y)
+PORTMAP_FLAGS += LDFLAGS+=-static
+endif
+
 define PORTMAP_BUILD_CMDS
        CFLAGS="$(TARGET_CFLAGS)" \
        $(MAKE) CC="$(TARGET_CC)" -C $(@D) $(PORTMAP_FLAGS)
diff -Naur a/package/proftpd/proftpd.mk b/package/proftpd/proftpd.mk
--- a/package/proftpd/proftpd.mk        2011-12-14 15:54:04.000000000 -0600
+++ b/package/proftpd/proftpd.mk        2011-12-20 09:52:25.000000000 -0600
@@ -12,7 +12,6 @@
                ac_cv_func_setgrent_void=yes

 PROFTPD_CONF_OPT = --localstatedir=/var/run \
-               --disable-static \
                --disable-curses \
                --disable-ncurses \
                --disable-facl \
@@ -20,6 +19,15 @@
                --enable-shadow \
                --with-gnu-ld

+ifeq ($(BR2_PREFER_STATIC_LIB),y)
+PROFTPD_CONF_ENV += LDFLAGS+=--static
+PROFTPD_CONF_OPT += --enable-static \
+                   --enable-builtin-getaddrinfo \
+                   --enable-builtin-getnameinfo
+else
+PROFTPD_CONF_OPT += --disable-static
+endif
+
 define PROFTPD_MAKENAMES
        $(MAKE1) CC="$(HOSTCC)" CFLAGS="" LDFLAGS="" -C $(@D)/lib/libcap _makenames
 endef
diff -Naur a/toolchain/uClibc/uclibc.mk b/toolchain/uClibc/uclibc.mk
--- a/toolchain/uClibc/uclibc.mk        2011-12-14 15:54:04.000000000 -0600
+++ b/toolchain/uClibc/uclibc.mk        2011-12-20 09:53:49.000000000 -0600
@@ -480,6 +480,7 @@
                install_runtime
        touch -c $@

+ifneq ($(BR2_PREFER_STATIC_LIB),y)
 $(TARGET_DIR)/usr/bin/ldd: $(cross_compiler)
        $(MAKE1) -C $(UCLIBC_DIR) CC=$(TARGET_CROSS)gcc \
                CPP=$(TARGET_CROSS)cpp LD=$(TARGET_CROSS)ld \
@@ -487,7 +488,6 @@
                PREFIX=$(TARGET_DIR) utils install_utils
        touch -c $@

-ifneq ($(BR2_PREFER_STATIC_LIB),y)
 UCLIBC_TARGETS=$(TARGET_DIR)/lib/libc.so.0
 endif

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

* [Buildroot] [PATCH] Static build changes
  2011-12-20 16:11 [Buildroot] [PATCH] Static build changes ANDY KENNEDY
@ 2012-01-09  7:12 ` Arnout Vandecappelle
  2012-01-09 20:45   ` ANDY KENNEDY
  2012-01-09  8:04 ` Thomas Petazzoni
  1 sibling, 1 reply; 8+ messages in thread
From: Arnout Vandecappelle @ 2012-01-09  7:12 UTC (permalink / raw)
  To: buildroot

On Tuesday 20 December 2011 17:11:54 ANDY KENNEDY wrote:
> The affected files are:
> 
> Makefile
> package/ethtool/ethtool.mk
> package/htop/htop.mk
> package/i2c-tools/i2c-tools.mk
> package/kexec/kexec.mk
> package/libgcrypt/libgcrypt.mk
> package/libgpg-error/libgpg-error.mk
> package/makedevs/makedevs.mk
> package/mtd/mtd.mk
> package/ncurses/ncurses.mk
> package/portmap/portmap.mk
> package/proftpd/proftpd.mk
> toolchain/uClibc/uclibc.mk

 This part of the log message is redundant.  It shows up in the git shortlog.
However, it is useful to include a remark that this doesn't fix the issue
for all packages.

> In the system I am building, we want to use all static applications in
> place of using eglibc for the target.  I prefer to use uClibC for
> busybox, and the applications you see above.  To prevent from having
> dynamically linked applications, without having installed libraries, I
> have modified these to either not install the application (in the case
> of uClibC installing ldconfig, libgcrypt installing iconv, etc), or
> build the target binary static.  In the case of a couple of libraries,
> the install was modified to prevent the libraries from being installed
> to the target when all that is needed is for another application being
> installed.
> 
> Signed-off-by: Andy Kennedy <Andy.Kennedy@Adtran.com>

Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

> 
> ---
> diff -Naur a/Makefile b/Makefile
> --- a/Makefile  2011-12-14 15:54:04.000000000 -0600
> +++ b/Makefile  2011-12-20 09:39:59.000000000 -0600
> @@ -236,7 +236,10 @@
>  endif
> 
>  ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
> -BASE_TARGETS += uclibc-configured host-binutils cross_compiler uclibc-target-utils kernel-headers
> +BASE_TARGETS += uclibc-configured host-binutils cross_compiler kernel-headers
> +ifneq ($(BR2_PREFER_STATIC_LIB),y)
> +BASE_TARGETS += uclibc-target-utils
> +endif
>  else
>  BASE_TARGETS += uclibc
>  endif
> diff -Naur a/package/ethtool/ethtool.mk b/package/ethtool/ethtool.mk
> --- a/package/ethtool/ethtool.mk        2011-12-14 15:54:04.000000000 -0600
> +++ b/package/ethtool/ethtool.mk        2011-12-20 09:41:40.000000000 -0600
> @@ -7,4 +7,8 @@
>  ETHTOOL_VERSION = 3.0
>  ETHTOOL_SITE = $(BR2_KERNEL_MIRROR)/software/network/ethtool/
> 
> +ifeq ($(BR2_PREFER_STATIC_LIB),y)
> +ETHTOOL_CONF_ENV += LDFLAGS+=-static
> +endif

 Wouldn't it be more convenient if this was added globally to 
TARGET_LDFLAGS in Makefile.in?  The -static is anyway just a hint,
it doesn't force the linker to link statically.

> +
>  $(eval $(call AUTOTARGETS))
> diff -Naur a/package/htop/htop.mk b/package/htop/htop.mk
> --- a/package/htop/htop.mk      2011-12-14 15:54:04.000000000 -0600
> +++ b/package/htop/htop.mk      2011-12-20 09:44:06.000000000 -0600
> @@ -11,4 +11,9 @@
>  HTOP_AUTORECONF = YES
>  HTOP_CONF_OPT += --disable-unicode
> 
> +ifeq ($(BR2_PREFER_STATIC_LIB),y)
> +HTOP_CONF_ENV += LDFLAGS+="--static -lpthread"
> +HTOP_CONF_OPT += "'--enable-static' --disable-shared"
 Is this needed?  The $(PKG)_CONFIGURE_CMDS of Makefile.autotools.in
already includes $(SHARED_STATIC_LIBS_OPTS).

> +endif
> +
>  $(eval $(call AUTOTARGETS))
> diff -Naur a/package/i2c-tools/i2c-tools.mk b/package/i2c-tools/i2c-tools.mk
> --- a/package/i2c-tools/i2c-tools.mk    2011-12-14 15:54:04.000000000 -0600
> +++ b/package/i2c-tools/i2c-tools.mk    2011-12-20 09:44:25.000000000 -0600
> @@ -8,6 +8,10 @@
>  I2C_TOOLS_SOURCE = i2c-tools-$(I2C_TOOLS_VERSION).tar.bz2
>  I2C_TOOLS_SITE = http://dl.lm-sensors.org/i2c-tools/releases/
> 
> +ifeq ($(BR2_PREFER_STATIC_LIB),y)
> +I2C_TOOLS_CONF_OPTS += LDFLAGS+=-static
> +endif
> +
>  define I2C_TOOLS_BUILD_CMDS
>   $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D)
>  endef
> diff -Naur a/package/kexec/kexec.mk b/package/kexec/kexec.mk
> --- a/package/kexec/kexec.mk    2011-12-14 15:54:04.000000000 -0600
> +++ b/package/kexec/kexec.mk    2011-12-20 09:45:47.000000000 -0600
> @@ -14,6 +14,11 @@
>  KEXEC_CONF_OPT += --without-zlib
>  endif
> 
> +# This does not build kdump static (for some reason)
> +ifeq ($(BR2_PREFER_STATIC_LIB),y)
> +KEXEC_CONF_ENV += LDFLAGS+=-static CFLAGS+=-static
 I haven't tested, but as far as I can see in the Makefiles, the only
place where LDFLAGS is not used for linking is for kdump...  So if it
anyway doesn't work, you can just as well leave out the -static from the
CFLAGS.

> +endif
> +
>  define KEXEC_REMOVE_LIB_TOOLS
>         rm -rf $(TARGET_DIR)/usr/lib/kexec-tools
>  endef
> diff -Naur a/package/libgcrypt/libgcrypt.mk b/package/libgcrypt/libgcrypt.mk
> --- a/package/libgcrypt/libgcrypt.mk    2011-12-14 15:54:04.000000000 -0600
> +++ b/package/libgcrypt/libgcrypt.mk    2011-12-20 09:46:12.000000000 -0600
> @@ -9,6 +9,12 @@
>  LIBGCRYPT_SITE = ftp://ftp.gnupg.org/gcrypt/libgcrypt
>  LIBGCRYPT_INSTALL_STAGING = YES
> 
> +ifneq ($(BR2_PREFER_STATIC_LIB),y)
> +LIBGCRYPT_INSTALL_TARGET = YES
> +else
> +LIBGCRYPT_INSTALL_TARGET = NO
> +endif

 There should also be a global solution for this.  When you prefer static
libs, then none of the libraries should be installed.  Something like
FOO_INSTALL_LIBRARIES = YES
that sets INSTALL_STAGING and INSTALL_TARGET, perhaps?  (Note that this is
not required for acceptance of this specific patch, just a general remark.)

> +
>  LIBGCRYPT_CONF_ENV = \
>         ac_cv_sys_symbol_underscore=no
>  LIBGCRYPT_CONF_OPT = \
[snip]
> diff -Naur a/package/ncurses/ncurses.mk b/package/ncurses/ncurses.mk
> --- a/package/ncurses/ncurses.mk        2011-12-14 15:54:04.000000000 -0600
> +++ b/package/ncurses/ncurses.mk        2011-12-20 09:51:11.000000000 -0600
> @@ -29,7 +29,6 @@
>  NCURSES_DEPENDENCIES = host-ncurses
>  
>  NCURSES_CONF_OPT = \
> -       --with-shared \
>         --without-cxx \
>         --without-cxx-binding \
>         --without-ada \
> @@ -41,8 +40,17 @@
>         --enable-echo \
>         --enable-const \
>         --enable-overwrite \
> -       --enable-broken_linker \
> +       --enable-broken_linker
> +
> +ifeq ($(BR2_PREFER_STATIC_LIB),y)
> +NCURSES_CONF_OPT += \
> +       --without-shared \
> +       --enable-static
> +else
> +NCURSES_CONF_OPT += \
> +       --with-shared \
>         --disable-static
> +endif

 This is already done by $(PKG)_CONFIGURE_CMDS, so just removing the
--with-shared and --enable-static should be sufficient.

[snip]
> diff -Naur a/package/proftpd/proftpd.mk b/package/proftpd/proftpd.mk
> --- a/package/proftpd/proftpd.mk        2011-12-14 15:54:04.000000000 -0600
> +++ b/package/proftpd/proftpd.mk        2011-12-20 09:52:25.000000000 -0600
> @@ -12,7 +12,6 @@
>                 ac_cv_func_setgrent_void=yes
> 
>  PROFTPD_CONF_OPT = --localstatedir=/var/run \
> -               --disable-static \
>                 --disable-curses \
>                 --disable-ncurses \
>                 --disable-facl \
> @@ -20,6 +19,15 @@
>                 --enable-shadow \
>                 --with-gnu-ld
> 
> +ifeq ($(BR2_PREFER_STATIC_LIB),y)
> +PROFTPD_CONF_ENV += LDFLAGS+=--static
> +PROFTPD_CONF_OPT += --enable-static \
> +                   --enable-builtin-getaddrinfo \
> +                   --enable-builtin-getnameinfo
> +else
> +PROFTPD_CONF_OPT += --disable-static
> +endif

 Same here.

> +
>  define PROFTPD_MAKENAMES
>         $(MAKE1) CC="$(HOSTCC)" CFLAGS="" LDFLAGS="" -C $(@D)/lib/libcap _makenames
>  endef
> diff -Naur a/toolchain/uClibc/uclibc.mk b/toolchain/uClibc/uclibc.mk
> --- a/toolchain/uClibc/uclibc.mk        2011-12-14 15:54:04.000000000 -0600
> +++ b/toolchain/uClibc/uclibc.mk        2011-12-20 09:53:49.000000000 -0600
> @@ -480,6 +480,7 @@
>                 install_runtime
>         touch -c $@
> 
> +ifneq ($(BR2_PREFER_STATIC_LIB),y)
>  $(TARGET_DIR)/usr/bin/ldd: $(cross_compiler)
>         $(MAKE1) -C $(UCLIBC_DIR) CC=$(TARGET_CROSS)gcc \
>                 CPP=$(TARGET_CROSS)cpp LD=$(TARGET_CROSS)ld \
> @@ -487,7 +488,6 @@
>                 PREFIX=$(TARGET_DIR) utils install_utils
>         touch -c $@
> 
> -ifneq ($(BR2_PREFER_STATIC_LIB),y)
>  UCLIBC_TARGETS=$(TARGET_DIR)/lib/libc.so.0
>  endif

 I'm not sure if I agree with this change.  Prefer static does not mean 
force static, so the dynamic linker stuff should still be present.


 Regards,
 Arnout


-- 
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

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

* [Buildroot] [PATCH] Static build changes
  2011-12-20 16:11 [Buildroot] [PATCH] Static build changes ANDY KENNEDY
  2012-01-09  7:12 ` Arnout Vandecappelle
@ 2012-01-09  8:04 ` Thomas Petazzoni
  2012-01-09 17:17   ` Michael S. Zick
  1 sibling, 1 reply; 8+ messages in thread
From: Thomas Petazzoni @ 2012-01-09  8:04 UTC (permalink / raw)
  To: buildroot

Hello,

Le Tue, 20 Dec 2011 16:11:54 +0000,
ANDY KENNEDY <ANDY.KENNEDY@adtran.com> a ?crit :

> In the system I am building, we want to use all static applications in
> place of using eglibc for the target.  I prefer to use uClibC for
> busybox, and the applications you see above.  To prevent from having
> dynamically linked applications, without having installed libraries, I
> have modified these to either not install the application (in the case
> of uClibC installing ldconfig, libgcrypt installing iconv, etc), or
> build the target binary static.  In the case of a couple of libraries,
> the install was modified to prevent the libraries from being installed
> to the target when all that is needed is for another application being
> installed.

Many of the modifications to the various packages look very similar.
Isn't it possible to factorize those needed flags and options at the
package infrastructure level somehow?

The modifications that I see are:

 * Adding -static to the LDFLAGS

 * Adding --enable-static --disable-shared in the configuration options
   for autotools packages, which I think is useless because it's
   already done at the end of package/Makefile.in

 * Using _INSTALL_TARGET=NO for libraries. This shouldn't be needed: if
   the shared variant is not built, the static variant will be
   installed on the target, then removed by target-finalize

For sure, there will probably be things that remain at the individual
package level, but I'd like to see some reflection on what needs to be
factorized at the package infrastructure level, especially for
autotools packages that have a relatively well standardized behaviour.

Regards,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

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

* [Buildroot] [PATCH] Static build changes
  2012-01-09  8:04 ` Thomas Petazzoni
@ 2012-01-09 17:17   ` Michael S. Zick
  0 siblings, 0 replies; 8+ messages in thread
From: Michael S. Zick @ 2012-01-09 17:17 UTC (permalink / raw)
  To: buildroot

On Mon January 9 2012, Thomas Petazzoni wrote:
> Hello,
> 
> Le Tue, 20 Dec 2011 16:11:54 +0000,
> ANDY KENNEDY <ANDY.KENNEDY@adtran.com> a ?crit :
> 
> > In the system I am building, we want to use all static applications in
> > place of using eglibc for the target.  I prefer to use uClibC for
> > busybox, and the applications you see above.  To prevent from having
> > dynamically linked applications, without having installed libraries, I
> > have modified these to either not install the application (in the case
> > of uClibC installing ldconfig, libgcrypt installing iconv, etc), or
> > build the target binary static.  In the case of a couple of libraries,
> > the install was modified to prevent the libraries from being installed
> > to the target when all that is needed is for another application being
> > installed.
> 
> Many of the modifications to the various packages look very similar.
> Isn't it possible to factorize those needed flags and options at the
> package infrastructure level somehow?
> 
> The modifications that I see are:
> 
>  * Adding -static to the LDFLAGS
> 
>  * Adding --enable-static --disable-shared in the configuration options
>    for autotools packages, which I think is useless because it's
>    already done at the end of package/Makefile.in
> 
>  * Using _INSTALL_TARGET=NO for libraries. This shouldn't be needed: if
>    the shared variant is not built, the static variant will be
>    installed on the target, then removed by target-finalize
> 
> For sure, there will probably be things that remain at the individual
> package level, but I'd like to see some reflection on what needs to be
> factorized at the package infrastructure level, especially for
> autotools packages that have a relatively well standardized behaviour.
>

Probably need to include provisions for -static-libgcc and -static-libstdc++ 
also to control the selection of how the compiler generated stuff is loaded.
http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html

Mike
> Regards,
> 
> Thomas

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

* [Buildroot] [PATCH] Static build changes
  2012-01-09  7:12 ` Arnout Vandecappelle
@ 2012-01-09 20:45   ` ANDY KENNEDY
  2012-01-11  7:01     ` Arnout Vandecappelle
  0 siblings, 1 reply; 8+ messages in thread
From: ANDY KENNEDY @ 2012-01-09 20:45 UTC (permalink / raw)
  To: buildroot

> > Makefile
> > package/ethtool/ethtool.mk
> > package/htop/htop.mk
> > package/i2c-tools/i2c-tools.mk
> > package/kexec/kexec.mk
> > package/libgcrypt/libgcrypt.mk
> > package/libgpg-error/libgpg-error.mk
> > package/makedevs/makedevs.mk
> > package/mtd/mtd.mk
> > package/ncurses/ncurses.mk
> > package/portmap/portmap.mk
> > package/proftpd/proftpd.mk
> > toolchain/uClibc/uclibc.mk
> 
>  This part of the log message is redundant.  It shows up in the git
> shortlog.
> However, it is useful to include a remark that this doesn't fix the
> issue
> for all packages.

I do not have the time to figure out how to (nor am I sure that on this
network I can) use git to do the patches.  Were I able to get git going,
the first e-mail would have been that really nice blurb about the files
affected.  This was my intent by the above.

> > @@ -7,4 +7,8 @@
> >  ETHTOOL_VERSION = 3.0
> >  ETHTOOL_SITE = $(BR2_KERNEL_MIRROR)/software/network/ethtool/
> >
> > +ifeq ($(BR2_PREFER_STATIC_LIB),y)
> > +ETHTOOL_CONF_ENV += LDFLAGS+=-static
> > +endif
> 
>  Wouldn't it be more convenient if this was added globally to
> TARGET_LDFLAGS in Makefile.in?  The -static is anyway just a hint,
> it doesn't force the linker to link statically.

To quote Bill Cosby:  "I hadn't thought of that."

> 
> > +
> >  $(eval $(call AUTOTARGETS))
> > diff -Naur a/package/htop/htop.mk b/package/htop/htop.mk
> > --- a/package/htop/htop.mk      2011-12-14 15:54:04.000000000 -
> 0600
> > +++ b/package/htop/htop.mk      2011-12-20 09:44:06.000000000 -
> 0600
> > @@ -11,4 +11,9 @@
> >  HTOP_AUTORECONF = YES
> >  HTOP_CONF_OPT += --disable-unicode
> >
> > +ifeq ($(BR2_PREFER_STATIC_LIB),y)
> > +HTOP_CONF_ENV += LDFLAGS+="--static -lpthread"
> > +HTOP_CONF_OPT += "'--enable-static' --disable-shared"
>  Is this needed?  The $(PKG)_CONFIGURE_CMDS of
> Makefile.autotools.in
> already includes $(SHARED_STATIC_LIBS_OPTS).

Okay, I'm cool with that too.  Looking at the various configure scripts,
I seem to recall an issue with giving a parameter that wasn't available
in the configure script.  Like it errored out.  I cannot recall, though.
I did this patch up over a month ago and sent it out before xmas. (I've
slept since then.)  The bottom line, there appears to be a lack of a
standard for dealing with the configure options (or at least not all
packages use the standard).

> >
> > +# This does not build kdump static (for some reason)
> > +ifeq ($(BR2_PREFER_STATIC_LIB),y)
> > +KEXEC_CONF_ENV += LDFLAGS+=-static CFLAGS+=-static
>  I haven't tested, but as far as I can see in the Makefiles, the
> only
> place where LDFLAGS is not used for linking is for kdump...  So if
> it
> anyway doesn't work, you can just as well leave out the -static
> from the
> CFLAGS.

Bummer, that got left in there, eh.

> 
> > +endif
> > +
> >  define KEXEC_REMOVE_LIB_TOOLS
> >         rm -rf $(TARGET_DIR)/usr/lib/kexec-tools
> >  endef
> > diff -Naur a/package/libgcrypt/libgcrypt.mk
> b/package/libgcrypt/libgcrypt.mk
> > --- a/package/libgcrypt/libgcrypt.mk    2011-12-14
> 15:54:04.000000000 -0600
> > +++ b/package/libgcrypt/libgcrypt.mk    2011-12-20
> 09:46:12.000000000 -0600
> > @@ -9,6 +9,12 @@
> >  LIBGCRYPT_SITE = ftp://ftp.gnupg.org/gcrypt/libgcrypt
> >  LIBGCRYPT_INSTALL_STAGING = YES
> >
> > +ifneq ($(BR2_PREFER_STATIC_LIB),y)
> > +LIBGCRYPT_INSTALL_TARGET = YES
> > +else
> > +LIBGCRYPT_INSTALL_TARGET = NO
> > +endif
> 
>  There should also be a global solution for this.  When you prefer
> static
> libs, then none of the libraries should be installed.  Something
> like
> FOO_INSTALL_LIBRARIES = YES
> that sets INSTALL_STAGING and INSTALL_TARGET, perhaps?  (Note that
> this is
> not required for acceptance of this specific patch, just a general
> remark.)

A global approach would be better for this solution.  I've requested
such numerous times in the past.  I was told that if I wanted something
like this, then I needed to do it.  Whether I was the most knowledgeable
person to complete this task is a completely different discussion.  I
worked with what I know.

> > +ifeq ($(BR2_PREFER_STATIC_LIB),y)
> > +NCURSES_CONF_OPT += \
> > +       --without-shared \
> > +       --enable-static
> > +else
> > +NCURSES_CONF_OPT += \
> > +       --with-shared \
> >         --disable-static
> > +endif
> 
>  This is already done by $(PKG)_CONFIGURE_CMDS, so just removing
> the

These files already have this verbiage in each.  To that end, I only
encapsulated what was there.  Sounds like each package needs some
clean-up.

> > +
> >  define PROFTPD_MAKENAMES
> >         $(MAKE1) CC="$(HOSTCC)" CFLAGS="" LDFLAGS="" -C
> $(@D)/lib/libcap _makenames
> >  endef
> > diff -Naur a/toolchain/uClibc/uclibc.mk
> b/toolchain/uClibc/uclibc.mk
> > --- a/toolchain/uClibc/uclibc.mk        2011-12-14
> 15:54:04.000000000 -0600
> > +++ b/toolchain/uClibc/uclibc.mk        2011-12-20
> 09:53:49.000000000 -0600
> > @@ -480,6 +480,7 @@
> >                 install_runtime
> >         touch -c $@
> >
> > +ifneq ($(BR2_PREFER_STATIC_LIB),y)
> >  $(TARGET_DIR)/usr/bin/ldd: $(cross_compiler)
> >         $(MAKE1) -C $(UCLIBC_DIR) CC=$(TARGET_CROSS)gcc \
> >                 CPP=$(TARGET_CROSS)cpp LD=$(TARGET_CROSS)ld \
> > @@ -487,7 +488,6 @@
> >                 PREFIX=$(TARGET_DIR) utils install_utils
> >         touch -c $@
> >
> > -ifneq ($(BR2_PREFER_STATIC_LIB),y)
> >  UCLIBC_TARGETS=$(TARGET_DIR)/lib/libc.so.0
> >  endif
> 
>  I'm not sure if I agree with this change.  Prefer static does not
> mean
> force static, so the dynamic linker stuff should still be present.

So, the original design I had done was to add top-level config option
under PREFER_STATIC as BUILD_ONLY_STATIC.  I guessed that this would not
be well received by the hive.  Perhaps that would have been a better
thing to do.  PREFER_STATIC seems to be misleading (based upon my
expectations) given that if you _PREFER_ to use static libraries, then
shouldn't the system ONLY USE static libraries and never install the
shared objects?  I mean, if I ask my contractor to use screws to build
something, and he uses nails, that isn't what I asked for.  But again,
perhaps I have the wrong expectations for PREFER_STATIC.

$0.02 (USD).

Andy

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

* [Buildroot] [PATCH] Static build changes
  2012-01-09 20:45   ` ANDY KENNEDY
@ 2012-01-11  7:01     ` Arnout Vandecappelle
  2012-01-11 16:23       ` ANDY KENNEDY
  0 siblings, 1 reply; 8+ messages in thread
From: Arnout Vandecappelle @ 2012-01-11  7:01 UTC (permalink / raw)
  To: buildroot

On Monday 09 January 2012 21:45:16 ANDY KENNEDY wrote:
> > > Makefile
> > > package/ethtool/ethtool.mk
> > > package/htop/htop.mk
> > > package/i2c-tools/i2c-tools.mk
> > > package/kexec/kexec.mk
> > > package/libgcrypt/libgcrypt.mk
> > > package/libgpg-error/libgpg-error.mk
> > > package/makedevs/makedevs.mk
> > > package/mtd/mtd.mk
> > > package/ncurses/ncurses.mk
> > > package/portmap/portmap.mk
> > > package/proftpd/proftpd.mk
> > > toolchain/uClibc/uclibc.mk
> > 
> >  This part of the log message is redundant.  It shows up in the git
> > shortlog.
> > However, it is useful to include a remark that this doesn't fix the
> > issue
> > for all packages.
> 
> I do not have the time to figure out how to (nor am I sure that on this
> network I can) use git to do the patches.  Were I able to get git going,
> the first e-mail would have been that really nice blurb about the files
> affected.  This was my intent by the above.

 The thing is, everything that you put in the e-mail will end up in the
git commit as well.  To add comments in the mail that should not be in
the commit message, add something like
---
additional comment
---
between the commit message (first part) and the first diff.

> > > @@ -7,4 +7,8 @@
> > >  ETHTOOL_VERSION = 3.0
> > >  ETHTOOL_SITE = $(BR2_KERNEL_MIRROR)/software/network/ethtool/
> > >
> > > +ifeq ($(BR2_PREFER_STATIC_LIB),y)
> > > +ETHTOOL_CONF_ENV += LDFLAGS+=-static
> > > +endif
> > 
> >  Wouldn't it be more convenient if this was added globally to
> > TARGET_LDFLAGS in Makefile.in?  The -static is anyway just a hint,
> > it doesn't force the linker to link statically.
> 
> To quote Bill Cosby:  "I hadn't thought of that."

 That's why we have reviews :-)

> > > +
> > >  $(eval $(call AUTOTARGETS))
> > > diff -Naur a/package/htop/htop.mk b/package/htop/htop.mk
> > > --- a/package/htop/htop.mk      2011-12-14 15:54:04.000000000 -
> > 0600
> > > +++ b/package/htop/htop.mk      2011-12-20 09:44:06.000000000 -
> > 0600
> > > @@ -11,4 +11,9 @@
> > >  HTOP_AUTORECONF = YES
> > >  HTOP_CONF_OPT += --disable-unicode
> > >
> > > +ifeq ($(BR2_PREFER_STATIC_LIB),y)
> > > +HTOP_CONF_ENV += LDFLAGS+="--static -lpthread"
> > > +HTOP_CONF_OPT += "'--enable-static' --disable-shared"
> >  Is this needed?  The $(PKG)_CONFIGURE_CMDS of
> > Makefile.autotools.in
> > already includes $(SHARED_STATIC_LIBS_OPTS).
> 
> Okay, I'm cool with that too.  Looking at the various configure scripts,
> I seem to recall an issue with giving a parameter that wasn't available
> in the configure script.  Like it errored out.  I cannot recall, though.
> I did this patch up over a month ago and sent it out before xmas. (I've
> slept since then.)  The bottom line, there appears to be a lack of a
> standard for dealing with the configure options (or at least not all
> packages use the standard).

 GNU autoconf will give a warning about unsupported options.  One of the
global options is actually unsupported for most platforms:
--disable-gtk-doc.

 If some package has a custom configure script that errors out, it
should override $(PKG)_CONFIGURE_CMDS.

[snip]
> > > diff -Naur a/toolchain/uClibc/uclibc.mk
> > b/toolchain/uClibc/uclibc.mk
> > > --- a/toolchain/uClibc/uclibc.mk        2011-12-14
> > 15:54:04.000000000 -0600
> > > +++ b/toolchain/uClibc/uclibc.mk        2011-12-20
> > 09:53:49.000000000 -0600
> > > @@ -480,6 +480,7 @@
> > >                 install_runtime
> > >         touch -c $@
> > >
> > > +ifneq ($(BR2_PREFER_STATIC_LIB),y)
> > >  $(TARGET_DIR)/usr/bin/ldd: $(cross_compiler)
> > >         $(MAKE1) -C $(UCLIBC_DIR) CC=$(TARGET_CROSS)gcc \
> > >                 CPP=$(TARGET_CROSS)cpp LD=$(TARGET_CROSS)ld \
> > > @@ -487,7 +488,6 @@
> > >                 PREFIX=$(TARGET_DIR) utils install_utils
> > >         touch -c $@
> > >
> > > -ifneq ($(BR2_PREFER_STATIC_LIB),y)
> > >  UCLIBC_TARGETS=$(TARGET_DIR)/lib/libc.so.0
> > >  endif
> > 
> >  I'm not sure if I agree with this change.  Prefer static does not
> > mean
> > force static, so the dynamic linker stuff should still be present.
> 
> So, the original design I had done was to add top-level config option
> under PREFER_STATIC as BUILD_ONLY_STATIC.  I guessed that this would not
> be well received by the hive.  Perhaps that would have been a better
> thing to do.  PREFER_STATIC seems to be misleading (based upon my
> expectations) given that if you _PREFER_ to use static libraries, then
> shouldn't the system ONLY USE static libraries and never install the
> shared objects?  I mean, if I ask my contractor to use screws to build
> something, and he uses nails, that isn't what I asked for.  But again,
> perhaps I have the wrong expectations for PREFER_STATIC.

 I guess this is because some packages don't know how to build static
libraries, or how to link with them.  Such packages would have to depend
on !BUILD_ONLY_STATIC.  But I think that it is a lot of work to maintain
that option, with little benefit.


 Regards,
 Arnout
-- 
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

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

* [Buildroot] [PATCH] Static build changes
  2012-01-11  7:01     ` Arnout Vandecappelle
@ 2012-01-11 16:23       ` ANDY KENNEDY
  2012-01-12 11:08         ` Arnout Vandecappelle
  0 siblings, 1 reply; 8+ messages in thread
From: ANDY KENNEDY @ 2012-01-11 16:23 UTC (permalink / raw)
  To: buildroot

>  The thing is, everything that you put in the e-mail will end up in
> the
> git commit as well.  To add comments in the mail that should not be
> in
> the commit message, add something like
> ---
> additional comment
> ---
> between the commit message (first part) and the first diff.

I'll try to keep this in mind.

> 
> > > > @@ -7,4 +7,8 @@
> > > >  ETHTOOL_VERSION = 3.0
> > > >  ETHTOOL_SITE =
> $(BR2_KERNEL_MIRROR)/software/network/ethtool/
> > > >
> > > > +ifeq ($(BR2_PREFER_STATIC_LIB),y)
> > > > +ETHTOOL_CONF_ENV += LDFLAGS+=-static
> > > > +endif
> > >
> > >  Wouldn't it be more convenient if this was added globally to
> > > TARGET_LDFLAGS in Makefile.in?  The -static is anyway just a
> hint,
> > > it doesn't force the linker to link statically.
> >
> > To quote Bill Cosby:  "I hadn't thought of that."
> 
>  That's why we have reviews :-)

Right on.  That's the same thing that Peter said in an
e-mail that came out after I started working on this reply.

So, to that end, I guess I should scrap this patch, then
attempt a new on for this later.  The problem is, I don't
have time to revisit this right now (big push for a Q1/Q2
release).  If I get a "round toit", perhaps I'll be able to
attempt such a patch later next month.

>  GNU autoconf will give a warning about unsupported options.  One
> of the
> global options is actually unsupported for most platforms:
> --disable-gtk-doc.
> 
>  If some package has a custom configure script that errors out, it
> should override $(PKG)_CONFIGURE_CMDS.

Okay, so, I've exposed an error in the ncurses.mk file.
For me to make ncurses "work" the way I want it to, I have
to patch the file in this manner.  Do I have to correct
_all_ errors with any given Makefile when patching towards a
specific goal in order to satisfy the hive?  If that is the
case, I then have the question of Who decides what is
correct and what is broken for any given patch that I may need
to create?

> > So, the original design I had done was to add top-level config
> option
> > under PREFER_STATIC as BUILD_ONLY_STATIC.  I guessed that this
> would not
> > be well received by the hive.  Perhaps that would have been a
> better
> > thing to do.  PREFER_STATIC seems to be misleading (based upon my
> > expectations) given that if you _PREFER_ to use static libraries,
> then
> > shouldn't the system ONLY USE static libraries and never install
> the
> > shared objects?  I mean, if I ask my contractor to use screws to
> build
> > something, and he uses nails, that isn't what I asked for.  But
> again,
> > perhaps I have the wrong expectations for PREFER_STATIC.
> 
>  I guess this is because some packages don't know how to build
> static
> libraries, or how to link with them.  Such packages would have to
> depend
> on !BUILD_ONLY_STATIC.  But I think that it is a lot of work to
> maintain
> that option, with little benefit.

Eh, I had about 30 lines of text to discuss, "little benefit", but
deleted those.  Got wrapped around the axel on that one.  It isn't
little to me, be essential.  I'll look (later, probably two months)
at putting this back in and putting the params in the top level
make files.  We'll discuss again then.  For now, I'll continue to
use my patch.  I concede and withdraw the patch.

Andy

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

* [Buildroot] [PATCH] Static build changes
  2012-01-11 16:23       ` ANDY KENNEDY
@ 2012-01-12 11:08         ` Arnout Vandecappelle
  0 siblings, 0 replies; 8+ messages in thread
From: Arnout Vandecappelle @ 2012-01-12 11:08 UTC (permalink / raw)
  To: buildroot

On Wednesday 11 January 2012 17:23:16 ANDY KENNEDY wrote:
> So, to that end, I guess I should scrap this patch, then
> attempt a new on for this later.  The problem is, I don't
> have time to revisit this right now (big push for a Q1/Q2
> release).  If I get a "round toit", perhaps I'll be able to
> attempt such a patch later next month.

 Let this be an invitation for other volunteers to pick up the patch!

> >  GNU autoconf will give a warning about unsupported options.  One
> > of the
> > global options is actually unsupported for most platforms:
> > --disable-gtk-doc.
> > 
> >  If some package has a custom configure script that errors out, it
> > should override $(PKG)_CONFIGURE_CMDS.
> 
> Okay, so, I've exposed an error in the ncurses.mk file.
> For me to make ncurses "work" the way I want it to, I have
> to patch the file in this manner.  Do I have to correct
> _all_ errors with any given Makefile when patching towards a
> specific goal in order to satisfy the hive?  If that is the
> case, I then have the question of Who decides what is
> correct and what is broken for any given patch that I may need
> to create?

 No, you misunderstood me: I didn't mean that you should override
$(PKG)_CONFIGURE_CMDS; I meant it as general advise for packagers.

 I you patch an existing package, like you do, it is nice if you can
fix some brokenness, but it is not required.

 In the case of ncurses, the simplest is to remove the redundant configure
options from ncurses.mk.

 In the case of htop, if the default solution doesn't work for whatever
reason, then adding something specific is fine of course.  [I quickly
tried it and just adding -static to LDFLAGS isn't sufficient for htop.]


> > > So, the original design I had done was to add top-level config
> > option
> > > under PREFER_STATIC as BUILD_ONLY_STATIC.  I guessed that this
> > would not
> > > be well received by the hive.  Perhaps that would have been a
> > better
> > > thing to do.  PREFER_STATIC seems to be misleading (based upon my
> > > expectations) given that if you _PREFER_ to use static libraries,
> > then
> > > shouldn't the system ONLY USE static libraries and never install
> > the
> > > shared objects?  I mean, if I ask my contractor to use screws to
> > build
> > > something, and he uses nails, that isn't what I asked for.  But
> > again,
> > > perhaps I have the wrong expectations for PREFER_STATIC.
> > 
> >  I guess this is because some packages don't know how to build
> > static
> > libraries, or how to link with them.  Such packages would have to
> > depend
> > on !BUILD_ONLY_STATIC.  But I think that it is a lot of work to
> > maintain
> > that option, with little benefit.
> 
> Eh, I had about 30 lines of text to discuss, "little benefit", but
> deleted those.  Got wrapped around the axel on that one.  It isn't
> little to me, be essential.  I'll look (later, probably two months)
> at putting this back in and putting the params in the top level
> make files.  We'll discuss again then.  For now, I'll continue to
> use my patch.  I concede and withdraw the patch.

 If there is a BUILD_ONLY_STATIC option that really makes sure that
no dynamic libraries can be used, then the benefit is clear.  But I'm
afraid that there is a big risk that some programs are accidentally
linked dynamically after all, and that you create a rootfs that doesn't
work.  In that case, the benefit compared to PREFER_STATIC is pretty
small IMO.


 Regards,
 Arnout


-- 
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

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

end of thread, other threads:[~2012-01-12 11:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-20 16:11 [Buildroot] [PATCH] Static build changes ANDY KENNEDY
2012-01-09  7:12 ` Arnout Vandecappelle
2012-01-09 20:45   ` ANDY KENNEDY
2012-01-11  7:01     ` Arnout Vandecappelle
2012-01-11 16:23       ` ANDY KENNEDY
2012-01-12 11:08         ` Arnout Vandecappelle
2012-01-09  8:04 ` Thomas Petazzoni
2012-01-09 17:17   ` Michael S. Zick

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox