All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gcc: make sure header path is set correctly
@ 2016-06-14  9:10 Anuj Mittal
  2016-06-16  1:54 ` Mittal, AnujX
  2016-06-16  2:47 ` Khem Raj
  0 siblings, 2 replies; 5+ messages in thread
From: Anuj Mittal @ 2016-06-14  9:10 UTC (permalink / raw)
  To: openembedded-core

We're setting the native header paths in do_configure_prepend,
and don't need to set them again here.

This results in gcc-target not being able to locate the headers
and not being able to detect glibc version, which in turn
results in SSP support not getting detected even though it's available
in libc.

Signed-off-by: Anuj Mittal <anujx.mittal@intel.com>
---
 meta/recipes-devtools/gcc/gcc-target.inc | 1 -
 1 file changed, 1 deletion(-)

diff --git a/meta/recipes-devtools/gcc/gcc-target.inc b/meta/recipes-devtools/gcc/gcc-target.inc
index a960ed4..37c5c62 100644
--- a/meta/recipes-devtools/gcc/gcc-target.inc
+++ b/meta/recipes-devtools/gcc/gcc-target.inc
@@ -4,7 +4,6 @@ require gcc-configure-common.inc
 EXTRA_OECONF_PATHS = "\
     --with-sysroot=/ \
     --with-build-sysroot=${STAGING_DIR_TARGET} \
-    --with-native-system-header-dir=${STAGING_DIR_TARGET}${target_includedir} \
     --with-gxx-include-dir=${includedir}/c++/${BINV} \
 "
 
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] gcc: make sure header path is set correctly
  2016-06-14  9:10 [PATCH] gcc: make sure header path is set correctly Anuj Mittal
@ 2016-06-16  1:54 ` Mittal, AnujX
  2016-06-16  2:47 ` Khem Raj
  1 sibling, 0 replies; 5+ messages in thread
From: Mittal, AnujX @ 2016-06-16  1:54 UTC (permalink / raw)
  To: openembedded-core, Yang, Liezhi (Wind River), akuster808
  Cc: Chang, Rebecca Swee Fun

> -----Original Message-----
> From: Mittal, AnujX
> Sent: Tuesday, June 14, 2016 5:10 PM
> To: openembedded-core@lists.openembedded.org
> Cc: Mittal, AnujX <anujx.mittal@intel.com>
> Subject: [PATCH] gcc: make sure header path is set correctly
> 
> We're setting the native header paths in do_configure_prepend,
> and don't need to set them again here.
> 
> This results in gcc-target not being able to locate the headers
> and not being able to detect glibc version, which in turn
> results in SSP support not getting detected even though it's available
> in libc.
> 
> Signed-off-by: Anuj Mittal <anujx.mittal@intel.com>

Can this be considered for merge to krogoth and Jethro as well? 

Please let me know if I should be sending a separate patch for it.

Thanks,

> ---
>  meta/recipes-devtools/gcc/gcc-target.inc | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/meta/recipes-devtools/gcc/gcc-target.inc b/meta/recipes-
> devtools/gcc/gcc-target.inc
> index a960ed4..37c5c62 100644
> --- a/meta/recipes-devtools/gcc/gcc-target.inc
> +++ b/meta/recipes-devtools/gcc/gcc-target.inc
> @@ -4,7 +4,6 @@ require gcc-configure-common.inc
>  EXTRA_OECONF_PATHS = "\
>      --with-sysroot=/ \
>      --with-build-sysroot=${STAGING_DIR_TARGET} \
> -    --with-native-system-header-
> dir=${STAGING_DIR_TARGET}${target_includedir} \
>      --with-gxx-include-dir=${includedir}/c++/${BINV} \
>  "
> 
> --
> 1.9.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] gcc: make sure header path is set correctly
  2016-06-14  9:10 [PATCH] gcc: make sure header path is set correctly Anuj Mittal
  2016-06-16  1:54 ` Mittal, AnujX
@ 2016-06-16  2:47 ` Khem Raj
  2016-06-16  5:49   ` Mittal, AnujX
  1 sibling, 1 reply; 5+ messages in thread
From: Khem Raj @ 2016-06-16  2:47 UTC (permalink / raw)
  To: Anuj Mittal; +Cc: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 1781 bytes --]


> On Jun 14, 2016, at 2:10 AM, Anuj Mittal <anujx.mittal@intel.com> wrote:
> 
> We're setting the native header paths in do_configure_prepend,
> and don't need to set them again here.
> 
> This results in gcc-target not being able to locate the headers
> and not being able to detect glibc version, which in turn
> results in SSP support not getting detected even though it's available
> in libc.
> 

what is this being set to in do_conigure_prepend ?
that value may not be right for target recipe. For target we are setting sysroot to /
and if we do not have this option set then it will set native-system-headers dir to be
/ relative and not cross sysroot relative. So it will use your build hosts installation
for these headers which is not correct either. Have you looked deeper into why its not
finding ssp support inside the cross sysroot?

> Signed-off-by: Anuj Mittal <anujx.mittal@intel.com>
> ---
> meta/recipes-devtools/gcc/gcc-target.inc | 1 -
> 1 file changed, 1 deletion(-)
> 
> diff --git a/meta/recipes-devtools/gcc/gcc-target.inc b/meta/recipes-devtools/gcc/gcc-target.inc
> index a960ed4..37c5c62 100644
> --- a/meta/recipes-devtools/gcc/gcc-target.inc
> +++ b/meta/recipes-devtools/gcc/gcc-target.inc
> @@ -4,7 +4,6 @@ require gcc-configure-common.inc
> EXTRA_OECONF_PATHS = "\
>     --with-sysroot=/ \
>     --with-build-sysroot=${STAGING_DIR_TARGET} \
> -    --with-native-system-header-dir=${STAGING_DIR_TARGET}${target_includedir} \
>     --with-gxx-include-dir=${includedir}/c++/${BINV} \
> "
> 
> --
> 1.9.1
> 
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core


[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 211 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] gcc: make sure header path is set correctly
  2016-06-16  2:47 ` Khem Raj
