Patchwork [v2] wvstreams: Pass -fPIC to CFLAGS when building PIC objects

login
register
mail settings
Submitter Markos Chandras
Date June 20, 2013, 2:14 p.m.
Message ID <1371737650-12310-1-git-send-email-markos.chandras@gmail.com>
Download mbox | patch
Permalink /patch/252943/
State Accepted
Headers show

Comments

Markos Chandras - June 20, 2013, 2:14 p.m.
From: Markos Chandras <markos.chandras@imgtec.com>

The argp bundled dependency which is linked to the libwvutils.so
shared library, wasn't built with -fPIC.
MIPS will refuce to link a non-PIC library with a shared one.

We fix this problem by appending -fPIC to CFLAGS and build all the
shared objects with -fPIC.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
---
 package/wvstreams/wvstreams.mk | 4 ++++
 1 file changed, 4 insertions(+)
Markos Chandras - June 20, 2013, 2:28 p.m.
On 20 June 2013 15:14, Markos Chandras <markos.chandras@gmail.com> wrote:
> From: Markos Chandras <markos.chandras@imgtec.com>
>
> The argp bundled dependency which is linked to the libwvutils.so
> shared library, wasn't built with -fPIC.
> MIPS will refuce to link a non-PIC library with a shared one.
>
> We fix this problem by appending -fPIC to CFLAGS and build all the
> shared objects with -fPIC.
>
> Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
> ---
>  package/wvstreams/wvstreams.mk | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/package/wvstreams/wvstreams.mk b/package/wvstreams/wvstreams.mk
> index 65f48d4..fddaad7 100644
> --- a/package/wvstreams/wvstreams.mk
> +++ b/package/wvstreams/wvstreams.mk
> @@ -27,6 +27,10 @@ WVSTREAMS_CONF_OPT += \
>  # needed for openssl detection when statically linking (as ssl needs lz)
>  WVSTREAMS_CONF_ENV += LIBS=-lz
>
> +ifneq ($(BR2_PREFER_STATIC_LIB),y)
> +       WVSTREAMS_CONF_ENV = CFLAGS="$(TARGET_CFLAGS) -fPIC"
> +endif

I just noticed this is a mistake. It should be "+=" instead of "=" for
the WVSTREAMS_CONF_ENV.

I can send a new patch if needed.

--
Regards,
Markos Chandras
Peter Korsgaard - June 20, 2013, 3:06 p.m.
>>>>> "Markos" == Markos Chandras <markos.chandras@gmail.com> writes:

 Markos> From: Markos Chandras <markos.chandras@imgtec.com>
 Markos> The argp bundled dependency which is linked to the libwvutils.so
 Markos> shared library, wasn't built with -fPIC.
 Markos> MIPS will refuce to link a non-PIC library with a shared one.

 Markos> We fix this problem by appending -fPIC to CFLAGS and build all the
 Markos> shared objects with -fPIC.

 Markos> Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
 Markos> ---
 Markos>  package/wvstreams/wvstreams.mk | 4 ++++
 Markos>  1 file changed, 4 insertions(+)

 Markos> diff --git a/package/wvstreams/wvstreams.mk b/package/wvstreams/wvstreams.mk
 Markos> index 65f48d4..fddaad7 100644
 Markos> --- a/package/wvstreams/wvstreams.mk
 Markos> +++ b/package/wvstreams/wvstreams.mk
 Markos> @@ -27,6 +27,10 @@ WVSTREAMS_CONF_OPT += \
 Markos>  # needed for openssl detection when statically linking (as ssl needs lz)
 Markos>  WVSTREAMS_CONF_ENV += LIBS=-lz
 
 Markos> +ifneq ($(BR2_PREFER_STATIC_LIB),y)
 Markos> +	WVSTREAMS_CONF_ENV = CFLAGS="$(TARGET_CFLAGS) -fPIC"

Committed with this changed to a +=, thanks.
Markos Chandras - June 20, 2013, 8:21 p.m.
On 20 June 2013 16:06, Peter Korsgaard <jacmet@uclibc.org> wrote:
>>>>>> "Markos" == Markos Chandras <markos.chandras@gmail.com> writes:
>
>  Markos> From: Markos Chandras <markos.chandras@imgtec.com>
>  Markos> The argp bundled dependency which is linked to the libwvutils.so
>  Markos> shared library, wasn't built with -fPIC.
>  Markos> MIPS will refuce to link a non-PIC library with a shared one.
>
>  Markos> We fix this problem by appending -fPIC to CFLAGS and build all the
>  Markos> shared objects with -fPIC.
>
>  Markos> Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
>  Markos> ---
>  Markos>  package/wvstreams/wvstreams.mk | 4 ++++
>  Markos>  1 file changed, 4 insertions(+)
>
>  Markos> diff --git a/package/wvstreams/wvstreams.mk b/package/wvstreams/wvstreams.mk
>  Markos> index 65f48d4..fddaad7 100644
>  Markos> --- a/package/wvstreams/wvstreams.mk
>  Markos> +++ b/package/wvstreams/wvstreams.mk
>  Markos> @@ -27,6 +27,10 @@ WVSTREAMS_CONF_OPT += \
>  Markos>  # needed for openssl detection when statically linking (as ssl needs lz)
>  Markos>  WVSTREAMS_CONF_ENV += LIBS=-lz
>
>  Markos> +ifneq ($(BR2_PREFER_STATIC_LIB),y)
>  Markos> +      WVSTREAMS_CONF_ENV = CFLAGS="$(TARGET_CFLAGS) -fPIC"
>
> Committed with this changed to a +=, thanks.
>
> --
> Bye, Peter Korsgaard

Thank you Peter

--
Regards,
Markos Chandras

Patch

diff --git a/package/wvstreams/wvstreams.mk b/package/wvstreams/wvstreams.mk
index 65f48d4..fddaad7 100644
--- a/package/wvstreams/wvstreams.mk
+++ b/package/wvstreams/wvstreams.mk
@@ -27,6 +27,10 @@  WVSTREAMS_CONF_OPT += \
 # needed for openssl detection when statically linking (as ssl needs lz)
 WVSTREAMS_CONF_ENV += LIBS=-lz
 
+ifneq ($(BR2_PREFER_STATIC_LIB),y)
+	WVSTREAMS_CONF_ENV = CFLAGS="$(TARGET_CFLAGS) -fPIC"
+endif
+
 ifeq ($(BR2_PACKAGE_DBUS),y)
 	WVSTREAMS_DEPENDENCIES += dbus
 	WVSTREAMS_CONF_OPT += --with-dbus