Patchwork [1/1] libgcrypt: fix compile error with '-O2' in sysroot path

login
register
mail settings
Submitter Qi.Chen@windriver.com
Date Dec. 5, 2013, 8:55 a.m.
Message ID <f728bc59095fc51372c8771356ca7fef2ed71bb5.1386232830.git.Qi.Chen@windriver.com>
Download mbox | patch
Permalink /patch/62887/
State New
Headers show

Comments

Qi.Chen@windriver.com - Dec. 5, 2013, 8:55 a.m.
From: Chen Qi <Qi.Chen@windriver.com>

Characters like '-O2' or '-Ofast' will be replaced by '-O1' when
compiling cipher. If we are cross compiling libgcrypt and sysroot
contains such characters, we would get compile errors because the
sysroot path has been modified.

Fix this by adding whitespaces before and after the original matching
pattern in the sed command.

[YOCTO #5628]

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 ...fix-compile-error-with-O2-in-sysroot-path.patch |   46 ++++++++++++++++++++
 meta/recipes-support/libgcrypt/libgcrypt.inc       |    3 +-
 2 files changed, 48 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-support/libgcrypt/files/fix-compile-error-with-O2-in-sysroot-path.patch
Saul Wold - Dec. 5, 2013, 10:41 p.m.
On 12/05/2013 12:55 AM, Qi.Chen@windriver.com wrote:
> From: Chen Qi <Qi.Chen@windriver.com>
>
> Characters like '-O2' or '-Ofast' will be replaced by '-O1' when
> compiling cipher. If we are cross compiling libgcrypt and sysroot
> contains such characters, we would get compile errors because the
> sysroot path has been modified.
>
> Fix this by adding whitespaces before and after the original matching
> pattern in the sed command.
>
> [YOCTO #5628]
>
> Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
> ---
>   ...fix-compile-error-with-O2-in-sysroot-path.patch |   46 ++++++++++++++++++++
>   meta/recipes-support/libgcrypt/libgcrypt.inc       |    3 +-
>   2 files changed, 48 insertions(+), 1 deletion(-)
>   create mode 100644 meta/recipes-support/libgcrypt/files/fix-compile-error-with-O2-in-sysroot-path.patch
>
> diff --git a/meta/recipes-support/libgcrypt/files/fix-compile-error-with-O2-in-sysroot-path.patch b/meta/recipes-support/libgcrypt/files/fix-compile-error-with-O2-in-sysroot-path.patch
> new file mode 100644
> index 0000000..6b1f119
> --- /dev/null
> +++ b/meta/recipes-support/libgcrypt/files/fix-compile-error-with-O2-in-sysroot-path.patch
> @@ -0,0 +1,46 @@
> +Upstream-Status: Pending
> +
> +libgcrypt: fix building error with '-O2' in sysroot path
> +
> +Characters like '-O2' or '-Ofast' will be replaced by '-O1' when compiling cipher.
> +If we are cross compiling libgcrypt and sysroot contains such characters, we would
> +get compile errors because the sysroot path has been modified.
> +
> +Fix this by adding blank spaces before and after the original matching pattern in the
> +sed command.
> +
> +Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
> +---
> + cipher/Makefile.am |    2 +-
> + cipher/Makefile.in |    2 +-
> + 2 files changed, 2 insertions(+), 2 deletions(-)
> +
> +diff --git a/cipher/Makefile.am b/cipher/Makefile.am
> +index 76cdc96..9a89792 100644
> +--- a/cipher/Makefile.am
> ++++ b/cipher/Makefile.am
> +@@ -69,7 +69,7 @@ rfc2268.c \
> + camellia.c camellia.h camellia-glue.c
> +
> + if ENABLE_O_FLAG_MUNGING
> +-o_flag_munging = sed -e 's/-O\([2-9s][2-9s]*\)/-O1/' -e 's/-Ofast/-O1/g'
> ++o_flag_munging = sed -e 's/ -O\([2-9s][2-9s]*\) / -O1 /' -e 's/ -Ofast / -O1 /g'
> + else
> + o_flag_munging = cat
> + endif
> +diff --git a/cipher/Makefile.in b/cipher/Makefile.in
> +index 1394d15..6080d59 100644
> +--- a/cipher/Makefile.in
> ++++ b/cipher/Makefile.in

Why do we need to patch Makefile.in if we are already patching the 
Makefile.am which will re-generate the Makefile.in

Sau!

> +@@ -314,7 +314,7 @@ rfc2268.c \
> + camellia.c camellia.h camellia-glue.c
> +
> + @ENABLE_O_FLAG_MUNGING_FALSE@o_flag_munging = cat
> +-@ENABLE_O_FLAG_MUNGING_TRUE@o_flag_munging = sed -e 's/-O\([2-9s][2-9s]*\)/-O1/' -e 's/-Ofast/-O1/g'
> ++@ENABLE_O_FLAG_MUNGING_TRUE@o_flag_munging = sed -e 's/ -O\([2-9s][2-9s]*\) / -O1 /' -e 's/ -Ofast / -O1 /g'
> + all: all-am
> +
> + .SUFFIXES:
> +--
> +1.7.9.5
> +
> diff --git a/meta/recipes-support/libgcrypt/libgcrypt.inc b/meta/recipes-support/libgcrypt/libgcrypt.inc
> index e0dfec2..9383e17 100644
> --- a/meta/recipes-support/libgcrypt/libgcrypt.inc
> +++ b/meta/recipes-support/libgcrypt/libgcrypt.inc
> @@ -11,7 +11,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \
>   DEPENDS = "libgpg-error libcap"
>
>   SRC_URI = "ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-${PV}.tar.gz \
> -           file://add-pkgconfig-support.patch"
> +           file://add-pkgconfig-support.patch \
> +           file://fix-compile-error-with-O2-in-sysroot-path.patch"
>
>   inherit autotools binconfig pkgconfig
>
>
Qi.Chen@windriver.com - Dec. 6, 2013, 1:30 a.m.
On 12/06/2013 06:41 AM, Saul Wold wrote:
> On 12/05/2013 12:55 AM, Qi.Chen@windriver.com wrote:
>> From: Chen Qi <Qi.Chen@windriver.com>
>>
>> Characters like '-O2' or '-Ofast' will be replaced by '-O1' when
>> compiling cipher. If we are cross compiling libgcrypt and sysroot
>> contains such characters, we would get compile errors because the
>> sysroot path has been modified.
>>
>> Fix this by adding whitespaces before and after the original matching
>> pattern in the sed command.
>>
>> [YOCTO #5628]
>>
>> Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
>> ---
>>   ...fix-compile-error-with-O2-in-sysroot-path.patch |   46 
>> ++++++++++++++++++++
>>   meta/recipes-support/libgcrypt/libgcrypt.inc       |    3 +-
>>   2 files changed, 48 insertions(+), 1 deletion(-)
>>   create mode 100644 
>> meta/recipes-support/libgcrypt/files/fix-compile-error-with-O2-in-sysroot-path.patch
>>
>> diff --git 
>> a/meta/recipes-support/libgcrypt/files/fix-compile-error-with-O2-in-sysroot-path.patch 
>> b/meta/recipes-support/libgcrypt/files/fix-compile-error-with-O2-in-sysroot-path.patch 
>>
>> new file mode 100644
>> index 0000000..6b1f119
>> --- /dev/null
>> +++ 
>> b/meta/recipes-support/libgcrypt/files/fix-compile-error-with-O2-in-sysroot-path.patch
>> @@ -0,0 +1,46 @@
>> +Upstream-Status: Pending
>> +
>> +libgcrypt: fix building error with '-O2' in sysroot path
>> +
>> +Characters like '-O2' or '-Ofast' will be replaced by '-O1' when 
>> compiling cipher.
>> +If we are cross compiling libgcrypt and sysroot contains such 
>> characters, we would
>> +get compile errors because the sysroot path has been modified.
>> +
>> +Fix this by adding blank spaces before and after the original 
>> matching pattern in the
>> +sed command.
>> +
>> +Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
>> +---
>> + cipher/Makefile.am |    2 +-
>> + cipher/Makefile.in |    2 +-
>> + 2 files changed, 2 insertions(+), 2 deletions(-)
>> +
>> +diff --git a/cipher/Makefile.am b/cipher/Makefile.am
>> +index 76cdc96..9a89792 100644
>> +--- a/cipher/Makefile.am
>> ++++ b/cipher/Makefile.am
>> +@@ -69,7 +69,7 @@ rfc2268.c \
>> + camellia.c camellia.h camellia-glue.c
>> +
>> + if ENABLE_O_FLAG_MUNGING
>> +-o_flag_munging = sed -e 's/-O\([2-9s][2-9s]*\)/-O1/' -e 
>> 's/-Ofast/-O1/g'
>> ++o_flag_munging = sed -e 's/ -O\([2-9s][2-9s]*\) / -O1 /' -e 's/ 
>> -Ofast / -O1 /g'
>> + else
>> + o_flag_munging = cat
>> + endif
>> +diff --git a/cipher/Makefile.in b/cipher/Makefile.in
>> +index 1394d15..6080d59 100644
>> +--- a/cipher/Makefile.in
>> ++++ b/cipher/Makefile.in
>
> Why do we need to patch Makefile.in if we are already patching the 
> Makefile.am which will re-generate the Makefile.in
>
> Sau!
>

I thought it would do no harm. And I will send this patch to upstream, 
so it might be a little strange that I only modify the Makefile.am file 
even if Makefile.in has the same problem.

Best Regards,
Chen Qi

>> +@@ -314,7 +314,7 @@ rfc2268.c \
>> + camellia.c camellia.h camellia-glue.c
>> +
>> + @ENABLE_O_FLAG_MUNGING_FALSE@o_flag_munging = cat
>> +-@ENABLE_O_FLAG_MUNGING_TRUE@o_flag_munging = sed -e 
>> 's/-O\([2-9s][2-9s]*\)/-O1/' -e 's/-Ofast/-O1/g'
>> ++@ENABLE_O_FLAG_MUNGING_TRUE@o_flag_munging = sed -e 's/ 
>> -O\([2-9s][2-9s]*\) / -O1 /' -e 's/ -Ofast / -O1 /g'
>> + all: all-am
>> +
>> + .SUFFIXES:
>> +--
>> +1.7.9.5
>> +
>> diff --git a/meta/recipes-support/libgcrypt/libgcrypt.inc 
>> b/meta/recipes-support/libgcrypt/libgcrypt.inc
>> index e0dfec2..9383e17 100644
>> --- a/meta/recipes-support/libgcrypt/libgcrypt.inc
>> +++ b/meta/recipes-support/libgcrypt/libgcrypt.inc
>> @@ -11,7 +11,8 @@ LIC_FILES_CHKSUM = 
>> "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \
>>   DEPENDS = "libgpg-error libcap"
>>
>>   SRC_URI = 
>> "ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-${PV}.tar.gz \
>> -           file://add-pkgconfig-support.patch"
>> +           file://add-pkgconfig-support.patch \
>> + file://fix-compile-error-with-O2-in-sysroot-path.patch"
>>
>>   inherit autotools binconfig pkgconfig
>>
>>
>
>
Richard Purdie - Dec. 10, 2013, 11:37 a.m.
On Fri, 2013-12-06 at 09:30 +0800, ChenQi wrote:
> On 12/06/2013 06:41 AM, Saul Wold wrote:
> > On 12/05/2013 12:55 AM, Qi.Chen@windriver.com wrote:
> >> From: Chen Qi <Qi.Chen@windriver.com>
> >>
> >> Characters like '-O2' or '-Ofast' will be replaced by '-O1' when
> >> compiling cipher. If we are cross compiling libgcrypt and sysroot
> >> contains such characters, we would get compile errors because the
> >> sysroot path has been modified.
> >>
> >> Fix this by adding whitespaces before and after the original matching
> >> pattern in the sed command.
> >>
> >> [YOCTO #5628]
> >>
> >> Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
> >> ---
> >>   ...fix-compile-error-with-O2-in-sysroot-path.patch |   46 
> >> ++++++++++++++++++++
> >>   meta/recipes-support/libgcrypt/libgcrypt.inc       |    3 +-
> >>   2 files changed, 48 insertions(+), 1 deletion(-)
> >>   create mode 100644 
> >> meta/recipes-support/libgcrypt/files/fix-compile-error-with-O2-in-sysroot-path.patch
> >>
> >> diff --git 
> >> a/meta/recipes-support/libgcrypt/files/fix-compile-error-with-O2-in-sysroot-path.patch 
> >> b/meta/recipes-support/libgcrypt/files/fix-compile-error-with-O2-in-sysroot-path.patch 
> >>
> >> new file mode 100644
> >> index 0000000..6b1f119
> >> --- /dev/null
> >> +++ 
> >> b/meta/recipes-support/libgcrypt/files/fix-compile-error-with-O2-in-sysroot-path.patch
> >> @@ -0,0 +1,46 @@
> >> +Upstream-Status: Pending
> >> +
> >> +libgcrypt: fix building error with '-O2' in sysroot path
> >> +
> >> +Characters like '-O2' or '-Ofast' will be replaced by '-O1' when 
> >> compiling cipher.
> >> +If we are cross compiling libgcrypt and sysroot contains such 
> >> characters, we would
> >> +get compile errors because the sysroot path has been modified.
> >> +
> >> +Fix this by adding blank spaces before and after the original 
> >> matching pattern in the
> >> +sed command.
> >> +
> >> +Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
> >> +---
> >> + cipher/Makefile.am |    2 +-
> >> + cipher/Makefile.in |    2 +-
> >> + 2 files changed, 2 insertions(+), 2 deletions(-)
> >> +
> >> +diff --git a/cipher/Makefile.am b/cipher/Makefile.am
> >> +index 76cdc96..9a89792 100644
> >> +--- a/cipher/Makefile.am
> >> ++++ b/cipher/Makefile.am
> >> +@@ -69,7 +69,7 @@ rfc2268.c \
> >> + camellia.c camellia.h camellia-glue.c
> >> +
> >> + if ENABLE_O_FLAG_MUNGING
> >> +-o_flag_munging = sed -e 's/-O\([2-9s][2-9s]*\)/-O1/' -e 
> >> 's/-Ofast/-O1/g'
> >> ++o_flag_munging = sed -e 's/ -O\([2-9s][2-9s]*\) / -O1 /' -e 's/ 
> >> -Ofast / -O1 /g'
> >> + else
> >> + o_flag_munging = cat
> >> + endif
> >> +diff --git a/cipher/Makefile.in b/cipher/Makefile.in
> >> +index 1394d15..6080d59 100644
> >> +--- a/cipher/Makefile.in
> >> ++++ b/cipher/Makefile.in
> >
> > Why do we need to patch Makefile.in if we are already patching the 
> > Makefile.am which will re-generate the Makefile.in
> >
> > Sau!
> >
> 
> I thought it would do no harm. And I will send this patch to upstream, 
> so it might be a little strange that I only modify the Makefile.am file 
> even if Makefile.in has the same problem.

It can actually be harmful since the modification time of Makefile.in
can be after the time for Makefile.am and things can go "very wrong"
with autotools when that happens :(

Cheers,

Richard
Ross Burton - Dec. 10, 2013, 11:40 a.m.
On 10 December 2013 11:37, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
>> I thought it would do no harm. And I will send this patch to upstream,
>> so it might be a little strange that I only modify the Makefile.am file
>> even if Makefile.in has the same problem.
>
> It can actually be harmful since the modification time of Makefile.in
> can be after the time for Makefile.am and things can go "very wrong"
> with autotools when that happens :(

Another good reason not to modify the Makefile.in is that being a
generated file, updating automake can change how it is generated, so
the patch doesn't apply anymore.

Ross
Qi.Chen@windriver.com - Dec. 11, 2013, 2:59 a.m.
On 12/10/2013 07:40 PM, Burton, Ross wrote:
> On 10 December 2013 11:37, Richard Purdie
> <richard.purdie@linuxfoundation.org> wrote:
>>> I thought it would do no harm. And I will send this patch to upstream,
>>> so it might be a little strange that I only modify the Makefile.am file
>>> even if Makefile.in has the same problem.
>> It can actually be harmful since the modification time of Makefile.in
>> can be after the time for Makefile.am and things can go "very wrong"
>> with autotools when that happens :(
> Another good reason not to modify the Makefile.in is that being a
> generated file, updating automake can change how it is generated, so
> the patch doesn't apply anymore.
>
> Ross
>
>

Hi All,

Thanks for your explanation. I'll send out a V2.

Best Regards,
Chen Qi

Patch

diff --git a/meta/recipes-support/libgcrypt/files/fix-compile-error-with-O2-in-sysroot-path.patch b/meta/recipes-support/libgcrypt/files/fix-compile-error-with-O2-in-sysroot-path.patch
new file mode 100644
index 0000000..6b1f119
--- /dev/null
+++ b/meta/recipes-support/libgcrypt/files/fix-compile-error-with-O2-in-sysroot-path.patch
@@ -0,0 +1,46 @@ 
+Upstream-Status: Pending
+
+libgcrypt: fix building error with '-O2' in sysroot path
+
+Characters like '-O2' or '-Ofast' will be replaced by '-O1' when compiling cipher.
+If we are cross compiling libgcrypt and sysroot contains such characters, we would
+get compile errors because the sysroot path has been modified.
+
+Fix this by adding blank spaces before and after the original matching pattern in the
+sed command.
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ cipher/Makefile.am |    2 +-
+ cipher/Makefile.in |    2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/cipher/Makefile.am b/cipher/Makefile.am
+index 76cdc96..9a89792 100644
+--- a/cipher/Makefile.am
++++ b/cipher/Makefile.am
+@@ -69,7 +69,7 @@ rfc2268.c \
+ camellia.c camellia.h camellia-glue.c
+ 
+ if ENABLE_O_FLAG_MUNGING
+-o_flag_munging = sed -e 's/-O\([2-9s][2-9s]*\)/-O1/' -e 's/-Ofast/-O1/g'
++o_flag_munging = sed -e 's/ -O\([2-9s][2-9s]*\) / -O1 /' -e 's/ -Ofast / -O1 /g'
+ else
+ o_flag_munging = cat
+ endif
+diff --git a/cipher/Makefile.in b/cipher/Makefile.in
+index 1394d15..6080d59 100644
+--- a/cipher/Makefile.in
++++ b/cipher/Makefile.in
+@@ -314,7 +314,7 @@ rfc2268.c \
+ camellia.c camellia.h camellia-glue.c
+ 
+ @ENABLE_O_FLAG_MUNGING_FALSE@o_flag_munging = cat
+-@ENABLE_O_FLAG_MUNGING_TRUE@o_flag_munging = sed -e 's/-O\([2-9s][2-9s]*\)/-O1/' -e 's/-Ofast/-O1/g'
++@ENABLE_O_FLAG_MUNGING_TRUE@o_flag_munging = sed -e 's/ -O\([2-9s][2-9s]*\) / -O1 /' -e 's/ -Ofast / -O1 /g'
+ all: all-am
+ 
+ .SUFFIXES:
+-- 
+1.7.9.5
+
diff --git a/meta/recipes-support/libgcrypt/libgcrypt.inc b/meta/recipes-support/libgcrypt/libgcrypt.inc
index e0dfec2..9383e17 100644
--- a/meta/recipes-support/libgcrypt/libgcrypt.inc
+++ b/meta/recipes-support/libgcrypt/libgcrypt.inc
@@ -11,7 +11,8 @@  LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \
 DEPENDS = "libgpg-error libcap"
 
 SRC_URI = "ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-${PV}.tar.gz \
-           file://add-pkgconfig-support.patch"
+           file://add-pkgconfig-support.patch \
+           file://fix-compile-error-with-O2-in-sysroot-path.patch"
 
 inherit autotools binconfig pkgconfig