tcl: add support for static builds
PATCH v2 1/2 tcl: add support for static builds
tcl fails to build statically for two reasons. The first one is because it tries to build the tclsh binary with dynamic loading support, which uses dlopen() and friends. This is because the '--enable-load' configure option is 'on' by default. The second one is because it builds the 'packages' by default. These 'packages' are shared objects which are intended to be loaded dynamically.
In order to fix this, we add '--disable-load' to the configure options and avoid building the 'packages' when BR2_STATIC_LIBS is set.
Related upstream mailing list thread:
http://sourceforge.net/p/tcl/mailman/message/33388034/
---
Changes V1 -> V2: Remove HOST_TCL stuff
package/tcl/tcl.mk | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)
package/tcl/tcl.mk +12 -0
@@ -29,6 +29,18 @@ HOST_TCL_CONF_OPTS = \ --disable-langinfo \ --disable-framework +ifeq ($(BR2_STATIC_LIBS),y) +# Do not build tclsh with dynamic loading support when building it +# statically because it needs dlopen() and friends. +TCL_CONF_OPTS += --disable-load +# Also, build only the binaries and libraries and don't build the +# 'packages' because they are shared objects which are intended to be +# loaded dynamically. +TCL_MAKE_OPTS = binaries libraries +TCL_INSTALL_STAGING_OPTS = DESTDIR=$(STAGING_DIR) install-binaries install-libraries +TCL_INSTALL_TARGET_OPTS = DESTDIR=$(TARGET_DIR) install-binaries +endif + # I haven't found a good way to force pkgs to not build # or configure without just removing the entire pkg directory. define HOST_TCL_REMOVE_PACKAGES
Signature · 1 line
1.7.1
PATCH v2 2/2 tcl: rename BR2_PACKAGE_TCL_SHLIB_ONLY to be more consistent
The BR2_PACKAGE_TCL_SHLIB_ONLY is confusing because someone could think that only shared libraries would be installed. But, what actually does is removing the 'tclsh' binary, so better to reword it in order to be consistent with what actually does.
---
Changes V1 -> V2: add an entry to Config.in.legacy
Config.in.legacy | 12 ++++++++++++ package/tcl/Config.in | 7 +++---- package/tcl/tcl.mk | 2 +- 3 files changed, 16 insertions(+), 5 deletions(-)
Config.in.legacy +12 -0
@@ -100,6 +100,18 @@ endif ############################################################################### +config BR2_PACKAGE_TCL_SHLIB_ONLY + string "tcl: the 'install only shared library' option has been renamed" + help + The option BR2_PACKAGE_TCL_SHLIB_ONLY has been renamed to + BR2_PACKAGE_TCL_REMOVE_TCLSH to be consistent with what it + does. + +config BR2_PACKAGE_TCL_SHLIB_ONLY_WRAP + bool + default y if BR2_PACKAGE_TCL_SHLIB_ONLY != "" + select BR2_LEGACY + comment "Legacy options removed in 2015.02" config BR2_PACKAGE_LIBGC
package/tcl/Config.in +3 -4
@@ -25,12 +25,11 @@ config BR2_PACKAGE_TCL_DEL_ENCODINGS It saves approx. 1.6 Mb of space. -config BR2_PACKAGE_TCL_SHLIB_ONLY - bool "install only shared library" +config BR2_PACKAGE_TCL_REMOVE_TCLSH + bool "do not install tclsh" default y help - Install only TCL shared library and not binary tcl - interpreter (tclsh). + Do not install the tcl interpreter (tclsh). Saves ~14kb.
package/tcl/tcl.mk +1 -1
@@ -69,7 +69,7 @@ endef TCL_POST_INSTALL_TARGET_HOOKS += TCL_REMOVE_ENCODINGS endif -ifeq ($(BR2_PACKAGE_TCL_SHLIB_ONLY),y) +ifeq ($(BR2_PACKAGE_TCL_REMOVE_TCLSH),y) define TCL_REMOVE_TCLSH rm -f $(TARGET_DIR)/usr/bin/tclsh$(TCL_VERSION_MAJOR) endef
Signature · 1 line
1.7.1
PATCH v2 2/2 tcl: rename BR2_PACKAGE_TCL_SHLIB_ONLY to be more consistent
Dear Vicente Olivert Riera,
Config.in.legacy endif · line 113
Quoted 11 lines · Vicente Olivert Riera
Config.in.legacy +11
-0+config BR2_PACKAGE_TCL_SHLIB_ONLY + string "tcl: the 'install only shared library' option has been renamed" + help + The option BR2_PACKAGE_TCL_SHLIB_ONLY has been renamed to + BR2_PACKAGE_TCL_REMOVE_TCLSH to be consistent with what it + does. + +config BR2_PACKAGE_TCL_SHLIB_ONLY_WRAP + bool + default y if BR2_PACKAGE_TCL_SHLIB_ONLY != "" + select BR2_LEGACY
The 'wrap' thing is only when removing string options, not boolean options.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v2 1/2 tcl: add support for static builds
In reply to Vicente Olivert RieraDear Vicente Olivert Riera,
package/tcl/tcl.mk HOST_TCL_CONF_OPTS = \ · line 42
Quoted 11 lines · Vicente Olivert Riera
package/tcl/tcl.mk +11
-0+ifeq ($(BR2_STATIC_LIBS),y) +# Do not build tclsh with dynamic loading support when building it +# statically because it needs dlopen() and friends. +TCL_CONF_OPTS += --disable-load +# Also, build only the binaries and libraries and don't build the +# 'packages' because they are shared objects which are intended to be +# loaded dynamically. +TCL_MAKE_OPTS = binaries libraries +TCL_INSTALL_STAGING_OPTS = DESTDIR=$(STAGING_DIR) install-binaries install-libraries +TCL_INSTALL_TARGET_OPTS = DESTDIR=$(TARGET_DIR) install-binaries +endif
But, if we don't build the 'packages', is the tcl stuff still useful?
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v2 1/2 tcl: add support for static builds
Dear Thomas Petazzoni,
Quoted 4 lines · Thomas Petazzoni
Dear Vicente Olivert Riera,
On Sat, 7 Mar 2015 13:22:41 +0000, Vicente Olivert Riera wrote:
Quoted 13 lines
package/tcl/tcl.mk HOST_TCL_CONF_OPTS = \ · line 42
Quoted 11 lines
package/tcl/tcl.mk +11
-0+ifeq ($(BR2_STATIC_LIBS),y) +# Do not build tclsh with dynamic loading support when building it +# statically because it needs dlopen() and friends. +TCL_CONF_OPTS += --disable-load +# Also, build only the binaries and libraries and don't build the +# 'packages' because they are shared objects which are intended to be +# loaded dynamically. +TCL_MAKE_OPTS = binaries libraries +TCL_INSTALL_STAGING_OPTS = DESTDIR=$(STAGING_DIR) install-binaries install-libraries +TCL_INSTALL_TARGET_OPTS = DESTDIR=$(TARGET_DIR) install-binaries +endifBut, if we don't build the 'packages', is the tcl stuff still useful?
I guess you could need tcl to build something that depends on it, and link against libtcl8.6.a, for instance.
Regards,
--
Vincent
Quoted 4 lines
Best regards,
Thomas
PATCH v2 1/2 tcl: add support for static builds
Dear Vicente Olivert Riera,
Quoted 2 lines · Vicente Olivert Riera
I guess you could need tcl to build something that depends on it, and link against libtcl8.6.a, for instance.
If you need tcl to build something, then it's the host tcl, not the target tcl.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v2 1/2 tcl: add support for static builds
Dear Thomas Petazzoni,
Quoted 9 lines · Thomas Petazzoni
Dear Vicente Olivert Riera,
Quoted 2 lines · Vicente Olivert Riera
I guess you could need tcl to build something that depends on it, and link against libtcl8.6.a, for instance.
If you need tcl to build something, then it's the host tcl, not the target tcl.
uhm..., I'm sorry but I don't understand what you mean.
If you have a package that depends on tcl (it links against libtcl8.6.a, for instance), then you will need the target tcl (actually the staging one), which has the right architecture for your target, no? The host tcl would have the same architecture as the host machine which may not be the same as the target one.
Am I missing anything?
Regards,
--
Vincent
Quoted 2 lines
Thomas
PATCH v2 1/2 tcl: add support for static builds
Dear Vicente Olivert Riera,
Quoted 7 lines · Vicente Olivert Riera
If you have a package that depends on tcl (it links against libtcl8.6.a, for instance), then you will need the target tcl (actually the staging one), which has the right architecture for your target, no? The host tcl would have the same architecture as the host machine which may not be the same as the target one.
Am I missing anything?
Yes: you still haven't answered whether the 'packages' thing in TCL is important or not. Yes, your tcl static linking thing is *building* properly. But does it work? Does the result actually make sense? You've solved the static linking case by simply not building everything. What guarantees you that the result is something that works?
Since it seems you actually don't know what TCL is and how it works (and neither do I), I'd prefer to mark it !BR2_STATIC_LIBS, and let someone actually interested in using TCL in a statically linked scenario take care of implementing this.
Thanks,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v2 1/2 tcl: add support for static builds
Dear Thomas Petazzoni,
Quoted 18 lines · Thomas Petazzoni
Dear Vicente Olivert Riera,
Quoted 7 lines · Vicente Olivert Riera
If you have a package that depends on tcl (it links against libtcl8.6.a, for instance), then you will need the target tcl (actually the staging one), which has the right architecture for your target, no? The host tcl would have the same architecture as the host machine which may not be the same as the target one.
Am I missing anything?
Yes: you still haven't answered whether the 'packages' thing in TCL is important or not. Yes, your tcl static linking thing is *building* properly. But does it work? Does the result actually make sense? You've solved the static linking case by simply not building everything. What guarantees you that the result is something that works?
Quoted 4 lines
Since it seems you actually don't know what TCL is and how it works (and neither do I), I'd prefer to mark it !BR2_STATIC_LIBS, and let someone actually interested in using TCL in a statically linked scenario take care of implementing this.
Ok, no problem.
Regards,
--
Vincent
Quoted 4 lines
Thanks,
Thomas
PATCH v2 1/2 tcl: add support for static builds
In reply to Thomas PetazzoniQuoted 4 lines · Thomas Petazzoni
Dear Vicente Olivert Riera,
On Sat, 7 Mar 2015 13:22:41 +0000, Vicente Olivert Riera wrote:
Quoted 13 lines
package/tcl/tcl.mk HOST_TCL_CONF_OPTS = \ · line 42
Quoted 11 lines
package/tcl/tcl.mk +11
-0+ifeq ($(BR2_STATIC_LIBS),y) +# Do not build tclsh with dynamic loading support when building it +# statically because it needs dlopen() and friends. +TCL_CONF_OPTS += --disable-load +# Also, build only the binaries and libraries and don't build the +# 'packages' because they are shared objects which are intended to be +# loaded dynamically. +TCL_MAKE_OPTS = binaries libraries +TCL_INSTALL_STAGING_OPTS = DESTDIR=$(STAGING_DIR) install-binaries install-libraries +TCL_INSTALL_TARGET_OPTS = DESTDIR=$(TARGET_DIR) install-binaries +endifBut, if we don't build the 'packages', is the tcl stuff still useful?
The packages are a bunch of additional packages that happen to be distributed
together with tcl. In this case:
incr Tcl (object-oriented extensions)
sqlite
thread
tdbc (database connector)
So if you want to run scripts that make use of these packages, yes you're in
trouble. But I expect that there will be plenty of scripts that don't use these extensions.
That said, I agree with Thomas's final statement that unless you're actually
using this, it's both pointless and dangerous to make such a change.
Regards,
Arnout
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 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