* [Buildroot] [Patch] Allow file to be built against static libs. @ 2011-07-19 19:48 ANDY KENNEDY 2011-07-19 20:22 ` Peter Korsgaard 0 siblings, 1 reply; 6+ messages in thread From: ANDY KENNEDY @ 2011-07-19 19:48 UTC (permalink / raw) To: buildroot If selected "prefer static libs", file fails to build reporting: relocation R_X86_64_32S against `zcalloc' can not be used when making a shared object; recompile with -fPIC The suggested -fPIC doesn't work. The issue is that the default configure has --enable-shared --enable-static. This patch modifies the configure to disable shared when "prefer static libs" is selected. Signed-off-by Andy Kennedy <Andy.Kennedy@Adtran.com> --- diff -Naur a/package/file/file.mk b/package/file/file.mk --- a/package/file/file.mk 2011-03-14 10:39:51.000000000 -0500 +++ b/package/file/file.mk 2011-07-19 14:36:32.000000000 -0500 @@ -9,6 +9,11 @@ FILE_DEPENDENCIES = host-file zlib HOST_FILE_DEPENDENCIES = host-zlib +ifeq ($(BR2_PREFER_STATIC_LIB),y) +FILE_CONF_OPT = --disable-shared --enable-static +HOST_FILE_CONF_OPT = --disable-shared --enable-static +endif + define FILE_UNINSTALL_TARGET_CMDS $(MAKE) DESTDIR=$(TARGET_DIR) uninstall -C $(FILE_DIR) rm -f $(TARGET_DIR)/usr/lib/libmagic.* ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [Patch] Allow file to be built against static libs. 2011-07-19 19:48 [Buildroot] [Patch] Allow file to be built against static libs ANDY KENNEDY @ 2011-07-19 20:22 ` Peter Korsgaard 2011-07-19 20:42 ` Thomas Petazzoni 2011-07-19 21:01 ` Peter Korsgaard 0 siblings, 2 replies; 6+ messages in thread From: Peter Korsgaard @ 2011-07-19 20:22 UTC (permalink / raw) To: buildroot >>>>> "ANDY" == ANDY KENNEDY <ANDY.KENNEDY@adtran.com> writes: ANDY> If selected "prefer static libs", file fails to build reporting: ANDY> relocation R_X86_64_32S against `zcalloc' can not be used when making ANDY> a shared object; recompile with -fPIC ANDY> The suggested -fPIC doesn't work. The issue is that the default ANDY> configure has --enable-shared --enable-static. This patch modifies ANDY> the configure to disable shared when "prefer static libs" is selected. ANDY> FILE_DEPENDENCIES = host-file zlib ANDY> HOST_FILE_DEPENDENCIES = host-zlib ANDY> +ifeq ($(BR2_PREFER_STATIC_LIB),y) ANDY> +FILE_CONF_OPT = --disable-shared --enable-static ANDY> +HOST_FILE_CONF_OPT = --disable-shared --enable-static We indeed force --enable-shared --disable-static for host builds, but that doesn't really matter. For target builds we use (see package/Makefile.in) --enable-static --enable-shared when PREFER_STATIC_LIB is enabled, so rather than something file specific, I think it would make more sense to set that to --enable-static --disable-shared instead. -- Bye, Peter Korsgaard ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [Patch] Allow file to be built against static libs. 2011-07-19 20:22 ` Peter Korsgaard @ 2011-07-19 20:42 ` Thomas Petazzoni 2011-07-19 21:01 ` Peter Korsgaard 1 sibling, 0 replies; 6+ messages in thread From: Thomas Petazzoni @ 2011-07-19 20:42 UTC (permalink / raw) To: buildroot Le Tue, 19 Jul 2011 22:22:56 +0200, Peter Korsgaard <jacmet@uclibc.org> a ?crit : > We indeed force --enable-shared --disable-static for host builds, but > that doesn't really matter. For target builds we use (see > package/Makefile.in) --enable-static --enable-shared when > PREFER_STATIC_LIB is enabled, so rather than something file specific, I > think it would make more sense to set that to --enable-static > --disable-shared instead. We have : ifeq ($(BR2_PREFER_STATIC_LIB),y) SHARED_STATIC_LIBS_OPTS=--enable-static --disable-shared else SHARED_STATIC_LIBS_OPTS=--enable-static --enable-shared endif So it is already --enable-static --disable-shared when BR2_PREFER_STATIC_LIB=y. So, Andy, I think that your patch is basically a no-op, except for the host build of the file package, but it is totally incorrect to turn the host build of the file package to a static library depending on the value of BR2_PREFER_STATIC_LIB, which is limited to target packages only. 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] 6+ messages in thread
* [Buildroot] [Patch] Allow file to be built against static libs. 2011-07-19 20:22 ` Peter Korsgaard 2011-07-19 20:42 ` Thomas Petazzoni @ 2011-07-19 21:01 ` Peter Korsgaard 2011-07-20 4:53 ` ANDY KENNEDY 1 sibling, 1 reply; 6+ messages in thread From: Peter Korsgaard @ 2011-07-19 21:01 UTC (permalink / raw) To: buildroot >>>>> "Peter" == Peter Korsgaard <jacmet@uclibc.org> writes: >>>>> "ANDY" == ANDY KENNEDY <ANDY.KENNEDY@adtran.com> writes: ANDY> If selected "prefer static libs", file fails to build reporting: ANDY> relocation R_X86_64_32S against `zcalloc' can not be used when making ANDY> a shared object; recompile with -fPIC ANDY> The suggested -fPIC doesn't work. The issue is that the default ANDY> configure has --enable-shared --enable-static. This patch modifies ANDY> the configure to disable shared when "prefer static libs" is selected. ANDY> FILE_DEPENDENCIES = host-file zlib ANDY> HOST_FILE_DEPENDENCIES = host-zlib ANDY> +ifeq ($(BR2_PREFER_STATIC_LIB),y) ANDY> +FILE_CONF_OPT = --disable-shared --enable-static ANDY> +HOST_FILE_CONF_OPT = --disable-shared --enable-static Peter> We indeed force --enable-shared --disable-static for host builds, but Peter> that doesn't really matter. For target builds we use (see Peter> package/Makefile.in) --enable-static --enable-shared when Peter> PREFER_STATIC_LIB is enabled, so rather than something file specific, I Peter> think it would make more sense to set that to --enable-static Peter> --disable-shared instead. Ehh, drop that, I remembered wrong - We're already doing --enable-static --disable-shared. -- Bye, Peter Korsgaard ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [Patch] Allow file to be built against static libs. 2011-07-19 21:01 ` Peter Korsgaard @ 2011-07-20 4:53 ` ANDY KENNEDY 2011-07-20 21:51 ` Peter Korsgaard 0 siblings, 1 reply; 6+ messages in thread From: ANDY KENNEDY @ 2011-07-20 4:53 UTC (permalink / raw) To: buildroot > >>>>> "Peter" == Peter Korsgaard <jacmet@uclibc.org> writes: > > >>>>> "ANDY" == ANDY KENNEDY <ANDY.KENNEDY@adtran.com> writes: > ANDY> If selected "prefer static libs", file fails to build > reporting: > ANDY> relocation R_X86_64_32S against `zcalloc' can not be used > when making > ANDY> a shared object; recompile with -fPIC > ANDY> The suggested -fPIC doesn't work. The issue is that the > default > ANDY> configure has --enable-shared --enable-static. This patch > modifies > ANDY> the configure to disable shared when "prefer static libs" is > selected. > > ANDY> FILE_DEPENDENCIES = host-file zlib > ANDY> HOST_FILE_DEPENDENCIES = host-zlib > > ANDY> +ifeq ($(BR2_PREFER_STATIC_LIB),y) > ANDY> +FILE_CONF_OPT = --disable-shared --enable-static > ANDY> +HOST_FILE_CONF_OPT = --disable-shared --enable-static > > Peter> We indeed force --enable-shared --disable-static for host > builds, but > Peter> that doesn't really matter. For target builds we use (see > Peter> package/Makefile.in) --enable-static --enable-shared when > Peter> PREFER_STATIC_LIB is enabled, so rather than something file > specific, I > Peter> think it would make more sense to set that to --enable- > static > Peter> --disable-shared instead. > > Ehh, drop that, I remembered wrong - We're already doing --enable- > static --disable-shared. Okay, well, sortta, but not really. I believe this to be the culprit: ############################################################# # # zlib # ############################################################# ZLIB_VERSION:=1.2.5 ZLIB_SOURCE:=zlib-$(ZLIB_VERSION).tar.bz2 ZLIB_SITE:=http://$(BR2_SOURCEFORGE_MIRROR).dl.sourceforge.net/sourceforge/libpng ZLIB_INSTALL_STAGING=YES ifeq ($(BR2_PREFER_STATIC_LIB),y) ZLIB_PIC := ZLIB_SHARED := --static else ZLIB_PIC := -fPIC ZLIB_SHARED := --shared endif I'm guessing this shouldn't be that way. I don't, however, really know how to fix this one up. I'm guessing that this needs to be something along the lines of: ifeq ($(BR2_PREFER_STATIC_LIBZ),y) ZLIB_CONF_ENV = "LDFLAGS+=--static" else ZLIB_CONF_ENV = "LDFLAGS+=-fPIC --shared" endif Or something like that. It appears, however, that the current state of the build makes ONLY a static libz if PREFER_STATIC_LIB is set. So, file just happened to be the red herring. Somebody who is more awake than I show me how to fix that puppy, please. Andy ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [Patch] Allow file to be built against static libs. 2011-07-20 4:53 ` ANDY KENNEDY @ 2011-07-20 21:51 ` Peter Korsgaard 0 siblings, 0 replies; 6+ messages in thread From: Peter Korsgaard @ 2011-07-20 21:51 UTC (permalink / raw) To: buildroot >>>>> "ANDY" == ANDY KENNEDY <ANDY.KENNEDY@adtran.com> writes: >> Ehh, drop that, I remembered wrong - We're already doing --enable- >> static --disable-shared. ANDY> Okay, well, sortta, but not really. I believe this to be the culprit: ANDY> ############################################################# ANDY> # ANDY> # zlib ANDY> # ANDY> ############################################################# ANDY> ZLIB_VERSION:=1.2.5 ANDY> ZLIB_SOURCE:=zlib-$(ZLIB_VERSION).tar.bz2 ANDY> ZLIB_SITE:=http://$(BR2_SOURCEFORGE_MIRROR).dl.sourceforge.net/sourceforge/libpng ANDY> ZLIB_INSTALL_STAGING=YES ANDY> ifeq ($(BR2_PREFER_STATIC_LIB),y) ANDY> ZLIB_PIC := ANDY> ZLIB_SHARED := --static ANDY> else ANDY> ZLIB_PIC := -fPIC ANDY> ZLIB_SHARED := --shared ANDY> endif Yes, this is all fine. The problem is just that we link host stuff dynamically, but zlib was building the host version in the same was as the target one (so static if BR2_PREFER_STATIC_LIB), which would then break host-file when it tried to dynamically link to zlib. I've fixed that now, thanks for reporting it. -- Bye, Peter Korsgaard ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-07-20 21:51 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-07-19 19:48 [Buildroot] [Patch] Allow file to be built against static libs ANDY KENNEDY 2011-07-19 20:22 ` Peter Korsgaard 2011-07-19 20:42 ` Thomas Petazzoni 2011-07-19 21:01 ` Peter Korsgaard 2011-07-20 4:53 ` ANDY KENNEDY 2011-07-20 21:51 ` Peter Korsgaard
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox