Patchwork cpan.bbclass: Fix CCFLAGS.

login
register
mail settings
Submitter xin.ouyang@windriver.com
Date June 21, 2012, 7:13 a.m.
Message ID <1340262834-27560-1-git-send-email-xin.ouyang@windriver.com>
Download mbox | patch
Permalink /patch/30381/
State Accepted
Commit 855211ae7a224f96663862d4a0e58a90d945dd48
Headers show

Comments

xin.ouyang@windriver.com - June 21, 2012, 7:13 a.m.
From: Xin Ouyang <Xin.Ouyang@windriver.com>

We should not just replace CCFLAGS with CFLAGS while compiling, because 
this may cause run-time errors with perl's DynaLoader.pm.

Tested on qemux86 with new libnet-libidn-perl bb recipe:

root@qemux86:~# perl -e "use Net::LibIDN"
Not a CODE reference at /usr/lib/perl/5.14.2//DynaLoader.pm line 213.
END failed--call queue aborted at /usr/lib/perl/vendor_perl/5.14.2//Net/LibIDN.pm line 213.
Compilation failed in require at -e line 1.
BEGIN failed--compilation aborted at -e line 1.

Signed-off-by: Xin Ouyang <Xin.Ouyang@windriver.com>
---
 meta/classes/cpan.bbclass |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
Khem Raj - June 21, 2012, 3:47 p.m.
On Thu, Jun 21, 2012 at 12:13 AM,  <xin.ouyang@windriver.com> wrote:
> From: Xin Ouyang <Xin.Ouyang@windriver.com>
>
> We should not just replace CCFLAGS with CFLAGS while compiling, because
> this may cause run-time errors with perl's DynaLoader.pm.
>
> Tested on qemux86 with new libnet-libidn-perl bb recipe:

can you instead try the patch from

http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=19;bug=628522

>
> root@qemux86:~# perl -e "use Net::LibIDN"
> Not a CODE reference at /usr/lib/perl/5.14.2//DynaLoader.pm line 213.
> END failed--call queue aborted at /usr/lib/perl/vendor_perl/5.14.2//Net/LibIDN.pm line 213.
> Compilation failed in require at -e line 1.
> BEGIN failed--compilation aborted at -e line 1.
>
> Signed-off-by: Xin Ouyang <Xin.Ouyang@windriver.com>
> ---
>  meta/classes/cpan.bbclass |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/meta/classes/cpan.bbclass b/meta/classes/cpan.bbclass
> index 2e9432c..957a6e2 100644
> --- a/meta/classes/cpan.bbclass
> +++ b/meta/classes/cpan.bbclass
> @@ -26,13 +26,14 @@ cpan_do_configure () {
>                        test -f $f2 || continue
>                        sed -i -e "s:\(PERL_ARCHLIB = \).*:\1${PERL_ARCHLIB}:" \
>                                -e 's/perl.real/perl/' \
> +                               -e "s/^\(CCFLAGS =.*\)/\1 ${CFLAGS}/" \
>                                $f2
>                done
>        fi
>  }
>
>  cpan_do_compile () {
> -       oe_runmake PASTHRU_INC="${CFLAGS}" CCFLAGS="${CFLAGS}" LD="${CCLD}"
> +       oe_runmake PASTHRU_INC="${CFLAGS}" LD="${CCLD}"
>  }
>
>  cpan_do_install () {
> --
> 1.7.5.4
>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
xin.ouyang@windriver.com - June 28, 2012, 7:59 a.m.
On 2012?06?21? 23:47, Khem Raj wrote:
> On Thu, Jun 21, 2012 at 12:13 AM,  <xin.ouyang@windriver.com> wrote:
>> From: Xin Ouyang <Xin.Ouyang@windriver.com>
>>
>> We should not just replace CCFLAGS with CFLAGS while compiling, because
>> this may cause run-time errors with perl's DynaLoader.pm.
>>
>> Tested on qemux86 with new libnet-libidn-perl bb recipe:
>
> can you instead try the patch from
>
> http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=19;bug=628522
>
This debian patch takes no effect.

Actually it try to fix this:

Some packages which has those lines in Makefile.PL:
   WriteMakefile(
       ...
       'CCFLAGS'    => 'some cflags',
       ...
   );
While run perl Makefile.PL to configure, there are CCFLAGS="some cflags" 
to override the original CCFLAGS=$Config{ccflags} in generated Makefiles.


In Poky, CCFLAGS in our generated Makefiles are all right.
But when we run oe_runmake CCFLAGS="${CFLAGS}" to do_compile, this will 
override our right CCFLAGS.


- Xin

>>
>> root@qemux86:~# perl -e "use Net::LibIDN"
>> Not a CODE reference at /usr/lib/perl/5.14.2//DynaLoader.pm line 213.
>> END failed--call queue aborted at /usr/lib/perl/vendor_perl/5.14.2//Net/LibIDN.pm line 213.
>> Compilation failed in require at -e line 1.
>> BEGIN failed--compilation aborted at -e line 1.
>>
>> Signed-off-by: Xin Ouyang <Xin.Ouyang@windriver.com>
>> ---
>>   meta/classes/cpan.bbclass |    3 ++-
>>   1 files changed, 2 insertions(+), 1 deletions(-)
>>
>> diff --git a/meta/classes/cpan.bbclass b/meta/classes/cpan.bbclass
>> index 2e9432c..957a6e2 100644
>> --- a/meta/classes/cpan.bbclass
>> +++ b/meta/classes/cpan.bbclass
>> @@ -26,13 +26,14 @@ cpan_do_configure () {
>>                         test -f $f2 || continue
>>                         sed -i -e "s:\(PERL_ARCHLIB = \).*:\1${PERL_ARCHLIB}:" \
>>                                 -e 's/perl.real/perl/' \
>> +                               -e "s/^\(CCFLAGS =.*\)/\1 ${CFLAGS}/" \
>>                                 $f2
>>                 done
>>         fi
>>   }
>>
>>   cpan_do_compile () {
>> -       oe_runmake PASTHRU_INC="${CFLAGS}" CCFLAGS="${CFLAGS}" LD="${CCLD}"
>> +       oe_runmake PASTHRU_INC="${CFLAGS}" LD="${CCLD}"
>>   }
>>
>>   cpan_do_install () {
>> --
>> 1.7.5.4
>>
>>
>> _______________________________________________
>> Openembedded-core mailing list
>> Openembedded-core@lists.openembedded.org
>> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
>
Khem Raj - June 28, 2012, 4:04 p.m.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 6/28/2012 12:59 AM, Pascal Ouyang wrote:
> On 2012?06?21? 23:47, Khem Raj wrote:
>> On Thu, Jun 21, 2012 at 12:13 AM,  <xin.ouyang@windriver.com>
>> wrote:
>>> From: Xin Ouyang <Xin.Ouyang@windriver.com>
>>> 
>>> We should not just replace CCFLAGS with CFLAGS while compiling,
>>> because this may cause run-time errors with perl's
>>> DynaLoader.pm.
>>> 
>>> Tested on qemux86 with new libnet-libidn-perl bb recipe:
>> 
>> can you instead try the patch from
>> 
>> http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=19;bug=628522
>> 
> This debian patch takes no effect.
> 
> Actually it try to fix this:
> 
> Some packages which has those lines in Makefile.PL: WriteMakefile( 
> ... 'CCFLAGS'    => 'some cflags', ... ); While run perl
> Makefile.PL to configure, there are CCFLAGS="some cflags" to
> override the original CCFLAGS=$Config{ccflags} in generated
> Makefiles.
> 
> 
> In Poky, CCFLAGS in our generated Makefiles are all right. But when
> we run oe_runmake CCFLAGS="${CFLAGS}" to do_compile, this will 
> override our right CCFLAGS.

but thats what assign operator is meant to do isnt it ?


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk/sgHwACgkQuwUzVZGdMxSvoACdHtcMLShjJIglhq/KXuE73QIW
7FsAoI/IFxzDXZWX/xLj3tNkDDzdUM++
=MWVl
-----END PGP SIGNATURE-----
xin.ouyang@windriver.com - July 2, 2012, 7:54 a.m.
On 2012?06?29? 00:04, Khem Raj wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 6/28/2012 12:59 AM, Pascal Ouyang wrote:
>> On 2012?06?21? 23:47, Khem Raj wrote:
>>> On Thu, Jun 21, 2012 at 12:13 AM,  <xin.ouyang@windriver.com>
>>> wrote:
>>>> From: Xin Ouyang <Xin.Ouyang@windriver.com>
>>>>
>>>> We should not just replace CCFLAGS with CFLAGS while compiling,
>>>> because this may cause run-time errors with perl's
>>>> DynaLoader.pm.
>>>>
>>>> Tested on qemux86 with new libnet-libidn-perl bb recipe:
>>>
>>> can you instead try the patch from
>>>
>>> http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=19;bug=628522
>>>
>> This debian patch takes no effect.
>>
>> Actually it try to fix this:
>>
>> Some packages which has those lines in Makefile.PL: WriteMakefile(
>> ... 'CCFLAGS'    => 'some cflags', ... ); While run perl
>> Makefile.PL to configure, there are CCFLAGS="some cflags" to
>> override the original CCFLAGS=$Config{ccflags} in generated
>> Makefiles.
>>
>>
>> In Poky, CCFLAGS in our generated Makefiles are all right. But when
>> we run oe_runmake CCFLAGS="${CFLAGS}" to do_compile, this will
>> override our right CCFLAGS.
>
> but thats what assign operator is meant to do isnt it ?
>

But CCFLAGS cannot be overrided by CFLAGS, because original CCFLAGS has 
some -DXXX flags read from the config for perl.
Without these compile flags, the perl modules cannot run correctly.

root@qemux86:~# perl -e "use Net::LibIDN"
...
Compilation failed in require at -e line 1.
BEGIN failed--compilation aborted at -e line 1.

-P

>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.12 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk/sgHwACgkQuwUzVZGdMxSvoACdHtcMLShjJIglhq/KXuE73QIW
> 7FsAoI/IFxzDXZWX/xLj3tNkDDzdUM++
> =MWVl
> -----END PGP SIGNATURE-----
>
xin.ouyang@windriver.com - July 5, 2012, 11:17 a.m.
On 2012?06?29? 00:04, Khem Raj wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 6/28/2012 12:59 AM, Pascal Ouyang wrote:
>> On 2012?06?21? 23:47, Khem Raj wrote:
>>> On Thu, Jun 21, 2012 at 12:13 AM,  <xin.ouyang@windriver.com>
>>> wrote:
>>>> From: Xin Ouyang <Xin.Ouyang@windriver.com>
>>>>
>>>> We should not just replace CCFLAGS with CFLAGS while compiling,
>>>> because this may cause run-time errors with perl's
>>>> DynaLoader.pm.
>>>>
>>>> Tested on qemux86 with new libnet-libidn-perl bb recipe:
>>>
>>> can you instead try the patch from
>>>
>>> http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=19;bug=628522
>>>
>> This debian patch takes no effect.
>>
>> Actually it try to fix this:
>>
>> Some packages which has those lines in Makefile.PL: WriteMakefile(
>> ... 'CCFLAGS'    => 'some cflags', ... ); While run perl
>> Makefile.PL to configure, there are CCFLAGS="some cflags" to
>> override the original CCFLAGS=$Config{ccflags} in generated
>> Makefiles.
>>
>>
>> In Poky, CCFLAGS in our generated Makefiles are all right. But when
>> we run oe_runmake CCFLAGS="${CFLAGS}" to do_compile, this will
>> override our right CCFLAGS.
>
> but thats what assign operator is meant to do isnt it ?
>

Hi Raj,

This is indeed a bug, because all non-pure perl modules(with C codes, 
tested libtext-iconv-perl and libnet-libidn-perl) would fail in running 
time on the 32bit X86 machines with current cpan.bbclass.
And the root cause is CCFLAGS="${CFLAGS}" passed to oe_runmake has 
overrided the CCFLAGS in Makefile.

So, I still don't know what is your opinion of this patch.
Thanks.

- Pascal

>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.12 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk/sgHwACgkQuwUzVZGdMxSvoACdHtcMLShjJIglhq/KXuE73QIW
> 7FsAoI/IFxzDXZWX/xLj3tNkDDzdUM++
> =MWVl
> -----END PGP SIGNATURE-----
>
Khem Raj - July 5, 2012, 2:57 p.m.
On Thu, Jul 5, 2012 at 4:17 AM, Pascal Ouyang <xin.ouyang@windriver.com> wrote:
>
> So, I still don't know what is your opinion of this patch.

I think we still need the CC and CFLAGS to appear in CCFLAGS since
they sometimes decide ABI etc. that we use and without that
the modules will be incompatible. So may be
appending to CCFLAGS would work instead
xin.ouyang@windriver.com - July 6, 2012, 5:33 a.m.
On 2012?07?05? 22:57, Khem Raj wrote:
> On Thu, Jul 5, 2012 at 4:17 AM, Pascal Ouyang <xin.ouyang@windriver.com> wrote:
>>
>> So, I still don't know what is your opinion of this patch.
>
> I think we still need the CC and CFLAGS to appear in CCFLAGS since
> they sometimes decide ABI etc. that we use and without that
> the modules will be incompatible. So may be
> appending to CCFLAGS would work instead
>

Exactly in my patch, this just appends CFLAGS to CCFLAGS.

@@ -26,13 +26,14 @@ cpan_do_configure () {
  			test -f $f2 || continue
  			sed -i -e "s:\(PERL_ARCHLIB = \).*:\1${PERL_ARCHLIB}:" \
  				-e 's/perl.real/perl/' \
+				-e "s/^\(CCFLAGS =.*\)/\1 ${CFLAGS}/" \
  				$f2
  		done
  	fi
  }

Thanks.
Khem Raj - July 6, 2012, 5:39 a.m.
On Thu, Jul 5, 2012 at 10:33 PM, Pascal Ouyang <xin.ouyang@windriver.com> wrote:
> On 2012?07?05? 22:57, Khem Raj wrote:
>>
>> On Thu, Jul 5, 2012 at 4:17 AM, Pascal Ouyang <xin.ouyang@windriver.com>
>> wrote:
>>>
>>>
>>> So, I still don't know what is your opinion of this patch.
>>
>>
>> I think we still need the CC and CFLAGS to appear in CCFLAGS since
>> they sometimes decide ABI etc. that we use and without that
>> the modules will be incompatible. So may be
>> appending to CCFLAGS would work instead
>>
>
> Exactly in my patch, this just appends CFLAGS to CCFLAGS.
>

seems ok I guess

>
> @@ -26,13 +26,14 @@ cpan_do_configure () {
>                         test -f $f2 || continue
>                         sed -i -e "s:\(PERL_ARCHLIB =
> \).*:\1${PERL_ARCHLIB}:" \
>                                 -e 's/perl.real/perl/' \
> +                               -e "s/^\(CCFLAGS =.*\)/\1 ${CFLAGS}/" \
>                                 $f2
>                 done
>         fi
>  }
>
> Thanks.
> --
> - Pascal
>
>
xin.ouyang@windriver.com - July 12, 2012, 6:46 a.m.
Hi Saul,

I have sent this patch for a while. Please merge this if no objections. 
Thanks.

- Pascal

On 2012?07?06? 13:39, Khem Raj wrote:
> On Thu, Jul 5, 2012 at 10:33 PM, Pascal Ouyang <xin.ouyang@windriver.com> wrote:
>> On 2012?07?05? 22:57, Khem Raj wrote:
>>>
>>> On Thu, Jul 5, 2012 at 4:17 AM, Pascal Ouyang <xin.ouyang@windriver.com>
>>> wrote:
>>>>
>>>>
>>>> So, I still don't know what is your opinion of this patch.
>>>
>>>
>>> I think we still need the CC and CFLAGS to appear in CCFLAGS since
>>> they sometimes decide ABI etc. that we use and without that
>>> the modules will be incompatible. So may be
>>> appending to CCFLAGS would work instead
>>>
>>
>> Exactly in my patch, this just appends CFLAGS to CCFLAGS.
>>
>
> seems ok I guess
>
>>
>> @@ -26,13 +26,14 @@ cpan_do_configure () {
>>                          test -f $f2 || continue
>>                          sed -i -e "s:\(PERL_ARCHLIB =
>> \).*:\1${PERL_ARCHLIB}:" \
>>                                  -e 's/perl.real/perl/' \
>> +                               -e "s/^\(CCFLAGS =.*\)/\1 ${CFLAGS}/" \
>>                                  $f2
>>                  done
>>          fi
>>   }
>>
>> Thanks.
>> --
>> - Pascal
>>
>>
Saul Wold - July 17, 2012, 4:16 p.m.
On 06/21/2012 12:13 AM, xin.ouyang@windriver.com wrote:
> From: Xin Ouyang <Xin.Ouyang@windriver.com>
>
> We should not just replace CCFLAGS with CFLAGS while compiling, because
> this may cause run-time errors with perl's DynaLoader.pm.
>
> Tested on qemux86 with new libnet-libidn-perl bb recipe:
>
> root@qemux86:~# perl -e "use Net::LibIDN"
> Not a CODE reference at /usr/lib/perl/5.14.2//DynaLoader.pm line 213.
> END failed--call queue aborted at /usr/lib/perl/vendor_perl/5.14.2//Net/LibIDN.pm line 213.
> Compilation failed in require at -e line 1.
> BEGIN failed--compilation aborted at -e line 1.
>
> Signed-off-by: Xin Ouyang <Xin.Ouyang@windriver.com>
> ---
>   meta/classes/cpan.bbclass |    3 ++-
>   1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/meta/classes/cpan.bbclass b/meta/classes/cpan.bbclass
> index 2e9432c..957a6e2 100644
> --- a/meta/classes/cpan.bbclass
> +++ b/meta/classes/cpan.bbclass
> @@ -26,13 +26,14 @@ cpan_do_configure () {
>   			test -f $f2 || continue
>   			sed -i -e "s:\(PERL_ARCHLIB = \).*:\1${PERL_ARCHLIB}:" \
>   				-e 's/perl.real/perl/' \
> +				-e "s/^\(CCFLAGS =.*\)/\1 ${CFLAGS}/" \
>   				$f2
>   		done
>   	fi
>   }
>
>   cpan_do_compile () {
> -	oe_runmake PASTHRU_INC="${CFLAGS}" CCFLAGS="${CFLAGS}" LD="${CCLD}"
> +	oe_runmake PASTHRU_INC="${CFLAGS}" LD="${CCLD}"
>   }
>
>   cpan_do_install () {
>

Merged into OE-Core

Thanks
	Sau!

Patch

diff --git a/meta/classes/cpan.bbclass b/meta/classes/cpan.bbclass
index 2e9432c..957a6e2 100644
--- a/meta/classes/cpan.bbclass
+++ b/meta/classes/cpan.bbclass
@@ -26,13 +26,14 @@  cpan_do_configure () {
 			test -f $f2 || continue
 			sed -i -e "s:\(PERL_ARCHLIB = \).*:\1${PERL_ARCHLIB}:" \
 				-e 's/perl.real/perl/' \
+				-e "s/^\(CCFLAGS =.*\)/\1 ${CFLAGS}/" \
 				$f2
 		done
 	fi
 }
 
 cpan_do_compile () {
-	oe_runmake PASTHRU_INC="${CFLAGS}" CCFLAGS="${CFLAGS}" LD="${CCLD}"
+	oe_runmake PASTHRU_INC="${CFLAGS}" LD="${CCLD}"
 }
 
 cpan_do_install () {