@ 2016-06-16  5:49   ` Mittal, AnujX
  2016-06-16 14:34     ` Khem Raj
  0 siblings, 1 reply; 5+ messages in thread
From: Mittal, AnujX @ 2016-06-16  5:49 UTC (permalink / raw)
  To: 'Khem Raj'; +Cc: openembedded-core



> -----Original Message-----
> From: Khem Raj [mailto:raj.khem@gmail.com]
> Sent: Thursday, June 16, 2016 10:47 AM
> To: Mittal, AnujX <anujx.mittal@intel.com>
> Cc: openembedded-core@lists.openembedded.org
> Subject: Re: [OE-core] [PATCH] gcc: make sure header path is set correctly
> 
> 
> > On Jun 14, 2016, at 2:10 AM, Anuj Mittal <anujx.mittal@intel.com> wrote:
> >
> > We're setting the native header paths in do_configure_prepend,
> > and don't need to set them again here.
> >
> > This results in gcc-target not being able to locate the headers
> > and not being able to detect glibc version, which in turn
> > results in SSP support not getting detected even though it's available
> > in libc.
> >
> 
> what is this being set to in do_conigure_prepend ?
> that value may not be right for target recipe. For target we are setting sysroot to /
> and if we do not have this option set then it will set native-system-headers dir to
> be
> / relative and not cross sysroot relative. So it will use your build hosts installation
> for these headers which is not correct either. Have you looked deeper into why its
> not
> finding ssp support inside the cross sysroot?

It's being set to /usr/include:

	# teach gcc to find correct target includedir when checking libc ssp support
	mkdir -p ${B}/gcc
	echo "NATIVE_SYSTEM_HEADER_DIR = ${SYSTEMHEADERS}" > ${B}/gcc/t-oe
	cat ${S}/gcc/defaults.h | grep -v "\#endif.*GCC_DEFAULTS_H" > ${B}/gcc/defaults.h.new
	cat >>${B}/gcc/defaults.h.new <<_EOF
#define NATIVE_SYSTEM_HEADER_DIR "${SYSTEMHEADERS}"
#define STANDARD_STARTFILE_PREFIX_1 "${SYSTEMLIBS}"
#define STANDARD_STARTFILE_PREFIX_2 "${SYSTEMLIBS1}"
#define SYSTEMLIBS_DIR "${SYSTEMLIBS}"
#endif /* ! GCC_DEFAULTS_H */
_EOF
	mv ${B}/gcc/defaults.h.new ${B}/gcc/defaults.h

Having set NATIVE_SYSTEM_HEADER_DIR again in gcc-target just results in gcc not being able to find features.h at all, which is present in the target sysroot.

Because it's not able to find features.h, it just assumes that glibc version available is 0 and hence disables ssp support. Setting NATIVE_SYSTEM_HEADER_DIR to /usr/include just makes sure that target_system_dir in configure script is set to right header path within target sysroot & it can pick up the right header relative to the sysroot.

