Static build changes
PATCH 1/1 Static build changes
The affected files are:
Makefilepackage/ethtool/ethtool.mkpackage/htop/htop.mkpackage/i2c-tools/i2c-tools.mkpackage/kexec/kexec.mkpackage/libgcrypt/libgcrypt.mkpackage/libgpg-error/libgpg-error.mkpackage/makedevs/makedevs.mkpackage/mtd/mtd.mkpackage/ncurses/ncurses.mkpackage/portmap/portmap.mkpackage/proftpd/proftpd.mktoolchain/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.
---
Makefile 2011-12-20 09:39:59.000000000 -0600 renamed from Makefile 2011-12-14 15:54:04.000000000 -0600 +4 -1
@@ -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
package/ethtool/ethtool.mk 2011-12-20 09:41:40.000000000 -0600 renamed from package/ethtool/ethtool.mk 2011-12-14 15:54:04.000000000 -0600 +4 -0
@@ -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))
package/htop/htop.mk 2011-12-20 09:44:06.000000000 -0600 renamed from package/htop/htop.mk 2011-12-14 15:54:04.000000000 -0600 +5 -0
@@ -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))
package/i2c-tools/i2c-tools.mk 2011-12-20 09:44:25.000000000 -0600 renamed from package/i2c-tools/i2c-tools.mk 2011-12-14 15:54:04.000000000 -0600 +4 -0
@@ -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
package/kexec/kexec.mk 2011-12-20 09:45:47.000000000 -0600 renamed from package/kexec/kexec.mk 2011-12-14 15:54:04.000000000 -0600 +5 -0
@@ -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
package/libgcrypt/libgcrypt.mk 2011-12-20 09:46:12.000000000 -0600 renamed from package/libgcrypt/libgcrypt.mk 2011-12-14 15:54:04.000000000 -0600 +6 -0
@@ -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 = \
package/libgpg-error/libgpg-error.mk 2011-12-20 09:46:32.000000000 -0600 renamed from package/libgpg-error/libgpg-error.mk 2011-12-14 15:54:04.000000000 -0600 +3 -0
@@ -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))
package/makedevs/makedevs.mk 2011-12-20 09:46:57.000000000 -0600 renamed from package/makedevs/makedevs.mk 2011-12-14 15:54:04.000000000 -0600 +4 -0
@@ -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
package/mtd/mtd.mk 2011-12-20 09:49:28.000000000 -0600 renamed from package/mtd/mtd.mk 2011-12-14 15:54:04.000000000 -0600 +4 -0
@@ -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) \
package/ncurses/ncurses.mk 2011-12-20 09:51:11.000000000 -0600 renamed from package/ncurses/ncurses.mk 2011-12-14 15:54:04.000000000 -0600 +17 -3
@@ -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)
package/portmap/portmap.mk 2011-12-20 09:51:30.000000000 -0600 renamed from package/portmap/portmap.mk 2011-12-14 15:54:04.000000000 -0600 +4 -0
@@ -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)
package/proftpd/proftpd.mk 2011-12-20 09:52:25.000000000 -0600 renamed from package/proftpd/proftpd.mk 2011-12-14 15:54:04.000000000 -0600 +9 -1
@@ -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
toolchain/uClibc/uclibc.mk 2011-12-20 09:53:49.000000000 -0600 renamed from toolchain/uClibc/uclibc.mk 2011-12-14 15:54:04.000000000 -0600 +1 -1
@@ -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
PATCH 1/1 Static build changes
Quoted 15 lines · On Tuesday 20 December 2011 17:11:54 ANDY KENNEDY wrote:
The affected files are:
Makefilepackage/ethtool/ethtool.mkpackage/htop/htop.mkpackage/i2c-tools/i2c-tools.mkpackage/kexec/kexec.mkpackage/libgcrypt/libgcrypt.mkpackage/libgpg-error/libgpg-error.mkpackage/makedevs/makedevs.mkpackage/mtd/mtd.mkpackage/ncurses/ncurses.mkpackage/portmap/portmap.mkpackage/proftpd/proftpd.mktoolchain/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.
Quoted 11 lines
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.
Quoted 1 line
Signed-off-by Andy Kennedy <[email protected]>
Quoted 21 lines
---
diff -Naur a/Makefile b/MakefileMakefile 2011-12-20 09:39:59.000000000 -0600 renamed from Makefile 2011-12-14 15:54:04.000000000 -0600 +4
-1@@ -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 endifdiff -Naur
a/package/ethtool/ethtool.mkb/package/ethtool/ethtool.mk
package/ethtool/ethtool.mk 2011-12-20 09:41:40.000000000 -0600 line 12
Quoted 6 lines
package/ethtool/ethtool.mk 2011-12-20 09:41:40.000000000 -0600 renamed from package/ethtool/ethtool.mk 2011-12-14 15:54:04.000000000 -0600 +3
-0@@ -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 toTARGET_LDFLAGS in Makefile.in? The -static is anyway just a hint, it doesn't force the linker to link statically.
package/htop/htop.mk 2011-12-20 09:44:06.000000000 -0600 line 16
Quoted 12 lines
package/ethtool/ethtool.mk 2011-12-20 09:41:40.000000000 -0600 renamed from package/ethtool/ethtool.mk 2011-12-14 15:54:04.000000000 -0600 +1
-0+ $(eval $(call AUTOTARGETS))diff -Naur
a/package/htop/htop.mkb/package/htop/htop.mkpackage/htop/htop.mk 2011-12-20 09:44:06.000000000 -0600 renamed from package/htop/htop.mk 2011-12-14 15:54:04.000000000 -0600 +3
-0@@ -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).
Quoted 21 lines
package/htop/htop.mk 2011-12-20 09:44:06.000000000 -0600 renamed from package/htop/htop.mk 2011-12-14 15:54:04.000000000 -0600 +2
-0+endif + $(eval $(call AUTOTARGETS))diff -Naur
a/package/i2c-tools/i2c-tools.mkb/package/i2c-tools/i2c-tools.mkpackage/i2c-tools/i2c-tools.mk 2011-12-20 09:44:25.000000000 -0600 renamed from package/i2c-tools/i2c-tools.mk 2011-12-14 15:54:04.000000000 -0600 +4
-0@@ -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) endefdiff -Naur
a/package/kexec/kexec.mkb/package/kexec/kexec.mk
package/kexec/kexec.mk 2011-12-20 09:45:47.000000000 -0600 line 19
Quoted 6 lines
package/kexec/kexec.mk 2011-12-20 09:45:47.000000000 -0600 renamed from package/kexec/kexec.mk 2011-12-14 15:54:04.000000000 -0600 +3
-0@@ -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.
Quoted 9 lines
package/kexec/kexec.mk 2011-12-20 09:45:47.000000000 -0600 renamed from package/kexec/kexec.mk 2011-12-14 15:54:04.000000000 -0600 +2
-0+endif + define KEXEC_REMOVE_LIB_TOOLS rm -rf $(TARGET_DIR)/usr/lib/kexec-tools endefdiff -Naur
a/package/libgcrypt/libgcrypt.mkb/package/libgcrypt/libgcrypt.mk
package/libgcrypt/libgcrypt.mk 2011-12-20 09:46:12.000000000 -0600 line 16
Quoted 8 lines
package/libgcrypt/libgcrypt.mk 2011-12-20 09:46:12.000000000 -0600 renamed from package/libgcrypt/libgcrypt.mk 2011-12-14 15:54:04.000000000 -0600 +5
-0@@ -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.)
Quoted 4 lines
package/libgcrypt/libgcrypt.mk 2011-12-20 09:46:12.000000000 -0600 renamed from package/libgcrypt/libgcrypt.mk 2011-12-14 15:54:04.000000000 -0600 +1
-0+ LIBGCRYPT_CONF_ENV = \ ac_cv_sys_symbol_underscore=no LIBGCRYPT_CONF_OPT = \
[snip]
Quoted 17 lines
diff -Naur
a/package/ncurses/ncurses.mkb/package/ncurses/ncurses.mkpackage/ncurses/ncurses.mk 2011-12-20 09:51:11.000000000 -0600 renamed from package/ncurses/ncurses.mk 2011-12-14 15:54:04.000000000 -0600 +1
-2@@ -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
package/ncurses/ncurses.mk 2011-12-20 09:51:11.000000000 -0600 line 53
Quoted 10 lines
package/ncurses/ncurses.mk 2011-12-20 09:51:11.000000000 -0600 renamed from package/ncurses/ncurses.mk 2011-12-14 15:54:04.000000000 -0600 +9
-0+ +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]
Quoted 13 lines
diff -Naur
a/package/proftpd/proftpd.mkb/package/proftpd/proftpd.mkpackage/proftpd/proftpd.mk 2011-12-20 09:52:25.000000000 -0600 renamed from package/proftpd/proftpd.mk 2011-12-14 15:54:04.000000000 -0600 +0
-1@@ -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 \
package/proftpd/proftpd.mk 2011-12-20 09:52:25.000000000 -0600 line 29
Quoted 10 lines
package/proftpd/proftpd.mk 2011-12-20 09:52:25.000000000 -0600 renamed from package/proftpd/proftpd.mk 2011-12-14 15:54:04.000000000 -0600 +8
-0--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.
Quoted 16 lines
package/proftpd/proftpd.mk 2011-12-20 09:52:25.000000000 -0600 renamed from package/proftpd/proftpd.mk 2011-12-14 15:54:04.000000000 -0600 +1
-0+ define PROFTPD_MAKENAMES $(MAKE1) CC="$(HOSTCC)" CFLAGS="" LDFLAGS="" -C $(@D)/lib/libcap _makenames endefdiff -Naur
a/toolchain/uClibc/uclibc.mkb/toolchain/uClibc/uclibc.mktoolchain/uClibc/uclibc.mk 2011-12-20 09:53:49.000000000 -0600 renamed from toolchain/uClibc/uclibc.mk 2011-12-14 15:54:04.000000000 -0600 +1
-0@@ -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 \
toolchain/uClibc/uclibc.mk 2011-12-20 09:53:49.000000000 -0600 line 492
Quoted 6 lines
toolchain/uClibc/uclibc.mk 2011-12-20 09:53:49.000000000 -0600 renamed from toolchain/uClibc/uclibc.mk 2011-12-14 15:54:04.000000000 -0600 +0
-1@@ -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
Signature · 6 lines
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
PATCH 1/1 Static build changes
Quoted 14 lines
Quoted 5 lines
Makefilepackage/ethtool/ethtool.mkpackage/htop/htop.mkpackage/i2c-tools/i2c-tools.mkpackage/kexec/kexec.mkQuoted 8 lines
package/libgcrypt/libgcrypt.mkpackage/libgpg-error/libgpg-error.mkpackage/makedevs/makedevs.mkpackage/mtd/mtd.mkpackage/ncurses/ncurses.mkpackage/portmap/portmap.mkpackage/proftpd/proftpd.mktoolchain/uClibc/uclibc.mk
Quoted 5 lines
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.
Quoted 11 lines
package/ethtool/ethtool.mk 2011-12-20 09:41:40.000000000 -0600 line 12
Quoted 7 lines
package/ethtool/ethtool.mk 2011-12-20 09:41:40.000000000 -0600 renamed from package/ethtool/ethtool.mk 2011-12-14 15:54:04.000000000 -0600 +3
-0@@ -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 +endifWouldn't it be more convenient if this was added globally to
TARGET_LDFLAGSin 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."
Quoted 12 lines
Quoted 5 lines
(quoted diff) +1
-0+ $(eval $(call AUTOTARGETS))diff -Naur
a/package/htop/htop.mkb/package/htop/htop.mk
---a/package/htop/htop.mk2011-12-14 15:54:04.000000000 -0600
Quoted 1 line
+++
b/package/htop/htop.mk2011-12-20 09:44:06.000000000 -0600
Quoted 4 lines
package/htop/htop.mk 2011-12-20 09:44:06.000000000 -0600 renamed from package/htop/htop.mk 2011-12-14 15:54:04.000000000 -0600 +0
-0@@ -11,4 +11,9 @@ HTOP_AUTORECONF = YES HTOP_CONF_OPT += --disable-unicode
Quoted 6 lines
package/htop/htop.mk 2011-12-20 09:44:06.000000000 -0600 line 16
Quoted 3 lines
package/htop/htop.mk 2011-12-20 09:44:06.000000000 -0600 renamed from package/htop/htop.mk 2011-12-14 15:54:04.000000000 -0600 +3
-0+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).
Quoted 11 lines
package/kexec/kexec.mk 2011-12-20 09:45:47.000000000 -0600 line 19
Quoted 4 lines
package/kexec/kexec.mk 2011-12-20 09:45:47.000000000 -0600 renamed from package/kexec/kexec.mk 2011-12-14 15:54:04.000000000 -0600 +3
-0+# This does not build kdump static (for some reason) +ifeq ($(BR2_PREFER_STATIC_LIB),y) +KEXEC_CONF_ENV += LDFLAGS+=-static CFLAGS+=-staticI 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.
Quoted 16 lines
Quoted 7 lines
package/kexec/kexec.mk 2011-12-20 09:45:47.000000000 -0600 renamed from package/kexec/kexec.mk 2011-12-14 15:54:04.000000000 -0600 +2
-0+endif + define KEXEC_REMOVE_LIB_TOOLS rm -rf $(TARGET_DIR)/usr/lib/kexec-tools endefdiff -Naur
a/package/libgcrypt/libgcrypt.mk
b/package/libgcrypt/libgcrypt.mkQuoted 1 line
---
a/package/libgcrypt/libgcrypt.mk2011-12-1415:54:04.000000000 -0600
Quoted 1 line
+++
b/package/libgcrypt/libgcrypt.mk2011-12-2009:46:12.000000000 -0600
Quoted 4 lines
package/libgcrypt/libgcrypt.mk 2011-12-20 09:46:12.000000000 -0600 renamed from package/libgcrypt/libgcrypt.mk 2011-12-14 15:54:04.000000000 -0600 +0
-0@@ -9,6 +9,12 @@ LIBGCRYPT_SITE = ftp://ftp.gnupg.org/gcrypt/libgcrypt LIBGCRYPT_INSTALL_STAGING = YES
Quoted 15 lines
package/libgcrypt/libgcrypt.mk 2011-12-20 09:46:12.000000000 -0600 line 16
Quoted 5 lines
package/libgcrypt/libgcrypt.mk 2011-12-20 09:46:12.000000000 -0600 renamed from package/libgcrypt/libgcrypt.mk 2011-12-14 15:54:04.000000000 -0600 +5
-0+ifneq ($(BR2_PREFER_STATIC_LIB),y) +LIBGCRYPT_INSTALL_TARGET = YES +else +LIBGCRYPT_INSTALL_TARGET = NO +endifThere should also be a global solution for this. When you prefer
static
libs, then none of the libraries should be installed. Something likeFOO_INSTALL_LIBRARIES= YES
that setsINSTALL_STAGINGandINSTALL_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.
Quoted 4 lines
Quoted 4 lines
package/ncurses/ncurses.mk 2011-12-20 09:51:11.000000000 -0600 renamed from package/ncurses/ncurses.mk 2011-12-14 15:54:04.000000000 -0600 +4
-0+ifeq ($(BR2_PREFER_STATIC_LIB),y) +NCURSES_CONF_OPT += \ + --without-shared \ + --enable-static
Quoted 8 lines
package/ncurses/ncurses.mk 2011-12-20 09:51:11.000000000 -0600 line 53
Quoted 5 lines
package/ncurses/ncurses.mk 2011-12-20 09:51:11.000000000 -0600 renamed from package/ncurses/ncurses.mk 2011-12-14 15:54:04.000000000 -0600 +4
-0+else +NCURSES_CONF_OPT += \ + --with-shared \ --disable-static +endifThis 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.
Quoted 23 lines
Quoted 3 lines
+
definePROFTPD_MAKENAMES$(MAKE1) CC="$(HOSTCC)" CFLAGS="" LDFLAGS="" -C$(@D)/lib/libcap
_makenamesQuoted 2 lines
endef
diff -Naura/toolchain/uClibc/uclibc.mk
b/toolchain/uClibc/uclibc.mkQuoted 1 line
---
a/toolchain/uClibc/uclibc.mk2011-12-1415:54:04.000000000 -0600
Quoted 1 line
+++
b/toolchain/uClibc/uclibc.mk2011-12-2009:53:49.000000000 -0600
Quoted 12 lines
toolchain/uClibc/uclibc.mk 2011-12-20 09:53:49.000000000 -0600 renamed from toolchain/uClibc/uclibc.mk 2011-12-14 15:54:04.000000000 -0600 +1
-0@@ -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 $@
Quoted 7 lines
toolchain/uClibc/uclibc.mk 2011-12-20 09:53:49.000000000 -0600 line 492
Quoted 3 lines
toolchain/uClibc/uclibc.mk 2011-12-20 09:53:49.000000000 -0600 renamed from toolchain/uClibc/uclibc.mk 2011-12-14 15:54:04.000000000 -0600 +0
-1-ifneq ($(BR2_PREFER_STATIC_LIB),y) UCLIBC_TARGETS=$(TARGET_DIR)/lib/libc.so.0 endifI'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
PATCH 1/1 Static build changes
Quoted 20 lines · On Monday 09 January 2012 21:45:16 ANDY KENNEDY wrote:
Quoted 14 lines
Quoted 5 lines
Makefilepackage/ethtool/ethtool.mkpackage/htop/htop.mkpackage/i2c-tools/i2c-tools.mkpackage/kexec/kexec.mkQuoted 8 lines
package/libgcrypt/libgcrypt.mkpackage/libgpg-error/libgpg-error.mkpackage/makedevs/makedevs.mkpackage/mtd/mtd.mkpackage/ncurses/ncurses.mkpackage/portmap/portmap.mkpackage/proftpd/proftpd.mktoolchain/uClibc/uclibc.mkQuoted 5 lines
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.
Quoted 4 lines
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.
Quoted 12 lines
Quoted 11 lines
package/ethtool/ethtool.mk 2011-12-20 09:41:40.000000000 -0600 line 12
Quoted 7 lines
package/ethtool/ethtool.mk 2011-12-20 09:41:40.000000000 -0600 renamed from package/ethtool/ethtool.mk 2011-12-14 15:54:04.000000000 -0600 +3
-0@@ -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 +endifWouldn't it be more convenient if this was added globally to
TARGET_LDFLAGSin Makefile.in? The -static is anyway just a hint, it doesn't force the linker to link statically.
Quoted 1 line
To quote Bill Cosby: "I hadn't thought of that."
That's why we have reviews :-)
Quoted 18 lines
Quoted 11 lines
Quoted 4 lines
(quoted diff) +1
-0+ $(eval $(call AUTOTARGETS))diff -Naur
a/package/htop/htop.mkb/package/htop/htop.mk
---a/package/htop/htop.mk2011-12-14 15:54:04.000000000 -0600
Quoted 1 line
+++
b/package/htop/htop.mk2011-12-20 09:44:06.000000000 -0600
Quoted 4 lines
package/htop/htop.mk 2011-12-20 09:44:06.000000000 -0600 renamed from package/htop/htop.mk 2011-12-14 15:54:04.000000000 -0600 +0
-0@@ -11,4 +11,9 @@ HTOP_AUTORECONF = YES HTOP_CONF_OPT += --disable-unicodeQuoted 6 lines
package/htop/htop.mk 2011-12-20 09:44:06.000000000 -0600 line 16
Quoted 3 lines
package/htop/htop.mk 2011-12-20 09:44:06.000000000 -0600 renamed from package/htop/htop.mk 2011-12-14 15:54:04.000000000 -0600 +3
-0+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).
Quoted 7 lines
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]
Quoted 26 lines
Quoted 18 lines
Quoted 1 line
diff -Naur
a/toolchain/uClibc/uclibc.mk
b/toolchain/uClibc/uclibc.mkQuoted 1 line
---
a/toolchain/uClibc/uclibc.mk2011-12-1415:54:04.000000000 -0600
Quoted 1 line
+++
b/toolchain/uClibc/uclibc.mk2011-12-2009:53:49.000000000 -0600
Quoted 12 lines
toolchain/uClibc/uclibc.mk 2011-12-20 09:53:49.000000000 -0600 renamed from toolchain/uClibc/uclibc.mk 2011-12-14 15:54:04.000000000 -0600 +1
-0@@ -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 $@Quoted 7 lines
toolchain/uClibc/uclibc.mk 2011-12-20 09:53:49.000000000 -0600 line 492
Quoted 3 lines
toolchain/uClibc/uclibc.mk 2011-12-20 09:53:49.000000000 -0600 renamed from toolchain/uClibc/uclibc.mk 2011-12-14 15:54:04.000000000 -0600 +0
-1-ifneq ($(BR2_PREFER_STATIC_LIB),y) UCLIBC_TARGETS=$(TARGET_DIR)/lib/libc.so.0 endifI'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.
Quoted 9 lines
So, the original design I had done was to add top-level config option under
PREFER_STATICasBUILD_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_STATICseems 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 forPREFER_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
Signature · 6 lines
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
PATCH 1/1 Static build changes
Quoted 9 lines
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.
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
Review line 8
Quoted 4 lines
(quoted diff) +0
-0@@ -7,4 +7,8 @@ ETHTOOL_VERSION = 3.0 ETHTOOL_SITE =$(BR2_KERNEL_MIRROR)/software/network/ethtool/
Quoted 7 lines
Quoted 7 lines
package/ethtool/ethtool.mk 2011-12-20 09:41:40.000000000 -0600 line 12
Quoted 4 lines
package/ethtool/ethtool.mk 2011-12-20 09:41:40.000000000 -0600 renamed from package/ethtool/ethtool.mk 2011-12-14 15:54:04.000000000 -0600 +3
-0+ifeq ($(BR2_PREFER_STATIC_LIB),y) +ETHTOOL_CONF_ENV += LDFLAGS+=-static +endifWouldn't it be more convenient if this was added globally to
TARGET_LDFLAGSin Makefile.in? The -static is anyway just a
Quoted 6 lines
hint,
Quoted 3 lines
Quoted 1 line
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.
Quoted 7 lines
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?
Quoted 17 lines
Quoted 1 line
So, the original design I had done was to add top-level config
option
Quoted 1 line
under
PREFER_STATICasBUILD_ONLY_STATIC. I guessed that thiswould not
Quoted 1 line
be well received by the hive. Perhaps that would have been a
better
Quoted 2 lines
thing to do.
PREFER_STATICseems to be misleading (based upon my expectations) given that if you _PREFER_ to use static libraries,then
Quoted 1 line
shouldn't the system ONLY USE static libraries and never install
the
Quoted 1 line
shared objects? I mean, if I ask my contractor to use screws to
build
Quoted 1 line
something, and he uses nails, that isn't what I asked for. But
again,
Quoted 1 line
perhaps I have the wrong expectations for
PREFER_STATIC.
Quoted 7 lines
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
PATCH 1/1 Static build changes
Quoted 5 lines · 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!
Quoted 8 lines
Quoted 7 lines
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.
Quoted 8 lines
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
Makefilewhen 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.]
Quoted 25 lines
Quoted 17 lines
Quoted 1 line
So, the original design I had done was to add top-level config
option
Quoted 1 line
under
PREFER_STATICasBUILD_ONLY_STATIC. I guessed that thiswould not
Quoted 1 line
be well received by the hive. Perhaps that would have been a
better
Quoted 2 lines
thing to do.
PREFER_STATICseems to be misleading (based upon my expectations) given that if you _PREFER_ to use static libraries,then
Quoted 1 line
shouldn't the system ONLY USE static libraries and never install
the
Quoted 1 line
shared objects? I mean, if I ask my contractor to use screws to
build
Quoted 1 line
something, and he uses nails, that isn't what I asked for. But
again,
Quoted 1 line
perhaps I have the wrong expectations for
PREFER_STATIC.Quoted 7 lines
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.
Quoted 6 lines
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
Signature · 6 lines
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
PATCH 1/1 Static build changes
In reply to ANDY KENNEDYHello,
Le Tue, 20 Dec 2011 16:11:54 +0000,
ANDY KENNEDY <[email protected]> a ?crit :
Quoted 10 lines
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
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH 1/1 Static build changes
Quoted 28 lines · Thomas Petazzoni
Hello,
Le Tue, 20 Dec 2011 16:11:54 +0000,
ANDY KENNEDY <[email protected]> a ?crit :Quoted 10 lines
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
Quoted 9 lines
* 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
Quoted 3 lines
Regards,
Thomas