All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] glibc: Support building with 2.6.32 kernels on x86 / x86_64
@ 2017-03-28 18:57 Serhii Popovych
  2017-03-28 22:26 ` Richard Purdie
  2017-03-29  0:03 ` Khem Raj
  0 siblings, 2 replies; 8+ messages in thread
From: Serhii Popovych @ 2017-03-28 18:57 UTC (permalink / raw)
  To: openembedded-core; +Cc: XE-Linux

While glibc states that 2.6.32 kernels still supported
for x86 / x86_64 builds are failing due to out of date
LIBC_LINUX_VERSION macro checks for such architectures.

This macro statically defined to 3.2.0 with commit 5b4ecd3
(Require Linux 3.2 except on x86 / x86_64, 3.2 headers everywhere.)
and additionally checked before --enable-kernel.

Since both --enable-kernel and LIBC_LINUX_VERSION checks
are the same and there is no users of last one we can
safely get rid of it enabling glibc builds with 2.6.32
kernel headers.

Also add --enable-kernel to glibc-initial build so that we
build it correctly with old headers.

Cc: XE-Linux <xe-linux-external@cisco.com>
Signed-off-by: Serhii Popovych <spopovyc@cisco.com>
---
 meta/recipes-core/glibc/glibc-initial.inc          |   1 +
 .../glibc/0028-Kill-LIBC_LINUX_VERSION-macro.patch | 113 +++++++++++++++++++++
 meta/recipes-core/glibc/glibc_2.25.bb              |   1 +
 3 files changed, 115 insertions(+)
 create mode 100644 meta/recipes-core/glibc/glibc/0028-Kill-LIBC_LINUX_VERSION-macro.patch

