package/libdcadec: Add -fPIC to static build, enable shared build
PATCH v2 1/1 package/libdcadec: Add -fPIC to static build, enable shared build
Build errors occured due to libdcadec being linked statically.
Fixes
http://autobuild.buildroot.net/results/a19/a19023e094cbed491444665d6839a9e65a8eee6c/
http://autobuild.buildroot.net/results/98d/98dde028d1d6199f05c904b498bc39bbaa112aa6/
http://autobuild.buildroot.net/results/4ff/4ffcae6cae419df35e8ca29d429ee178bcf31882/
http://autobuild.buildroot.net/results/8ce/8ced16874255ace4923f6b8888c3fca07f28b804/
---
v2: removed -fPIC for static build (Thomas, Samuel)
package/libdcadec/libdcadec.mk | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
package/libdcadec/libdcadec.mk +8 -3
@@ -10,19 +10,24 @@ LIBDCADEC_LICENSE = LGPLv2.1+ LIBDCADEC_LICENSE_FILES = COPYING.LGPLv2.1 LIBDCADEC_INSTALL_STAGING = YES +ifneq ($(BR2_STATIC_LIBS),y) +LIBDCADEC_SHARED = CONFIG_SHARED=1 +endif + define LIBDCADEC_BUILD_CMDS $(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) \ - CFLAGS="$(TARGET_CFLAGS) -std=gnu99" -C $(@D) + CFLAGS="$(TARGET_CFLAGS) -std=gnu99" \ + $(LIBDCADEC_SHARED) -C $(@D) endef define LIBDCADEC_INSTALL_STAGING_CMDS $(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) \ - DESTDIR=$(STAGING_DIR) PREFIX=/usr install + $(LIBDCADEC_SHARED) DESTDIR=$(STAGING_DIR) PREFIX=/usr install endef define LIBDCADEC_INSTALL_TARGET_CMDS $(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) \ - DESTDIR=$(TARGET_DIR) PREFIX=/usr install + $(LIBDCADEC_SHARED) DESTDIR=$(TARGET_DIR) PREFIX=/usr install endef $(eval $(generic-package))
Signature · 1 line
2.6.1
PATCH v2 1/1 package/libdcadec: Add -fPIC to static build, enable shared build
Bernd,
Thanks for the new version!
The title of the commit now seems a bit odd, since you're no longer adding -fPIC.
Quoted 1 line · Bernd Kuhls
Build errors occured due to libdcadec being linked statically.
Can you be more verbose in your commit log, to explain what's going on? At the bare minimum, something like:
"""
The libdcadec package currently only builds a static library, which is naturally built without -fPIC (since this is generally not needed for static libraries).
However, when the generated static library gets used inside a larger dynamic library, such as ffmpeg's one, the link fails, since we're trying to include in a shared library non-PIC code.
To solve this, this commit changes the way the libdcadec library is built to make sure a shared variant of the library gets built when appropriate. This way, ffmpeg has a PIC-enabled libdcadec library to link with.
"""
package/libdcadec/libdcadec.mk LIBDCADEC_LICENSE = LGPLv2.1+ · line 13
Quoted 9 lines
package/libdcadec/libdcadec.mk +1
-0@@ -10,19 +10,24 @@ LIBDCADEC_LICENSE = LGPLv2.1+ LIBDCADEC_LICENSE_FILES = COPYING.LGPLv2.1 LIBDCADEC_INSTALL_STAGING = YES +ifneq ($(BR2_STATIC_LIBS),y)
This should be:
ifeq ($(BR2_STATIC_LIBS),)
Thanks,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com