When configure option is passed, gcc detects target_system_dir (where features.h is present) to be <build_sysroot>/<build_sysroot>/usr/include instead of <build_sysroot>/usr/include.

I've made sure that its picking up the header from target sysroot rather than my host. My host machine has glibc 2.19 whereas the target sysroot has 2.22

Thanks,
Anuj


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] gcc: make sure header path is set correctly
  2016-06-16  5:49   ` Mittal, AnujX
@ 2016-06-16 14:34     ` Khem Raj
  0 siblings, 0 replies; 5+ messages in thread
From: Khem Raj @ 2016-06-16 14:34 UTC (permalink / raw)
  To: Mittal, AnujX; +Cc: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 3077 bytes --]


> On Jun 15, 2016, at 10:49 PM, Mittal, AnujX <anujx.mittal@intel.com> wrote:
> 
> 
> 
>> -----Original Message-----
>> From: Khem Raj [mailto:raj.khem@gmail.com]
>> Sent: Thursday, June 16, 2016 10:47 AM
>> To: Mittal, AnujX <anujx.mittal@intel.com>
>> Cc: openembedded-core@lists.openembedded.org
>> Subject: Re: [OE-core] [PATCH] gcc: make sure header path is set correctly
>> 
>> 
>>> On Jun 14, 2016, at 2:10 AM, Anuj Mittal <anujx.mittal@intel.com> wrote:
>>> 
>>> We're setting the native header paths in do_configure_prepend,
>>> and don't need to set them again here.
>>> 
>>> This results in gcc-target not being able to locate the headers
>>> and not being able to detect glibc version, which in turn
>>> results in SSP support not getting detected even though it's available
>>> in libc.
>>> 
>> 
>> what is this being set to in do_conigure_prepend ?
>> that value may not be right for target recipe. For target we are setting sysroot to /
>> and if we do not have this option set then it will set native-system-headers dir to
>> be
>> / relative and not cross sysroot relative. So it will use your build hosts installation
>> for these headers which is not correct either. Have you looked deeper into why its
>> not
>> finding ssp support inside the cross sysroot?
> 
> It's being set to /usr/include:
> 
> 	# teach gcc to find correct target includedir when checking libc ssp support
> 	mkdir -p ${B}/gcc
> 	echo "NATIVE_SYSTEM_HEADER_DIR = ${SYSTEMHEADERS}" > ${B}/gcc/t-oe
> 	cat ${S}/gcc/defaults.h | grep -v "\#endif.*GCC_DEFAULTS_H" > ${B}/gcc/defaults.h.new
> 	cat >>${B}/gcc/defaults.h.new <<_EOF
> #define NATIVE_SYSTEM_HEADER_DIR "${SYSTEMHEADERS}"
> #define STANDARD_STARTFILE_PREFIX_1 "${SYSTEMLIBS}"
> #define STANDARD_STARTFILE_PREFIX_2 "${SYSTEMLIBS1}"
> #define SYSTEMLIBS_DIR "${SYSTEMLIBS}"
> #endif /* ! GCC_DEFAULTS_H */
> _EOF
> 	mv ${B}/gcc/defaults.h.new ${B}/gcc/defaults.h

ah yes thats the caveat which invalidates the definition of this configure option for OE. In this case the patch
is ok. Although, I would like to know what would be downside of not forcing NATIVE_SYSTEM_HEADER_DIR via t-oe

> 
> Having set NATIVE_SYSTEM_HEADER_DIR again in gcc-target just results in gcc not being able to find features.h at all, which is present in the target sysroot.
> 
> Because it's not able to find features.h, it just assumes that glibc version available is 0 and hence disables ssp support. Setting NATIVE_SYSTEM_HEADER_DIR to /usr/include just makes sure that target_system_dir in configure script is set to right header path within target sysroot & it can pick up the right header relative to the sysroot.
> 
> When configure option is passed, gcc detects target_system_dir (where features.h is present) to be <build_sysroot>/<build_sysroot>/usr/include instead of <build_sysroot>/usr/include.
> 
> I've made sure that its picking up the header from target sysroot rather than my host. My host machine has glibc 2.19 whereas the target sysroot has 2.22
> 
> Thanks,
> Anuj


[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 211 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-06-16 14:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-14  9:10 [PATCH] gcc: make sure header path is set correctly Anuj Mittal
2016-06-16  1:54 ` Mittal, AnujX
2016-06-16  2:47 ` Khem Raj
2016-06-16  5:49   ` Mittal, AnujX
2016-06-16 14:34     ` Khem Raj

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.