diff --git a/meta/recipes-core/glibc/glibc-initial.inc b/meta/recipes-core/glibc/glibc-initial.inc
index f94603c..60b25dd 100644
--- a/meta/recipes-core/glibc/glibc-initial.inc
+++ b/meta/recipes-core/glibc/glibc-initial.inc
@@ -12,6 +12,7 @@ do_configure () {
 	find ${S} -name "configure" | xargs touch
 	cfgscript=`python3 -c "import os; print(os.path.relpath('${S}', '.'))"`/configure
 	$cfgscript --host=${TARGET_SYS} --build=${BUILD_SYS} \
+		--enable-kernel=${OLDEST_KERNEL} \
 		--prefix=/usr \
 		--without-cvs --disable-sanity-checks \
 		--with-headers=${STAGING_DIR_TARGET}${includedir} \
diff --git a/meta/recipes-core/glibc/glibc/0028-Kill-LIBC_LINUX_VERSION-macro.patch b/meta/recipes-core/glibc/glibc/0028-Kill-LIBC_LINUX_VERSION-macro.patch
new file mode 100644
index 0000000..f5eaf1c
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0028-Kill-LIBC_LINUX_VERSION-macro.patch
@@ -0,0 +1,113 @@
+From 88f83e4b5a8929dac9095ed264700fcb62d5e4dd Mon Sep 17 00:00:00 2001
+From: Serhii Popovych <spopovyc@cisco.com>
+Date: Fri, 17 Mar 2017 15:48:34 +0000
+Subject: Kill LIBC_LINUX_VERSION macro
+
+After commit 5b4ecd3 (Require Linux 3.2 except on x86 / x86_64,
+3.2 headers everywhere.) minimal kernel version raised from
+2.6.32 to 3.2.0 for all architectures except x86 and x86_64
+unless newer already used for architecture.
+
+However LIBC_LINUX_VERSION macro still is in effect and fails
+configure even with --enable-kernel=2.6.32.
+
+While it is present in configure.ac it does not affect anything
+except LINUX_VERSION_CODE check which already performed by
+--enable-kernel.
+
+Upstream-Status: Pending
+Signed-off-by: Serhii Popovych <spopovyc@cisco.com>
+---
+ sysdeps/unix/sysv/linux/configure    | 39 ------------------------------------
+ sysdeps/unix/sysv/linux/configure.ac | 21 -------------------
+ 2 files changed, 60 deletions(-)
+
+diff --git a/sysdeps/unix/sysv/linux/configure b/sysdeps/unix/sysv/linux/configure
+index cace758..ab5fabe 100644
+--- a/sysdeps/unix/sysv/linux/configure
++++ b/sysdeps/unix/sysv/linux/configure
+@@ -6,45 +6,6 @@ if test -n "$sysheaders"; then
+   CPPFLAGS="$CPPFLAGS $SYSINCLUDES"
+ fi
+ 
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking installed Linux kernel header files" >&5
+-$as_echo_n "checking installed Linux kernel header files... " >&6; }
+-if ${libc_cv_linux320+:} false; then :
+-  $as_echo_n "(cached) " >&6
+-else
+-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h.  */
+-#include <linux/version.h>
+-#if !defined LINUX_VERSION_CODE || LINUX_VERSION_CODE <  (3 *65536+ 2 *256+ 0) /* 3.2.0 */
+-# error kernel headers missing or too old
+-#endif
+-int
+-main ()
+-{
+-
+-  ;
+-  return 0;
+-}
+-_ACEOF
+-if ac_fn_c_try_compile "$LINENO"; then :
+-  libc_cv_linux320='3.2.0 or later'
+-else
+-  libc_cv_linux320='missing or too old!'
+-fi
+-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+-fi
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_linux320" >&5
+-$as_echo "$libc_cv_linux320" >&6; }
+-if test "$libc_cv_linux320" != '3.2.0 or later'; then
+-  as_fn_error $? "GNU libc requires kernel header files from
+-Linux 3.2.0 or later to be installed before configuring.
+-The kernel header files are found usually in /usr/include/asm and
+-/usr/include/linux; make sure these directories use files from
+-Linux 3.2.0 or later.  This check uses <linux/version.h>, so
+-make sure that file was built correctly when installing the kernel header
+-files.  To use kernel headers not from /usr/include/linux, use the
+-configure option --with-headers." "$LINENO" 5
+-fi
+-
+ # If the user gave a minimal version number test whether the available
+ # kernel headers are young enough.  Additionally we have minimal
+ # kernel versions for some architectures.  If a previous configure fragment
+diff --git a/sysdeps/unix/sysv/linux/configure.ac b/sysdeps/unix/sysv/linux/configure.ac
+index 13abda0..5b47db5 100644
+--- a/sysdeps/unix/sysv/linux/configure.ac
++++ b/sysdeps/unix/sysv/linux/configure.ac
+@@ -1,31 +1,10 @@
+ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+ # Local configure fragment for sysdeps/unix/sysv/linux.
+ 
+-define([LIBC_LINUX_VERSION],[3.2.0])dnl
+ if test -n "$sysheaders"; then
+   OLD_CPPFLAGS=$CPPFLAGS
+   CPPFLAGS="$CPPFLAGS $SYSINCLUDES"
+ fi
+-define([libc_cv_linuxVER], [libc_cv_linux]patsubst(LIBC_LINUX_VERSION,[\.]))dnl
+-AC_CACHE_CHECK(installed Linux kernel header files, libc_cv_linuxVER, [dnl
+-AC_TRY_COMPILE([#include <linux/version.h>
+-#if !defined LINUX_VERSION_CODE || LINUX_VERSION_CODE < ]dnl
+-patsubst(LIBC_LINUX_VERSION,[^\([^.]*\)\.\([^.]*\)\.\([^.]*\)$],dnl
+-[ (\1 *65536+ \2 *256+ \3) /* \1.\2.\3 */])[
+-# error kernel headers missing or too old
+-#endif], [],
+-	       [libc_cv_linuxVER='LIBC_LINUX_VERSION or later'],
+-	       [libc_cv_linuxVER='missing or too old!'])])
+-if test "$libc_cv_linuxVER" != 'LIBC_LINUX_VERSION or later'; then
+-  AC_MSG_ERROR([GNU libc requires kernel header files from
+-Linux LIBC_LINUX_VERSION or later to be installed before configuring.
+-The kernel header files are found usually in /usr/include/asm and
+-/usr/include/linux; make sure these directories use files from
+-Linux LIBC_LINUX_VERSION or later.  This check uses <linux/version.h>, so
+-make sure that file was built correctly when installing the kernel header
+-files.  To use kernel headers not from /usr/include/linux, use the
+-configure option --with-headers.])
+-fi
+ 
+ # If the user gave a minimal version number test whether the available
+ # kernel headers are young enough.  Additionally we have minimal
+-- 
+2.7.4
+
diff --git a/meta/recipes-core/glibc/glibc_2.25.bb b/meta/recipes-core/glibc/glibc_2.25.bb
index cf9c4f7..869d023 100644
--- a/meta/recipes-core/glibc/glibc_2.25.bb
+++ b/meta/recipes-core/glibc/glibc_2.25.bb
@@ -42,6 +42,7 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
            file://0025-Define-DUMMY_LOCALE_T-if-not-defined.patch \
            file://0026-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch \
            file://0027-locale-fix-hard-coded-reference-to-gcc-E.patch \
+           file://0028-Kill-LIBC_LINUX_VERSION-macro.patch \
 "
 
 NATIVESDKFIXES ?= ""
-- 
2.7.4



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

* Re: [PATCH] glibc: Support building with 2.6.32 kernels on x86 / x86_64
  2017-03-28 18:57 [PATCH] glibc: Support building with 2.6.32 kernels on x86 / x86_64 Serhii Popovych
@ 2017-03-28 22:26 ` Richard Purdie
  2017-03-29 11:27   ` Serhii Popovych
  2017-03-29  0:03 ` Khem Raj
  1 sibling, 1 reply; 8+ messages in thread
From: Richard Purdie @ 2017-03-28 22:26 UTC (permalink / raw)
  To: Serhii Popovych, openembedded-core; +Cc: XE-Linux

On Tue, 2017-03-28 at 18:57 +0000, Serhii Popovych wrote:
> While glibc states that 2.6.32 kernels still supported
> for x86 / x86_64 builds are failing due to out of date
> LIBC_LINUX_VERSION macro checks for such architectures.
> 
> This macro statically defined to 3.2.0 with commit 5b4ecd3
> (Require Linux 3.2 except on x86 / x86_64, 3.2 headers everywhere.)
> and additionally checked before --enable-kernel.
> 
> Since both --enable-kernel and LIBC_LINUX_VERSION checks
> are the same and there is no users of last one we can
> safely get rid of it enabling glibc builds with 2.6.32
> kernel headers.
> 
> Also add --enable-kernel to glibc-initial build so that we
> build it correctly with old headers.
> 
> Cc: XE-Linux <xe-linux-external@cisco.com>
> Signed-off-by: Serhii Popovych <spopovyc@cisco.com>
> ---
>  meta/recipes-core/glibc/glibc-initial.inc          |   1 +
>  .../glibc/0028-Kill-LIBC_LINUX_VERSION-macro.patch | 113
> +++++++++++++++++++++
>  meta/recipes-core/glibc/glibc_2.25.bb              |   1 +
>  3 files changed, 115 insertions(+)
>  create mode 100644 meta/recipes-core/glibc/glibc/0028-Kill-
> LIBC_LINUX_VERSION-macro.patch
> 
> diff --git a/meta/recipes-core/glibc/glibc-initial.inc
> b/meta/recipes-core/glibc/glibc-initial.inc
> index f94603c..60b25dd 100644
> --- a/meta/recipes-core/glibc/glibc-initial.inc
> +++ b/meta/recipes-core/glibc/glibc-initial.inc
> @@ -12,6 +12,7 @@ do_configure () {
>  	find ${S} -name "configure" | xargs touch
>  	cfgscript=`python3 -c "import os;
> print(os.path.relpath('${S}', '.'))"`/configure
>  	$cfgscript --host=${TARGET_SYS} --build=${BUILD_SYS} \
> +		--enable-kernel=${OLDEST_KERNEL} \
>  		--prefix=/usr \
>  		--without-cvs --disable-sanity-checks \
>  		--with-headers=${STAGING_DIR_TARGET}${includedir} \
> diff --git a/meta/recipes-core/glibc/glibc/0028-Kill-
> LIBC_LINUX_VERSION-macro.patch b/meta/recipes-core/glibc/glibc/0028-
> Kill-LIBC_LINUX_VERSION-macro.patch
> new file mode 100644
> index 0000000..f5eaf1c
> --- /dev/null
> +++ b/meta/recipes-core/glibc/glibc/0028-Kill-LIBC_LINUX_VERSION-
> macro.patch
> @@ -0,0 +1,113 @@
> +From 88f83e4b5a8929dac9095ed264700fcb62d5e4dd Mon Sep 17 00:00:00
> 2001
> +From: Serhii Popovych <spopovyc@cisco.com>
> +Date: Fri, 17 Mar 2017 15:48:34 +0000
> +Subject: Kill LIBC_LINUX_VERSION macro
> +
> +After commit 5b4ecd3 (Require Linux 3.2 except on x86 / x86_64,
> +3.2 headers everywhere.) minimal kernel version raised from
> +2.6.32 to 3.2.0 for all architectures except x86 and x86_64
> +unless newer already used for architecture.
> +
> +However LIBC_LINUX_VERSION macro still is in effect and fails
> +configure even with --enable-kernel=2.6.32.
> +
> +While it is present in configure.ac it does not affect anything
> +except LINUX_VERSION_CODE check which already performed by
> +--enable-kernel.
> +
> +Upstream-Status: Pending
> +Signed-off-by: Serhii Popovych <spopovyc@cisco.com>
> +---
> + sysdeps/unix/sysv/linux/configure    | 39 -----------------------
> -------------
> + sysdeps/unix/sysv/linux/configure.ac | 21 -------------------
> + 2 files changed, 60 deletions(-)
> +
> +diff --git a/sysdeps/unix/sysv/linux/configure
> b/sysdeps/unix/sysv/linux/configure

This is presumably a generated file. We should only patch configure.ac
as otherwise the potential timestamp differences between these can
cause problems (we've been burnt before). The configure version will
get updated when we reautoconf.

Cheers,

Richard


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

* Re: [PATCH] glibc: Support building with 2.6.32 kernels on x86 / x86_64
  2017-03-28 18:57 [PATCH] glibc: Support building with 2.6.32 kernels on x86 / x86_64 Serhii Popovych
  2017-03-28 22:26 ` Richard Purdie
@ 2017-03-29  0:03 ` Khem Raj
  2017-03-29  9:57   ` Serhii Popovych
  2017-03-29 10:00   ` Serhii Popovych
  1 sibling, 2 replies; 8+ messages in thread
From: Khem Raj @ 2017-03-29  0:03 UTC (permalink / raw)
  To: Serhii Popovych, openembedded-core; +Cc: XE-Linux


[-- Attachment #1.1: Type: text/plain, Size: 8470 bytes --]



On 3/28/17 11:57 AM, Serhii Popovych wrote:
> While glibc states that 2.6.32 kernels still supported
> for x86 / x86_64 builds are failing due to out of date
> LIBC_LINUX_VERSION macro checks for such architectures.
> 
> This macro statically defined to 3.2.0 with commit 5b4ecd3
> (Require Linux 3.2 except on x86 / x86_64, 3.2 headers everywhere.)
> and additionally checked before --enable-kernel.
> 
> Since both --enable-kernel and LIBC_LINUX_VERSION checks
> are the same and there is no users of last one we can
> safely get rid of it enabling glibc builds with 2.6.32
> kernel headers.
> 
> Also add --enable-kernel to glibc-initial build so that we
> build it correctly with old headers.
> 
> Cc: XE-Linux <xe-linux-external@cisco.com>
> Signed-off-by: Serhii Popovych <spopovyc@cisco.com>
> ---
>  meta/recipes-core/glibc/glibc-initial.inc          |   1 +
>  .../glibc/0028-Kill-LIBC_LINUX_VERSION-macro.patch | 113 +++++++++++++++++++++
>  meta/recipes-core/glibc/glibc_2.25.bb              |   1 +
>  3 files changed, 115 insertions(+)
>  create mode 100644 meta/recipes-core/glibc/glibc/0028-Kill-LIBC_LINUX_VERSION-macro.patch
> 
> diff --git a/meta/recipes-core/glibc/glibc-initial.inc b/meta/recipes-core/glibc/glibc-initial.inc
> index f94603c..60b25dd 100644
> --- a/meta/recipes-core/glibc/glibc-initial.inc
> +++ b/meta/recipes-core/glibc/glibc-initial.inc
> @@ -12,6 +12,7 @@ do_configure () {
>  	find ${S} -name "configure" | xargs touch
>  	cfgscript=`python3 -c "import os; print(os.path.relpath('${S}', '.'))"`/configure
>  	$cfgscript --host=${TARGET_SYS} --build=${BUILD_SYS} \
> +		--enable-kernel=${OLDEST_KERNEL} \
>  		--prefix=/usr \
>  		--without-cvs --disable-sanity-checks \
>  		--with-headers=${STAGING_DIR_TARGET}${includedir} \
> diff --git a/meta/recipes-core/glibc/glibc/0028-Kill-LIBC_LINUX_VERSION-macro.patch b/meta/recipes-core/glibc/glibc/0028-Kill-LIBC_LINUX_VERSION-macro.patch
> new file mode 100644
> index 0000000..f5eaf1c
> --- /dev/null
> +++ b/meta/recipes-core/glibc/glibc/0028-Kill-LIBC_LINUX_VERSION-macro.patch
> @@ -0,0 +1,113 @@
> +From 88f83e4b5a8929dac9095ed264700fcb62d5e4dd Mon Sep 17 00:00:00 2001
> +From: Serhii Popovych <spopovyc@cisco.com>
> +Date: Fri, 17 Mar 2017 15:48:34 +0000
> +Subject: Kill LIBC_LINUX_VERSION macro
> +
> +After commit 5b4ecd3 (Require Linux 3.2 except on x86 / x86_64,
> +3.2 headers everywhere.) minimal kernel version raised from
> +2.6.32 to 3.2.0 for all architectures except x86 and x86_64
> +unless newer already used for architecture.
> +
> +However LIBC_LINUX_VERSION macro still is in effect and fails
> +configure even with --enable-kernel=2.6.32.
> +
> +While it is present in configure.ac it does not affect anything
> +except LINUX_VERSION_CODE check which already performed by
> +--enable-kernel.
> +

--enable-kernel is forces the minimum kernel for glibc to configure for
kernel interfaces if not set it defaults to arch specific value but it
wont check for version of linux headers during compile time. Whereas
this check is checking and errors out during build time if minimum
kernel version is not met. If you were to make the LIBC_LINUX_VERSION
have a value that matches the arch_minimum_kernel version that would be
an improvement.

As such if you want to do quick fix then lower the value of
LIBC_LINUX_VERSION to 2.6.32 when building for x86/x86_64, we can accept
such a patch with a bit less happiness.


> +Upstream-Status: Pending
> +Signed-off-by: Serhii Popovych <spopovyc@cisco.com>
> +---
> + sysdeps/unix/sysv/linux/configure    | 39 ------------------------------------
> + sysdeps/unix/sysv/linux/configure.ac | 21 -------------------
> + 2 files changed, 60 deletions(-)
> +
> +diff --git a/sysdeps/unix/sysv/linux/configure b/sysdeps/unix/sysv/linux/configure
> +index cace758..ab5fabe 100644
> +--- a/sysdeps/unix/sysv/linux/configure
> ++++ b/sysdeps/unix/sysv/linux/configure
> +@@ -6,45 +6,6 @@ if test -n "$sysheaders"; then
> +   CPPFLAGS="$CPPFLAGS $SYSINCLUDES"
> + fi
> + 
> +-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking installed Linux kernel header files" >&5
> +-$as_echo_n "checking installed Linux kernel header files... " >&6; }
> +-if ${libc_cv_linux320+:} false; then :
> +-  $as_echo_n "(cached) " >&6
> +-else
> +-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +-/* end confdefs.h.  */
> +-#include <linux/version.h>
> +-#if !defined LINUX_VERSION_CODE || LINUX_VERSION_CODE <  (3 *65536+ 2 *256+ 0) /* 3.2.0 */
> +-# error kernel headers missing or too old
> +-#endif
> +-int
> +-main ()
> +-{
> +-
> +-  ;
> +-  return 0;
> +-}
> +-_ACEOF
> +-if ac_fn_c_try_compile "$LINENO"; then :
> +-  libc_cv_linux320='3.2.0 or later'
> +-else
> +-  libc_cv_linux320='missing or too old!'
> +-fi
> +-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
> +-fi
> +-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_linux320" >&5
> +-$as_echo "$libc_cv_linux320" >&6; }
> +-if test "$libc_cv_linux320" != '3.2.0 or later'; then
> +-  as_fn_error $? "GNU libc requires kernel header files from
> +-Linux 3.2.0 or later to be installed before configuring.
> +-The kernel header files are found usually in /usr/include/asm and
> +-/usr/include/linux; make sure these directories use files from
> +-Linux 3.2.0 or later.  This check uses <linux/version.h>, so
> +-make sure that file was built correctly when installing the kernel header
> +-files.  To use kernel headers not from /usr/include/linux, use the
> +-configure option --with-headers." "$LINENO" 5
> +-fi
> +-
> + # If the user gave a minimal version number test whether the available
> + # kernel headers are young enough.  Additionally we have minimal
> + # kernel versions for some architectures.  If a previous configure fragment
> +diff --git a/sysdeps/unix/sysv/linux/configure.ac b/sysdeps/unix/sysv/linux/configure.ac
> +index 13abda0..5b47db5 100644
> +--- a/sysdeps/unix/sysv/linux/configure.ac
> ++++ b/sysdeps/unix/sysv/linux/configure.ac
> +@@ -1,31 +1,10 @@
> + GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
> + # Local configure fragment for sysdeps/unix/sysv/linux.
> + 
> +-define([LIBC_LINUX_VERSION],[3.2.0])dnl
> + if test -n "$sysheaders"; then
> +   OLD_CPPFLAGS=$CPPFLAGS
> +   CPPFLAGS="$CPPFLAGS $SYSINCLUDES"
> + fi
> +-define([libc_cv_linuxVER], [libc_cv_linux]patsubst(LIBC_LINUX_VERSION,[\.]))dnl
> +-AC_CACHE_CHECK(installed Linux kernel header files, libc_cv_linuxVER, [dnl
> +-AC_TRY_COMPILE([#include <linux/version.h>
> +-#if !defined LINUX_VERSION_CODE || LINUX_VERSION_CODE < ]dnl
> +-patsubst(LIBC_LINUX_VERSION,[^\([^.]*\)\.\([^.]*\)\.\([^.]*\)$],dnl
> +-[ (\1 *65536+ \2 *256+ \3) /* \1.\2.\3 */])[
> +-# error kernel headers missing or too old
> +-#endif], [],
> +-	       [libc_cv_linuxVER='LIBC_LINUX_VERSION or later'],
> +-	       [libc_cv_linuxVER='missing or too old!'])])
> +-if test "$libc_cv_linuxVER" != 'LIBC_LINUX_VERSION or later'; then
> +-  AC_MSG_ERROR([GNU libc requires kernel header files from
> +-Linux LIBC_LINUX_VERSION or later to be installed before configuring.
> +-The kernel header files are found usually in /usr/include/asm and
> +-/usr/include/linux; make sure these directories use files from
> +-Linux LIBC_LINUX_VERSION or later.  This check uses <linux/version.h>, so
> +-make sure that file was built correctly when installing the kernel header
> +-files.  To use kernel headers not from /usr/include/linux, use the
> +-configure option --with-headers.])
> +-fi
> + 
> + # If the user gave a minimal version number test whether the available
> + # kernel headers are young enough.  Additionally we have minimal
> +-- 
> +2.7.4
> +
> diff --git a/meta/recipes-core/glibc/glibc_2.25.bb b/meta/recipes-core/glibc/glibc_2.25.bb
> index cf9c4f7..869d023 100644
> --- a/meta/recipes-core/glibc/glibc_2.25.bb
> +++ b/meta/recipes-core/glibc/glibc_2.25.bb
> @@ -42,6 +42,7 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
>             file://0025-Define-DUMMY_LOCALE_T-if-not-defined.patch \
>             file://0026-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch \
>             file://0027-locale-fix-hard-coded-reference-to-gcc-E.patch \
> +           file://0028-Kill-LIBC_LINUX_VERSION-macro.patch \
>  "
>  
>  NATIVESDKFIXES ?= ""
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 211 bytes --]

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

* Re: [PATCH] glibc: Support building with 2.6.32 kernels on x86 / x86_64
  2017-03-29  0:03 ` Khem Raj
@ 2017-03-29  9:57   ` Serhii Popovych
  2017-03-31 10:41     ` Serhii Popovych
  2017-03-29 10:00   ` Serhii Popovych
  1 sibling, 1 reply; 8+ messages in thread
From: Serhii Popovych @ 2017-03-29  9:57 UTC (permalink / raw)
  To: Khem Raj, openembedded-core


> 
> 
> On 3/28/17 11:57 AM, Serhii Popovych wrote:
>> While glibc states that 2.6.32 kernels still supported
>> for x86 / x86_64 builds are failing due to out of date
>> LIBC_LINUX_VERSION macro checks for such architectures.
>>
>> This macro statically defined to 3.2.0 with commit 5b4ecd3
>> (Require Linux 3.2 except on x86 / x86_64, 3.2 headers everywhere.)
>> and additionally checked before --enable-kernel.
>>
>> Since both --enable-kernel and LIBC_LINUX_VERSION checks
>> are the same and there is no users of last one we can
>> safely get rid of it enabling glibc builds with 2.6.32
>> kernel headers.
>>
>> Also add --enable-kernel to glibc-initial build so that we
>> build it correctly with old headers.
>>
>> Cc: XE-Linux <xe-linux-external@cisco.com>
>> Signed-off-by: Serhii Popovych <spopovyc@cisco.com>
>> ---
>>  meta/recipes-core/glibc/glibc-initial.inc          |   1 +
>>  .../glibc/0028-Kill-LIBC_LINUX_VERSION-macro.patch | 113 +++++++++++++++++++++
>>  meta/recipes-core/glibc/glibc_2.25.bb              |   1 +
>>  3 files changed, 115 insertions(+)
>>  create mode 100644 meta/recipes-core/glibc/glibc/0028-Kill-LIBC_LINUX_VERSION-macro.patch
>>
>> diff --git a/meta/recipes-core/glibc/glibc-initial.inc b/meta/recipes-core/glibc/glibc-initial.inc
>> index f94603c..60b25dd 100644
>> --- a/meta/recipes-core/glibc/glibc-initial.inc
>> +++ b/meta/recipes-core/glibc/glibc-initial.inc
>> @@ -12,6 +12,7 @@ do_configure () {
>>  	find ${S} -name "configure" | xargs touch
>>  	cfgscript=`python3 -c "import os; print(os.path.relpath('${S}', '.'))"`/configure
>>  	$cfgscript --host=${TARGET_SYS} --build=${BUILD_SYS} \
>> +		--enable-kernel=${OLDEST_KERNEL} \
>>  		--prefix=/usr \
>>  		--without-cvs --disable-sanity-checks \
>>  		--with-headers=${STAGING_DIR_TARGET}${includedir} \
>> diff --git a/meta/recipes-core/glibc/glibc/0028-Kill-LIBC_LINUX_VERSION-macro.patch b/meta/recipes-core/glibc/glibc/0028-Kill-LIBC_LINUX_VERSION-macro.patch
>> new file mode 100644
>> index 0000000..f5eaf1c
>> --- /dev/null
>> +++ b/meta/recipes-core/glibc/glibc/0028-Kill-LIBC_LINUX_VERSION-macro.patch
>> @@ -0,0 +1,113 @@
>> +From 88f83e4b5a8929dac9095ed264700fcb62d5e4dd Mon Sep 17 00:00:00 2001
>> +From: Serhii Popovych <spopovyc@cisco.com>
>> +Date: Fri, 17 Mar 2017 15:48:34 +0000
>> +Subject: Kill LIBC_LINUX_VERSION macro
>> +
>> +After commit 5b4ecd3 (Require Linux 3.2 except on x86 / x86_64,
>> +3.2 headers everywhere.) minimal kernel version raised from
>> +2.6.32 to 3.2.0 for all architectures except x86 and x86_64
>> +unless newer already used for architecture.
>> +
>> +However LIBC_LINUX_VERSION macro still is in effect and fails
>> +configure even with --enable-kernel=2.6.32.
>> +
>> +While it is present in configure.ac it does not affect anything
>> +except LINUX_VERSION_CODE check which already performed by
>> +--enable-kernel.
>> +
> 
> --enable-kernel is forces the minimum kernel for glibc to configure for
> kernel interfaces if not set it defaults to arch specific value but it
> wont check for version of linux headers during compile time. Whereas
> this check is checking and errors out during build time if minimum
> kernel version is not met.

But why in configure.ac
define([LIBC_LINUX_VERSION],[3.2.0])
sets to version 3.2.0?

and then AC_TRY_COMPILE() sets libc_cv_linuxVER='missing or too old!'
causing configure to fail due to missing kheaders >= 3.2.0, not 2.6.32.

Later in configure.ac I see minimum_kernel being checked with
AC_TRY_COMPILE() and same code as for LIBC_LINUX_VERSION.

So we check for 3.2.0 and then check for minimum_kernel (--enable-
kernel) 2.6.32 after this?


> If you were to make the LIBC_LINUX_VERSION
> have a value that matches the arch_minimum_kernel version that would be
> an improvement.

configure.ac (and thus configure) is only place where
LIBC_LINUX_VERSION is used, so I decided to remove it as remnant from
pre --enable-kernel option ages.

> 
> As such if you want to do quick fix then lower the value of
> LIBC_LINUX_VERSION to 2.6.32 when building for x86/x86_64, we can accept
> such a patch with a bit less happiness.

I do not want to get quick fix. I want to find way to fix it right.

Thanks.

> 
> 
>> +Upstream-Status: Pending
>> +Signed-off-by: Serhii Popovych <spopovyc@cisco.com>
>> +---
>> + sysdeps/unix/sysv/linux/configure    | 39 ------------------------------------
>> + sysdeps/unix/sysv/linux/configure.ac | 21 -------------------
>> + 2 files changed, 60 deletions(-)
>> +
>> +diff --git a/sysdeps/unix/sysv/linux/configure b/sysdeps/unix/sysv/linux/configure
>> +index cace758..ab5fabe 100644
>> +--- a/sysdeps/unix/sysv/linux/configure
>> ++++ b/sysdeps/unix/sysv/linux/configure
>> +@@ -6,45 +6,6 @@ if test -n "$sysheaders"; then
>> +   CPPFLAGS="$CPPFLAGS $SYSINCLUDES"
>> + fi
>> + 
>> +-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking installed Linux kernel header files" >&5
>> +-$as_echo_n "checking installed Linux kernel header files... " >&6; }
>> +-if ${libc_cv_linux320+:} false; then :
>> +-  $as_echo_n "(cached) " >&6
>> +-else
>> +-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
>> +-/* end confdefs.h.  */
>> +-#include <linux/version.h>
>> +-#if !defined LINUX_VERSION_CODE || LINUX_VERSION_CODE <  (3 *65536+ 2 *256+ 0) /* 3.2.0 */
>> +-# error kernel headers missing or too old
>> +-#endif
>> +-int
>> +-main ()
>> +-{
>> +-
>> +-  ;
>> +-  return 0;
>> +-}
>> +-_ACEOF
>> +-if ac_fn_c_try_compile "$LINENO"; then :
>> +-  libc_cv_linux320='3.2.0 or later'
>> +-else
>> +-  libc_cv_linux320='missing or too old!'
>> +-fi
>> +-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
>> +-fi
>> +-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_linux320" >&5
>> +-$as_echo "$libc_cv_linux320" >&6; }
>> +-if test "$libc_cv_linux320" != '3.2.0 or later'; then
>> +-  as_fn_error $? "GNU libc requires kernel header files from
>> +-Linux 3.2.0 or later to be installed before configuring.
>> +-The kernel header files are found usually in /usr/include/asm and
>> +-/usr/include/linux; make sure these directories use files from
>> +-Linux 3.2.0 or later.  This check uses <linux/version.h>, so
>> +-make sure that file was built correctly when installing the kernel header
>> +-files.  To use kernel headers not from /usr/include/linux, use the
>> +-configure option --with-headers." "$LINENO" 5
>> +-fi
>> +-
>> + # If the user gave a minimal version number test whether the available
>> + # kernel headers are young enough.  Additionally we have minimal
>> + # kernel versions for some architectures.  If a previous configure fragment
>> +diff --git a/sysdeps/unix/sysv/linux/configure.ac b/sysdeps/unix/sysv/linux/configure.ac
>> +index 13abda0..5b47db5 100644
>> +--- a/sysdeps/unix/sysv/linux/configure.ac
>> ++++ b/sysdeps/unix/sysv/linux/configure.ac
>> +@@ -1,31 +1,10 @@
>> + GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
>> + # Local configure fragment for sysdeps/unix/sysv/linux.
>> + 
>> +-define([LIBC_LINUX_VERSION],[3.2.0])dnl
>> + if test -n "$sysheaders"; then
>> +   OLD_CPPFLAGS=$CPPFLAGS
>> +   CPPFLAGS="$CPPFLAGS $SYSINCLUDES"
>> + fi
>> +-define([libc_cv_linuxVER], [libc_cv_linux]patsubst(LIBC_LINUX_VERSION,[\.]))dnl
>> +-AC_CACHE_CHECK(installed Linux kernel header files, libc_cv_linuxVER, [dnl
>> +-AC_TRY_COMPILE([#include <linux/version.h>
>> +-#if !defined LINUX_VERSION_CODE || LINUX_VERSION_CODE < ]dnl
>> +-patsubst(LIBC_LINUX_VERSION,[^\([^.]*\)\.\([^.]*\)\.\([^.]*\)$],dnl
>> +-[ (\1 *65536+ \2 *256+ \3) /* \1.\2.\3 */])[
>> +-# error kernel headers missing or too old
>> +-#endif], [],
>> +-	       [libc_cv_linuxVER='LIBC_LINUX_VERSION or later'],
>> +-	       [libc_cv_linuxVER='missing or too old!'])])
>> +-if test "$libc_cv_linuxVER" != 'LIBC_LINUX_VERSION or later'; then
>> +-  AC_MSG_ERROR([GNU libc requires kernel header files from
>> +-Linux LIBC_LINUX_VERSION or later to be installed before configuring.
>> +-The kernel header files are found usually in /usr/include/asm and
>> +-/usr/include/linux; make sure these directories use files from
>> +-Linux LIBC_LINUX_VERSION or later.  This check uses <linux/version.h>, so
>> +-make sure that file was built correctly when installing the kernel header
>> +-files.  To use kernel headers not from /usr/include/linux, use the
>> +-configure option --with-headers.])
>> +-fi
>> + 
>> + # If the user gave a minimal version number test whether the available
>> + # kernel headers are young enough.  Additionally we have minimal
>> +-- 
>> +2.7.4
>> +
>> diff --git a/meta/recipes-core/glibc/glibc_2.25.bb b/meta/recipes-core/glibc/glibc_2.25.bb
>> index cf9c4f7..869d023 100644
>> --- a/meta/recipes-core/glibc/glibc_2.25.bb
>> +++ b/meta/recipes-core/glibc/glibc_2.25.bb
>> @@ -42,6 +42,7 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
>>             file://0025-Define-DUMMY_LOCALE_T-if-not-defined.patch \
>>             file://0026-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch \
>>             file://0027-locale-fix-hard-coded-reference-to-gcc-E.patch \
>> +           file://0028-Kill-LIBC_LINUX_VERSION-macro.patch \
>>  "
>>  
>>  NATIVESDKFIXES ?= ""
>>
> 


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

* Re: [PATCH] glibc: Support building with 2.6.32 kernels on x86 / x86_64
  2017-03-29  0:03 ` Khem Raj
  2017-03-29  9:57   ` Serhii Popovych
@ 2017-03-29 10:00   ` Serhii Popovych
  1 sibling, 0 replies; 8+ messages in thread
From: Serhii Popovych @ 2017-03-29 10:00 UTC (permalink / raw)
  To: openembedded-core


> 
> 
> On 3/28/17 11:57 AM, Serhii Popovych wrote:
>> While glibc states that 2.6.32 kernels still supported
>> for x86 / x86_64 builds are failing due to out of date
>> LIBC_LINUX_VERSION macro checks for such architectures.
>>
>> This macro statically defined to 3.2.0 with commit 5b4ecd3
>> (Require Linux 3.2 except on x86 / x86_64, 3.2 headers everywhere.)
>> and additionally checked before --enable-kernel.
>>
>> Since both --enable-kernel and LIBC_LINUX_VERSION checks
>> are the same and there is no users of last one we can
>> safely get rid of it enabling glibc builds with 2.6.32
>> kernel headers.
>>
>> Also add --enable-kernel to glibc-initial build so that we
>> build it correctly with old headers.
>>
>> Cc: XE-Linux <xe-linux-external@cisco.com>
>> Signed-off-by: Serhii Popovych <spopovyc@cisco.com>
>> ---
>>  meta/recipes-core/glibc/glibc-initial.inc          |   1 +
>>  .../glibc/0028-Kill-LIBC_LINUX_VERSION-macro.patch | 113 +++++++++++++++++++++
>>  meta/recipes-core/glibc/glibc_2.25.bb              |   1 +
>>  3 files changed, 115 insertions(+)
>>  create mode 100644 meta/recipes-core/glibc/glibc/0028-Kill-LIBC_LINUX_VERSION-macro.patch
>>
>> diff --git a/meta/recipes-core/glibc/glibc-initial.inc b/meta/recipes-core/glibc/glibc-initial.inc
>> index f94603c..60b25dd 100644
>> --- a/meta/recipes-core/glibc/glibc-initial.inc
>> +++ b/meta/recipes-core/glibc/glibc-initial.inc
>> @@ -12,6 +12,7 @@ do_configure () {
>>  	find ${S} -name "configure" | xargs touch
>>  	cfgscript=`python3 -c "import os; print(os.path.relpath('${S}', '.'))"`/configure
>>  	$cfgscript --host=${TARGET_SYS} --build=${BUILD_SYS} \
>> +		--enable-kernel=${OLDEST_KERNEL} \
>>  		--prefix=/usr \
>>  		--without-cvs --disable-sanity-checks \
>>  		--with-headers=${STAGING_DIR_TARGET}${includedir} \
>> diff --git a/meta/recipes-core/glibc/glibc/0028-Kill-LIBC_LINUX_VERSION-macro.patch b/meta/recipes-core/glibc/glibc/0028-Kill-LIBC_LINUX_VERSION-macro.patch
>> new file mode 100644
>> index 0000000..f5eaf1c
>> --- /dev/null
>> +++ b/meta/recipes-core/glibc/glibc/0028-Kill-LIBC_LINUX_VERSION-macro.patch
>> @@ -0,0 +1,113 @@
>> +From 88f83e4b5a8929dac9095ed264700fcb62d5e4dd Mon Sep 17 00:00:00 2001
>> +From: Serhii Popovych <spopovyc@cisco.com>
>> +Date: Fri, 17 Mar 2017 15:48:34 +0000
>> +Subject: Kill LIBC_LINUX_VERSION macro
>> +
>> +After commit 5b4ecd3 (Require Linux 3.2 except on x86 / x86_64,
>> +3.2 headers everywhere.) minimal kernel version raised from
>> +2.6.32 to 3.2.0 for all architectures except x86 and x86_64
>> +unless newer already used for architecture.
>> +
>> +However LIBC_LINUX_VERSION macro still is in effect and fails
>> +configure even with --enable-kernel=2.6.32.
>> +
>> +While it is present in configure.ac it does not affect anything
>> +except LINUX_VERSION_CODE check which already performed by
>> +--enable-kernel.
>> +
> 
> --enable-kernel is forces the minimum kernel for glibc to configure for
> kernel interfaces if not set it defaults to arch specific value but it
> wont check for version of linux headers during compile time. Whereas
> this check is checking and errors out during build time if minimum
> kernel version is not met.

But why in configure.ac
define([LIBC_LINUX_VERSION],[3.2.0])
sets to version 3.2.0?

and then AC_TRY_COMPILE() sets libc_cv_linuxVER='missing or too old!'
causing configure to fail due to missing kheaders >= 3.2.0, not 2.6.32.

Later in configure.ac I see minimum_kernel being checked with
AC_TRY_COMPILE() and same code as for LIBC_LINUX_VERSION.

So we check for 3.2.0 and then check for minimum_kernel (--enable-
kernel) 2.6.32 after this?


> If you were to make the LIBC_LINUX_VERSION
> have a value that matches the arch_minimum_kernel version that would be
> an improvement.

configure.ac (and thus configure) is only place where
LIBC_LINUX_VERSION is used, so I decided to remove it as remnant from
pre --enable-kernel option ages.

> 
> As such if you want to do quick fix then lower the value of
> LIBC_LINUX_VERSION to 2.6.32 when building for x86/x86_64, we can accept
> such a patch with a bit less happiness.

I do not want to get quick fix. I want to find way to fix it right.

Thanks.

> 
> 
>> +Upstream-Status: Pending
>> +Signed-off-by: Serhii Popovych <spopovyc@cisco.com>
>> +---
>> + sysdeps/unix/sysv/linux/configure    | 39 ------------------------------------
>> + sysdeps/unix/sysv/linux/configure.ac | 21 -------------------
>> + 2 files changed, 60 deletions(-)
>> +
>> +diff --git a/sysdeps/unix/sysv/linux/configure b/sysdeps/unix/sysv/linux/configure
>> +index cace758..ab5fabe 100644
>> +--- a/sysdeps/unix/sysv/linux/configure
>> ++++ b/sysdeps/unix/sysv/linux/configure
>> +@@ -6,45 +6,6 @@ if test -n "$sysheaders"; then
>> +   CPPFLAGS="$CPPFLAGS $SYSINCLUDES"
>> + fi
>> + 
>> +-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking installed Linux kernel header files" >&5
>> +-$as_echo_n "checking installed Linux kernel header files... " >&6; }
>> +-if ${libc_cv_linux320+:} false; then :
>> +-  $as_echo_n "(cached) " >&6
>> +-else
>> +-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
>> +-/* end confdefs.h.  */
>> +-#include <linux/version.h>
>> +-#if !defined LINUX_VERSION_CODE || LINUX_VERSION_CODE <  (3 *65536+ 2 *256+ 0) /* 3.2.0 */
>> +-# error kernel headers missing or too old
>> +-#endif
>> +-int
>> +-main ()
>> +-{
>> +-
>> +-  ;
>> +-  return 0;
>> +-}
>> +-_ACEOF
>> +-if ac_fn_c_try_compile "$LINENO"; then :
>> +-  libc_cv_linux320='3.2.0 or later'
>> +-else
>> +-  libc_cv_linux320='missing or too old!'
>> +-fi
>> +-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
>> +-fi
>> +-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_linux320" >&5
>> +-$as_echo "$libc_cv_linux320" >&6; }
>> +-if test "$libc_cv_linux320" != '3.2.0 or later'; then
>> +-  as_fn_error $? "GNU libc requires kernel header files from
>> +-Linux 3.2.0 or later to be installed before configuring.
>> +-The kernel header files are found usually in /usr/include/asm and
>> +-/usr/include/linux; make sure these directories use files from
>> +-Linux 3.2.0 or later.  This check uses <linux/version.h>, so
>> +-make sure that file was built correctly when installing the kernel header
>> +-files.  To use kernel headers not from /usr/include/linux, use the
>> +-configure option --with-headers." "$LINENO" 5
>> +-fi
>> +-
>> + # If the user gave a minimal version number test whether the available
>> + # kernel headers are young enough.  Additionally we have minimal
>> + # kernel versions for some architectures.  If a previous configure fragment
>> +diff --git a/sysdeps/unix/sysv/linux/configure.ac b/sysdeps/unix/sysv/linux/configure.ac
>> +index 13abda0..5b47db5 100644
>> +--- a/sysdeps/unix/sysv/linux/configure.ac
>> ++++ b/sysdeps/unix/sysv/linux/configure.ac
>> +@@ -1,31 +1,10 @@
>> + GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
>> + # Local configure fragment for sysdeps/unix/sysv/linux.
>> + 
>> +-define([LIBC_LINUX_VERSION],[3.2.0])dnl
>> + if test -n "$sysheaders"; then
>> +   OLD_CPPFLAGS=$CPPFLAGS
>> +   CPPFLAGS="$CPPFLAGS $SYSINCLUDES"
>> + fi
>> +-define([libc_cv_linuxVER], [libc_cv_linux]patsubst(LIBC_LINUX_VERSION,[\.]))dnl
>> +-AC_CACHE_CHECK(installed Linux kernel header files, libc_cv_linuxVER, [dnl
>> +-AC_TRY_COMPILE([#include <linux/version.h>
>> +-#if !defined LINUX_VERSION_CODE || LINUX_VERSION_CODE < ]dnl
>> +-patsubst(LIBC_LINUX_VERSION,[^\([^.]*\)\.\([^.]*\)\.\([^.]*\)$],dnl
>> +-[ (\1 *65536+ \2 *256+ \3) /* \1.\2.\3 */])[
>> +-# error kernel headers missing or too old
>> +-#endif], [],
>> +-	       [libc_cv_linuxVER='LIBC_LINUX_VERSION or later'],
>> +-	       [libc_cv_linuxVER='missing or too old!'])])
>> +-if test "$libc_cv_linuxVER" != 'LIBC_LINUX_VERSION or later'; then
>> +-  AC_MSG_ERROR([GNU libc requires kernel header files from
>> +-Linux LIBC_LINUX_VERSION or later to be installed before configuring.
>> +-The kernel header files are found usually in /usr/include/asm and
>> +-/usr/include/linux; make sure these directories use files from
>> +-Linux LIBC_LINUX_VERSION or later.  This check uses <linux/version.h>, so
>> +-make sure that file was built correctly when installing the kernel header
>> +-files.  To use kernel headers not from /usr/include/linux, use the
>> +-configure option --with-headers.])
>> +-fi
>> + 
>> + # If the user gave a minimal version number test whether the available
>> + # kernel headers are young enough.  Additionally we have minimal
>> +-- 
>> +2.7.4
>> +
>> diff --git a/meta/recipes-core/glibc/glibc_2.25.bb b/meta/recipes-core/glibc/glibc_2.25.bb
>> index cf9c4f7..869d023 100644
>> --- a/meta/recipes-core/glibc/glibc_2.25.bb
>> +++ b/meta/recipes-core/glibc/glibc_2.25.bb
>> @@ -42,6 +42,7 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
>>             file://0025-Define-DUMMY_LOCALE_T-if-not-defined.patch \
>>             file://0026-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch \
>>             file://0027-locale-fix-hard-coded-reference-to-gcc-E.patch \
>> +           file://0028-Kill-LIBC_LINUX_VERSION-macro.patch \
>>  "
>>  
>>  NATIVESDKFIXES ?= ""
>>
> 


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

* Re: [PATCH] glibc: Support building with 2.6.32 kernels on x86 / x86_64
  2017-03-28 22:26 ` Richard Purdie
@ 2017-03-29 11:27   ` Serhii Popovych
  0 siblings, 0 replies; 8+ messages in thread
From: Serhii Popovych @ 2017-03-29 11:27 UTC (permalink / raw)
  To: Richard Purdie, openembedded-core


> On Tue, 2017-03-28 at 18:57 +0000, Serhii Popovych wrote:
>> While glibc states that 2.6.32 kernels still supported
>> for x86 / x86_64 builds are failing due to out of date
>> LIBC_LINUX_VERSION macro checks for such architectures.
>>
>> This macro statically defined to 3.2.0 with commit 5b4ecd3
>> (Require Linux 3.2 except on x86 / x86_64, 3.2 headers everywhere.)
>> and additionally checked before --enable-kernel.
>>
>> Since both --enable-kernel and LIBC_LINUX_VERSION checks
>> are the same and there is no users of last one we can
>> safely get rid of it enabling glibc builds with 2.6.32
>> kernel headers.
>>
>> Also add --enable-kernel to glibc-initial build so that we
>> build it correctly with old headers.
>>
>> Cc: XE-Linux <xe-linux-external@cisco.com>
>> Signed-off-by: Serhii Popovych <spopovyc@cisco.com>
>> ---
>>  meta/recipes-core/glibc/glibc-initial.inc          |   1 +
>>  .../glibc/0028-Kill-LIBC_LINUX_VERSION-macro.patch | 113
>> +++++++++++++++++++++
>>  meta/recipes-core/glibc/glibc_2.25.bb              |   1 +
>>  3 files changed, 115 insertions(+)
>>  create mode 100644 meta/recipes-core/glibc/glibc/0028-Kill-
>> LIBC_LINUX_VERSION-macro.patch
>>
>> diff --git a/meta/recipes-core/glibc/glibc-initial.inc
>> b/meta/recipes-core/glibc/glibc-initial.inc
>> index f94603c..60b25dd 100644
>> --- a/meta/recipes-core/glibc/glibc-initial.inc
>> +++ b/meta/recipes-core/glibc/glibc-initial.inc
>> @@ -12,6 +12,7 @@ do_configure () {
>>  	find ${S} -name "configure" | xargs touch
>>  	cfgscript=`python3 -c "import os;
>> print(os.path.relpath('${S}', '.'))"`/configure
>>  	$cfgscript --host=${TARGET_SYS} --build=${BUILD_SYS} \
>> +		--enable-kernel=${OLDEST_KERNEL} \
>>  		--prefix=/usr \
>>  		--without-cvs --disable-sanity-checks \
>>  		--with-headers=${STAGING_DIR_TARGET}${includedir} \
>> diff --git a/meta/recipes-core/glibc/glibc/0028-Kill-
>> LIBC_LINUX_VERSION-macro.patch b/meta/recipes-core/glibc/glibc/0028-
>> Kill-LIBC_LINUX_VERSION-macro.patch
>> new file mode 100644
>> index 0000000..f5eaf1c
>> --- /dev/null
>> +++ b/meta/recipes-core/glibc/glibc/0028-Kill-LIBC_LINUX_VERSION-
>> macro.patch
>> @@ -0,0 +1,113 @@
>> +From 88f83e4b5a8929dac9095ed264700fcb62d5e4dd Mon Sep 17 00:00:00
>> 2001
>> +From: Serhii Popovych <spopovyc@cisco.com>
>> +Date: Fri, 17 Mar 2017 15:48:34 +0000
>> +Subject: Kill LIBC_LINUX_VERSION macro
>> +
>> +After commit 5b4ecd3 (Require Linux 3.2 except on x86 / x86_64,
>> +3.2 headers everywhere.) minimal kernel version raised from
>> +2.6.32 to 3.2.0 for all architectures except x86 and x86_64
>> +unless newer already used for architecture.
>> +
>> +However LIBC_LINUX_VERSION macro still is in effect and fails
>> +configure even with --enable-kernel=2.6.32.
>> +
>> +While it is present in configure.ac it does not affect anything
>> +except LINUX_VERSION_CODE check which already performed by
>> +--enable-kernel.
>> +
>> +Upstream-Status: Pending
>> +Signed-off-by: Serhii Popovych <spopovyc@cisco.com>
>> +---
>> + sysdeps/unix/sysv/linux/configure    | 39 -----------------------
>> -------------
>> + sysdeps/unix/sysv/linux/configure.ac | 21 -------------------
>> + 2 files changed, 60 deletions(-)
>> +
>> +diff --git a/sysdeps/unix/sysv/linux/configure
>> b/sysdeps/unix/sysv/linux/configure
> 
> This is presumably a generated file. We should only patch configure.ac
> as otherwise the potential timestamp differences between these can
> cause problems (we've been burnt before). The configure version will
> get updated when we reautoconf.

Yes thats true, but I get following

| running configure fragment for sysdeps/unix/sysv/linux
| checking installed Linux kernel header files... missing or too old!
| configure: error: GNU libc requires kernel header files from
| Linux 3.2.0 or later to be installed before configuring.
| The kernel header files are found usually in /usr/include/asm and
| /usr/include/linux; make sure these directories use files from
| Linux 3.2.0 or later.  This check uses <linux/version.h>, so
| make sure that file was built correctly when installing the kernel header
| files.  To use kernel headers not from /usr/include/linux, use the
| configure option --with-headers.
| WARNING:
/home/spopovyc/oe/build-oe/tmp-glibc/work/x86_64-nativesdk-oesdk-linux/nativesdk-glibc-initial/2.25-r0/temp/run.do_configure.58685:1
exit 1 from '$cfgscript --host=x86_64-oesdk-linux --build=x86_64-linux
--enable-kernel=2.6.32 --prefix=/usr --without-cvs
--disable-sanity-checks
--with-headers=/home/spopovyc/oe/build-oe/tmp-glibc/work/x86_64-nativesdk-oesdk-linux/nativesdk-glibc-initial/2.25-r0/recipe-sysroot/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/include
--enable-hacker-mode --enable-addons'
| ERROR: Function failed: do_configure (log file is located at
/home/spopovyc/oe/build-oe/tmp-glibc/work/x86_64-nativesdk-oesdk-linux/nativesdk-glibc-initial/2.25-r0/temp/log.do_configure.58685)

When patching only configure.ac and by looking at configure
I see it wasn't recreated from changes in confiugre.ac

and by looking at glibc-initial/glibc recipes i see that
do_configure() task is overwritten to not to call autoreconf,
so I think patching configure is correct here.

Also I found few more patches in glibc directory that patch
both configure and configure.ac.

Thanks,
Serhii

> 
> Cheers,
> 
> Richard
> 


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

* Re: [PATCH] glibc: Support building with 2.6.32 kernels on x86 / x86_64
  2017-03-29  9:57   ` Serhii Popovych
@ 2017-03-31 10:41     ` Serhii Popovych
  2017-03-31 15:19       ` Serhii Popovych
  0 siblings, 1 reply; 8+ messages in thread
From: Serhii Popovych @ 2017-03-31 10:41 UTC (permalink / raw)
  To: Khem Raj, openembedded-core


> 
>>
>>
>> On 3/28/17 11:57 AM, Serhii Popovych wrote:
>>> While glibc states that 2.6.32 kernels still supported
>>> for x86 / x86_64 builds are failing due to out of date
>>> LIBC_LINUX_VERSION macro checks for such architectures.
>>>
>>> This macro statically defined to 3.2.0 with commit 5b4ecd3
>>> (Require Linux 3.2 except on x86 / x86_64, 3.2 headers everywhere.)
>>> and additionally checked before --enable-kernel.
>>>
>>> Since both --enable-kernel and LIBC_LINUX_VERSION checks
>>> are the same and there is no users of last one we can
>>> safely get rid of it enabling glibc builds with 2.6.32
>>> kernel headers.
>>>
>>> Also add --enable-kernel to glibc-initial build so that we
>>> build it correctly with old headers.
>>>
>>> Cc: XE-Linux <xe-linux-external@cisco.com>
>>> Signed-off-by: Serhii Popovych <spopovyc@cisco.com>
>>> ---
>>>  meta/recipes-core/glibc/glibc-initial.inc          |   1 +
>>>  .../glibc/0028-Kill-LIBC_LINUX_VERSION-macro.patch | 113 +++++++++++++++++++++
>>>  meta/recipes-core/glibc/glibc_2.25.bb              |   1 +
>>>  3 files changed, 115 insertions(+)
>>>  create mode 100644 meta/recipes-core/glibc/glibc/0028-Kill-LIBC_LINUX_VERSION-macro.patch
>>>
>>> diff --git a/meta/recipes-core/glibc/glibc-initial.inc b/meta/recipes-core/glibc/glibc-initial.inc
>>> index f94603c..60b25dd 100644
>>> --- a/meta/recipes-core/glibc/glibc-initial.inc
>>> +++ b/meta/recipes-core/glibc/glibc-initial.inc
>>> @@ -12,6 +12,7 @@ do_configure () {
>>>  	find ${S} -name "configure" | xargs touch
>>>  	cfgscript=`python3 -c "import os; print(os.path.relpath('${S}', '.'))"`/configure
>>>  	$cfgscript --host=${TARGET_SYS} --build=${BUILD_SYS} \
>>> +		--enable-kernel=${OLDEST_KERNEL} \
>>>  		--prefix=/usr \
>>>  		--without-cvs --disable-sanity-checks \
>>>  		--with-headers=${STAGING_DIR_TARGET}${includedir} \
>>> diff --git a/meta/recipes-core/glibc/glibc/0028-Kill-LIBC_LINUX_VERSION-macro.patch b/meta/recipes-core/glibc/glibc/0028-Kill-LIBC_LINUX_VERSION-macro.patch
>>> new file mode 100644
>>> index 0000000..f5eaf1c
>>> --- /dev/null
>>> +++ b/meta/recipes-core/glibc/glibc/0028-Kill-LIBC_LINUX_VERSION-macro.patch
>>> @@ -0,0 +1,113 @@
>>> +From 88f83e4b5a8929dac9095ed264700fcb62d5e4dd Mon Sep 17 00:00:00 2001
>>> +From: Serhii Popovych <spopovyc@cisco.com>
>>> +Date: Fri, 17 Mar 2017 15:48:34 +0000
>>> +Subject: Kill LIBC_LINUX_VERSION macro
>>> +
>>> +After commit 5b4ecd3 (Require Linux 3.2 except on x86 / x86_64,
>>> +3.2 headers everywhere.) minimal kernel version raised from
>>> +2.6.32 to 3.2.0 for all architectures except x86 and x86_64
>>> +unless newer already used for architecture.
>>> +
>>> +However LIBC_LINUX_VERSION macro still is in effect and fails
>>> +configure even with --enable-kernel=2.6.32.
>>> +
>>> +While it is present in configure.ac it does not affect anything
>>> +except LINUX_VERSION_CODE check which already performed by
>>> +--enable-kernel.
>>> +
>>
>> --enable-kernel is forces the minimum kernel for glibc to configure for
>> kernel interfaces if not set it defaults to arch specific value but it
>> wont check for version of linux headers during compile time. Whereas
>> this check is checking and errors out during build time if minimum
>> kernel version is not met.
> 
> But why in configure.ac
> define([LIBC_LINUX_VERSION],[3.2.0])
> sets to version 3.2.0?
> 
> and then AC_TRY_COMPILE() sets libc_cv_linuxVER='missing or too old!'
> causing configure to fail due to missing kheaders >= 3.2.0, not 2.6.32.
> 
> Later in configure.ac I see minimum_kernel being checked with
> AC_TRY_COMPILE() and same code as for LIBC_LINUX_VERSION.
> 
> So we check for 3.2.0 and then check for minimum_kernel (--enable-
> kernel) 2.6.32 after this?

By looking at commit 5b4ecd3 (Require Linux 3.2 except on x86 / x86_64,
3.2 headers everywhere.) contents closer I found answer for this
question.

In NEWS file we have:

+  unchanged).  Linux 3.2 or later kernel headers are required on all
+  architectures.

For me that means we should use kernel headers from 3.2 to build glibc,
but for x86 / x86_64 we still may force minimum supported kernel version
of 2.6.32 with --enable-kernel.

I will submit v2 without patch to remove LIBC_LINUX_VERSION check (i.e.
just add --enable-kernel=${OLDEST_KERNEL}.

Thanks,
Serhii

> 
> 
>> If you were to make the LIBC_LINUX_VERSION
>> have a value that matches the arch_minimum_kernel version that would be
>> an improvement.
> 
> configure.ac (and thus configure) is only place where
> LIBC_LINUX_VERSION is used, so I decided to remove it as remnant from
> pre --enable-kernel option ages.
> 
>>
>> As such if you want to do quick fix then lower the value of
>> LIBC_LINUX_VERSION to 2.6.32 when building for x86/x86_64, we can accept
>> such a patch with a bit less happiness.
> 
> I do not want to get quick fix. I want to find way to fix it right.
> 
> Thanks.
> 
>>
>>
>>> +Upstream-Status: Pending
>>> +Signed-off-by: Serhii Popovych <spopovyc@cisco.com>
>>> +---
>>> + sysdeps/unix/sysv/linux/configure    | 39 ------------------------------------
>>> + sysdeps/unix/sysv/linux/configure.ac | 21 -------------------
>>> + 2 files changed, 60 deletions(-)
>>> +
>>> +diff --git a/sysdeps/unix/sysv/linux/configure b/sysdeps/unix/sysv/linux/configure
>>> +index cace758..ab5fabe 100644
>>> +--- a/sysdeps/unix/sysv/linux/configure
>>> ++++ b/sysdeps/unix/sysv/linux/configure
>>> +@@ -6,45 +6,6 @@ if test -n "$sysheaders"; then
>>> +   CPPFLAGS="$CPPFLAGS $SYSINCLUDES"
>>> + fi
>>> + 
>>> +-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking installed Linux kernel header files" >&5
>>> +-$as_echo_n "checking installed Linux kernel header files... " >&6; }
>>> +-if ${libc_cv_linux320+:} false; then :
>>> +-  $as_echo_n "(cached) " >&6
>>> +-else
>>> +-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
>>> +-/* end confdefs.h.  */
>>> +-#include <linux/version.h>
>>> +-#if !defined LINUX_VERSION_CODE || LINUX_VERSION_CODE <  (3 *65536+ 2 *256+ 0) /* 3.2.0 */
>>> +-# error kernel headers missing or too old
>>> +-#endif
>>> +-int
>>> +-main ()
>>> +-{
>>> +-
>>> +-  ;
>>> +-  return 0;
>>> +-}
>>> +-_ACEOF
>>> +-if ac_fn_c_try_compile "$LINENO"; then :
>>> +-  libc_cv_linux320='3.2.0 or later'
>>> +-else
>>> +-  libc_cv_linux320='missing or too old!'
>>> +-fi
>>> +-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
>>> +-fi
>>> +-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_linux320" >&5
>>> +-$as_echo "$libc_cv_linux320" >&6; }
>>> +-if test "$libc_cv_linux320" != '3.2.0 or later'; then
>>> +-  as_fn_error $? "GNU libc requires kernel header files from
>>> +-Linux 3.2.0 or later to be installed before configuring.
>>> +-The kernel header files are found usually in /usr/include/asm and
>>> +-/usr/include/linux; make sure these directories use files from
>>> +-Linux 3.2.0 or later.  This check uses <linux/version.h>, so
>>> +-make sure that file was built correctly when installing the kernel header
>>> +-files.  To use kernel headers not from /usr/include/linux, use the
>>> +-configure option --with-headers." "$LINENO" 5
>>> +-fi
>>> +-
>>> + # If the user gave a minimal version number test whether the available
>>> + # kernel headers are young enough.  Additionally we have minimal
>>> + # kernel versions for some architectures.  If a previous configure fragment
>>> +diff --git a/sysdeps/unix/sysv/linux/configure.ac b/sysdeps/unix/sysv/linux/configure.ac
>>> +index 13abda0..5b47db5 100644
>>> +--- a/sysdeps/unix/sysv/linux/configure.ac
>>> ++++ b/sysdeps/unix/sysv/linux/configure.ac
>>> +@@ -1,31 +1,10 @@
>>> + GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
>>> + # Local configure fragment for sysdeps/unix/sysv/linux.
>>> + 
>>> +-define([LIBC_LINUX_VERSION],[3.2.0])dnl
>>> + if test -n "$sysheaders"; then
>>> +   OLD_CPPFLAGS=$CPPFLAGS
>>> +   CPPFLAGS="$CPPFLAGS $SYSINCLUDES"
>>> + fi
>>> +-define([libc_cv_linuxVER], [libc_cv_linux]patsubst(LIBC_LINUX_VERSION,[\.]))dnl
>>> +-AC_CACHE_CHECK(installed Linux kernel header files, libc_cv_linuxVER, [dnl
>>> +-AC_TRY_COMPILE([#include <linux/version.h>
>>> +-#if !defined LINUX_VERSION_CODE || LINUX_VERSION_CODE < ]dnl
>>> +-patsubst(LIBC_LINUX_VERSION,[^\([^.]*\)\.\([^.]*\)\.\([^.]*\)$],dnl
>>> +-[ (\1 *65536+ \2 *256+ \3) /* \1.\2.\3 */])[
>>> +-# error kernel headers missing or too old
>>> +-#endif], [],
>>> +-	       [libc_cv_linuxVER='LIBC_LINUX_VERSION or later'],
>>> +-	       [libc_cv_linuxVER='missing or too old!'])])
>>> +-if test "$libc_cv_linuxVER" != 'LIBC_LINUX_VERSION or later'; then
>>> +-  AC_MSG_ERROR([GNU libc requires kernel header files from
>>> +-Linux LIBC_LINUX_VERSION or later to be installed before configuring.
>>> +-The kernel header files are found usually in /usr/include/asm and
>>> +-/usr/include/linux; make sure these directories use files from
>>> +-Linux LIBC_LINUX_VERSION or later.  This check uses <linux/version.h>, so
>>> +-make sure that file was built correctly when installing the kernel header
>>> +-files.  To use kernel headers not from /usr/include/linux, use the
>>> +-configure option --with-headers.])
>>> +-fi
>>> + 
>>> + # If the user gave a minimal version number test whether the available
>>> + # kernel headers are young enough.  Additionally we have minimal
>>> +-- 
>>> +2.7.4
>>> +
>>> diff --git a/meta/recipes-core/glibc/glibc_2.25.bb b/meta/recipes-core/glibc/glibc_2.25.bb
>>> index cf9c4f7..869d023 100644
>>> --- a/meta/recipes-core/glibc/glibc_2.25.bb
>>> +++ b/meta/recipes-core/glibc/glibc_2.25.bb
>>> @@ -42,6 +42,7 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
>>>             file://0025-Define-DUMMY_LOCALE_T-if-not-defined.patch \
>>>             file://0026-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch \
>>>             file://0027-locale-fix-hard-coded-reference-to-gcc-E.patch \
>>> +           file://0028-Kill-LIBC_LINUX_VERSION-macro.patch \
>>>  "
>>>  
>>>  NATIVESDKFIXES ?= ""
>>>
>>


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

* Re: [PATCH] glibc: Support building with 2.6.32 kernels on x86 / x86_64
  2017-03-31 10:41     ` Serhii Popovych
@ 2017-03-31 15:19       ` Serhii Popovych
  0 siblings, 0 replies; 8+ messages in thread
From: Serhii Popovych @ 2017-03-31 15:19 UTC (permalink / raw)
  To: Khem Raj, openembedded-core


> 
>>
>>>
>>>
>>> On 3/28/17 11:57 AM, Serhii Popovych wrote:
>>>> While glibc states that 2.6.32 kernels still supported
>>>> for x86 / x86_64 builds are failing due to out of date
>>>> LIBC_LINUX_VERSION macro checks for such architectures.
>>>>
>>>> This macro statically defined to 3.2.0 with commit 5b4ecd3
>>>> (Require Linux 3.2 except on x86 / x86_64, 3.2 headers everywhere.)
>>>> and additionally checked before --enable-kernel.
>>>>
>>>> Since both --enable-kernel and LIBC_LINUX_VERSION checks
>>>> are the same and there is no users of last one we can
>>>> safely get rid of it enabling glibc builds with 2.6.32
>>>> kernel headers.
>>>>
>>>> Also add --enable-kernel to glibc-initial build so that we
>>>> build it correctly with old headers.
>>>>
>>>> Cc: XE-Linux <xe-linux-external@cisco.com>
>>>> Signed-off-by: Serhii Popovych <spopovyc@cisco.com>
>>>> ---
>>>>  meta/recipes-core/glibc/glibc-initial.inc          |   1 +
>>>>  .../glibc/0028-Kill-LIBC_LINUX_VERSION-macro.patch | 113 +++++++++++++++++++++
>>>>  meta/recipes-core/glibc/glibc_2.25.bb              |   1 +
>>>>  3 files changed, 115 insertions(+)
>>>>  create mode 100644 meta/recipes-core/glibc/glibc/0028-Kill-LIBC_LINUX_VERSION-macro.patch
>>>>
>>>> diff --git a/meta/recipes-core/glibc/glibc-initial.inc b/meta/recipes-core/glibc/glibc-initial.inc
>>>> index f94603c..60b25dd 100644
>>>> --- a/meta/recipes-core/glibc/glibc-initial.inc
>>>> +++ b/meta/recipes-core/glibc/glibc-initial.inc
>>>> @@ -12,6 +12,7 @@ do_configure () {
>>>>  	find ${S} -name "configure" | xargs touch
>>>>  	cfgscript=`python3 -c "import os; print(os.path.relpath('${S}', '.'))"`/configure
>>>>  	$cfgscript --host=${TARGET_SYS} --build=${BUILD_SYS} \
>>>> +		--enable-kernel=${OLDEST_KERNEL} \
>>>>  		--prefix=/usr \
>>>>  		--without-cvs --disable-sanity-checks \
>>>>  		--with-headers=${STAGING_DIR_TARGET}${includedir} \
>>>> diff --git a/meta/recipes-core/glibc/glibc/0028-Kill-LIBC_LINUX_VERSION-macro.patch b/meta/recipes-core/glibc/glibc/0028-Kill-LIBC_LINUX_VERSION-macro.patch
>>>> new file mode 100644
>>>> index 0000000..f5eaf1c
>>>> --- /dev/null
>>>> +++ b/meta/recipes-core/glibc/glibc/0028-Kill-LIBC_LINUX_VERSION-macro.patch
>>>> @@ -0,0 +1,113 @@
>>>> +From 88f83e4b5a8929dac9095ed264700fcb62d5e4dd Mon Sep 17 00:00:00 2001
>>>> +From: Serhii Popovych <spopovyc@cisco.com>
>>>> +Date: Fri, 17 Mar 2017 15:48:34 +0000
>>>> +Subject: Kill LIBC_LINUX_VERSION macro
>>>> +
>>>> +After commit 5b4ecd3 (Require Linux 3.2 except on x86 / x86_64,
>>>> +3.2 headers everywhere.) minimal kernel version raised from
>>>> +2.6.32 to 3.2.0 for all architectures except x86 and x86_64
>>>> +unless newer already used for architecture.
>>>> +
>>>> +However LIBC_LINUX_VERSION macro still is in effect and fails
>>>> +configure even with --enable-kernel=2.6.32.
>>>> +
>>>> +While it is present in configure.ac it does not affect anything
>>>> +except LINUX_VERSION_CODE check which already performed by
>>>> +--enable-kernel.
>>>> +
>>>
>>> --enable-kernel is forces the minimum kernel for glibc to configure for
>>> kernel interfaces if not set it defaults to arch specific value but it
>>> wont check for version of linux headers during compile time. Whereas
>>> this check is checking and errors out during build time if minimum
>>> kernel version is not met.
>>
>> But why in configure.ac
>> define([LIBC_LINUX_VERSION],[3.2.0])
>> sets to version 3.2.0?
>>
>> and then AC_TRY_COMPILE() sets libc_cv_linuxVER='missing or too old!'
>> causing configure to fail due to missing kheaders >= 3.2.0, not 2.6.32.
>>
>> Later in configure.ac I see minimum_kernel being checked with
>> AC_TRY_COMPILE() and same code as for LIBC_LINUX_VERSION.
>>
>> So we check for 3.2.0 and then check for minimum_kernel (--enable-
>> kernel) 2.6.32 after this?
> 
> By looking at commit 5b4ecd3 (Require Linux 3.2 except on x86 / x86_64,
> 3.2 headers everywhere.) contents closer I found answer for this
> question.
> 
> In NEWS file we have:
> 
> +  unchanged).  Linux 3.2 or later kernel headers are required on all
> +  architectures.
> 
> For me that means we should use kernel headers from 3.2 to build glibc,
> but for x86 / x86_64 we still may force minimum supported kernel version
> of 2.6.32 with --enable-kernel.
> 
> I will submit v2 without patch to remove LIBC_LINUX_VERSION check (i.e.
> just add --enable-kernel=${OLDEST_KERNEL}.

It seems even change to add --enable-kernel=${OLDEST_KERNEL} for
glibc-initial isn't necessary.

This whole patch *should* be skipped.

> 
> Thanks,
> Serhii
> 
>>
>>
>>> If you were to make the LIBC_LINUX_VERSION
>>> have a value that matches the arch_minimum_kernel version that would be
>>> an improvement.
>>
>> configure.ac (and thus configure) is only place where
>> LIBC_LINUX_VERSION is used, so I decided to remove it as remnant from
>> pre --enable-kernel option ages.
>>
>>>
>>> As such if you want to do quick fix then lower the value of
>>> LIBC_LINUX_VERSION to 2.6.32 when building for x86/x86_64, we can accept
>>> such a patch with a bit less happiness.
>>
>> I do not want to get quick fix. I want to find way to fix it right.
>>
>> Thanks.
>>
>>>
>>>
>>>> +Upstream-Status: Pending
>>>> +Signed-off-by: Serhii Popovych <spopovyc@cisco.com>
>>>> +---
>>>> + sysdeps/unix/sysv/linux/configure    | 39 ------------------------------------
>>>> + sysdeps/unix/sysv/linux/configure.ac | 21 -------------------
>>>> + 2 files changed, 60 deletions(-)
>>>> +
>>>> +diff --git a/sysdeps/unix/sysv/linux/configure b/sysdeps/unix/sysv/linux/configure
>>>> +index cace758..ab5fabe 100644
>>>> +--- a/sysdeps/unix/sysv/linux/configure
>>>> ++++ b/sysdeps/unix/sysv/linux/configure
>>>> +@@ -6,45 +6,6 @@ if test -n "$sysheaders"; then
>>>> +   CPPFLAGS="$CPPFLAGS $SYSINCLUDES"
>>>> + fi
>>>> + 
>>>> +-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking installed Linux kernel header files" >&5
>>>> +-$as_echo_n "checking installed Linux kernel header files... " >&6; }
>>>> +-if ${libc_cv_linux320+:} false; then :
>>>> +-  $as_echo_n "(cached) " >&6
>>>> +-else
>>>> +-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
>>>> +-/* end confdefs.h.  */
>>>> +-#include <linux/version.h>
>>>> +-#if !defined LINUX_VERSION_CODE || LINUX_VERSION_CODE <  (3 *65536+ 2 *256+ 0) /* 3.2.0 */
>>>> +-# error kernel headers missing or too old
>>>> +-#endif
>>>> +-int
>>>> +-main ()
>>>> +-{
>>>> +-
>>>> +-  ;
>>>> +-  return 0;
>>>> +-}
>>>> +-_ACEOF
>>>> +-if ac_fn_c_try_compile "$LINENO"; then :
>>>> +-  libc_cv_linux320='3.2.0 or later'
>>>> +-else
>>>> +-  libc_cv_linux320='missing or too old!'
>>>> +-fi
>>>> +-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
>>>> +-fi
>>>> +-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_linux320" >&5
>>>> +-$as_echo "$libc_cv_linux320" >&6; }
>>>> +-if test "$libc_cv_linux320" != '3.2.0 or later'; then
>>>> +-  as_fn_error $? "GNU libc requires kernel header files from
>>>> +-Linux 3.2.0 or later to be installed before configuring.
>>>> +-The kernel header files are found usually in /usr/include/asm and
>>>> +-/usr/include/linux; make sure these directories use files from
>>>> +-Linux 3.2.0 or later.  This check uses <linux/version.h>, so
>>>> +-make sure that file was built correctly when installing the kernel header
>>>> +-files.  To use kernel headers not from /usr/include/linux, use the
>>>> +-configure option --with-headers." "$LINENO" 5
>>>> +-fi
>>>> +-
>>>> + # If the user gave a minimal version number test whether the available
>>>> + # kernel headers are young enough.  Additionally we have minimal
>>>> + # kernel versions for some architectures.  If a previous configure fragment
>>>> +diff --git a/sysdeps/unix/sysv/linux/configure.ac b/sysdeps/unix/sysv/linux/configure.ac
>>>> +index 13abda0..5b47db5 100644
>>>> +--- a/sysdeps/unix/sysv/linux/configure.ac
>>>> ++++ b/sysdeps/unix/sysv/linux/configure.ac
>>>> +@@ -1,31 +1,10 @@
>>>> + GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
>>>> + # Local configure fragment for sysdeps/unix/sysv/linux.
>>>> + 
>>>> +-define([LIBC_LINUX_VERSION],[3.2.0])dnl
>>>> + if test -n "$sysheaders"; then
>>>> +   OLD_CPPFLAGS=$CPPFLAGS
>>>> +   CPPFLAGS="$CPPFLAGS $SYSINCLUDES"
>>>> + fi
>>>> +-define([libc_cv_linuxVER], [libc_cv_linux]patsubst(LIBC_LINUX_VERSION,[\.]))dnl
>>>> +-AC_CACHE_CHECK(installed Linux kernel header files, libc_cv_linuxVER, [dnl
>>>> +-AC_TRY_COMPILE([#include <linux/version.h>
>>>> +-#if !defined LINUX_VERSION_CODE || LINUX_VERSION_CODE < ]dnl
>>>> +-patsubst(LIBC_LINUX_VERSION,[^\([^.]*\)\.\([^.]*\)\.\([^.]*\)$],dnl
>>>> +-[ (\1 *65536+ \2 *256+ \3) /* \1.\2.\3 */])[
>>>> +-# error kernel headers missing or too old
>>>> +-#endif], [],
>>>> +-	       [libc_cv_linuxVER='LIBC_LINUX_VERSION or later'],
>>>> +-	       [libc_cv_linuxVER='missing or too old!'])])
>>>> +-if test "$libc_cv_linuxVER" != 'LIBC_LINUX_VERSION or later'; then
>>>> +-  AC_MSG_ERROR([GNU libc requires kernel header files from
>>>> +-Linux LIBC_LINUX_VERSION or later to be installed before configuring.
>>>> +-The kernel header files are found usually in /usr/include/asm and
>>>> +-/usr/include/linux; make sure these directories use files from
>>>> +-Linux LIBC_LINUX_VERSION or later.  This check uses <linux/version.h>, so
>>>> +-make sure that file was built correctly when installing the kernel header
>>>> +-files.  To use kernel headers not from /usr/include/linux, use the
>>>> +-configure option --with-headers.])
>>>> +-fi
>>>> + 
>>>> + # If the user gave a minimal version number test whether the available
>>>> + # kernel headers are young enough.  Additionally we have minimal
>>>> +-- 
>>>> +2.7.4
>>>> +
>>>> diff --git a/meta/recipes-core/glibc/glibc_2.25.bb b/meta/recipes-core/glibc/glibc_2.25.bb
>>>> index cf9c4f7..869d023 100644
>>>> --- a/meta/recipes-core/glibc/glibc_2.25.bb
>>>> +++ b/meta/recipes-core/glibc/glibc_2.25.bb
>>>> @@ -42,6 +42,7 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
>>>>             file://0025-Define-DUMMY_LOCALE_T-if-not-defined.patch \
>>>>             file://0026-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch \
>>>>             file://0027-locale-fix-hard-coded-reference-to-gcc-E.patch \
>>>> +           file://0028-Kill-LIBC_LINUX_VERSION-macro.patch \
>>>>  "
>>>>  
>>>>  NATIVESDKFIXES ?= ""
>>>>
>>>


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

end of thread, other threads:[~2017-03-31 15:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-28 18:57 [PATCH] glibc: Support building with 2.6.32 kernels on x86 / x86_64 Serhii Popovych
2017-03-28 22:26 ` Richard Purdie
2017-03-29 11:27   ` Serhii Popovych
2017-03-29  0:03 ` Khem Raj
2017-03-29  9:57   ` Serhii Popovych
2017-03-31 10:41     ` Serhii Popovych
2017-03-31 15:19       ` Serhii Popovych
2017-03-29 10:00   ` Serhii Popovych

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.