Closed wdlkmpx closed 2 years ago
I managed to fix this locally by discarding the xxx-buildroot-linux-gnu/sysroot
directory
I compiled glibc 2.36, it automatically decided that kernel 3.2.0 is the minimum linux version supported, so you guys should remove --enable-kernel=...
from the glibc configure params
These are the params I used to compile glibc for the cross compiler, the only problem here is it takes so long to compile glibc in an old 2008 laptop, so it really should be fixed by default
compile_glibc() # assuming we're inside da toolchain sysroot
{
#glibc_url=https://ftp.gnu.org/gnu/glibc/glibc-2.36.tar.xz
if [ -f "lib/libc.a" ] ; then
return 0
fi
PKG_URL=${glibc_url}
PKG_FILE=${PKG_URL##*/} # basename
PKG_DIR=${PKG_FILE%.tar.*} # remove trailing .tar.*
# --
retrieve ${PKG_URL}
extract_pkg_and_cd
#--
src_dir=$(pwd)
build_dir=${src_dir}-build
mkdir -p ${build_dir}
cd ${build_dir}
#--
GPREFIX=${XPATH}/${TARGET_TRIPLET}
# discarded
# --enable-kernel=4.4 --enable-stack-protector=strong
# --enable-systemtap ## error: systemtap support needs sys/sdt.h with asm support
# --enable-cet
# --disable-shared # <command-line>: fatal error: .../glibc-2.36-build/libc-modules.h: No such file or directory
# --enable-static-nss # nss_module.c:153:7: error: 'is_nscd' undeclared (first use in this function)
CFLAGS="-I${GPREFIX}/include" CXXFLAGS="-I${GPREFIX}/include" \
${src_dir}/configure \
--disable-build-nscd \
--host=${TARGET_TRIPLET} \
--build=$(gcc -dumpmachine) \
--disable-timezone-tools \
--prefix=${GPREFIX} \
--with-headers=${GPREFIX}/inlcude \
--enable-bind-now \
--disable-multi-arch \
--disable-profile \
--disable-crypt \
--disable-werror \
--libdir=${GPREFIX}/lib \
--libexecdir=${GPREFIX}/lib || exit 1
make install || exit 1
rm -rf ${src_dir} ${build_dir}
}
I'm not sure why this issue got closed, it seems like a very good thing to fix in our toolchains, IMO.
Yeah it should be fixed, just find and remove --enable-kernel=...
from the glibc configure params
II've been testing these toolchains in older distros:
Both work fine on
So the cross compilers run fine on old distros but the produced binaries require linux 5.4.0 (glibc), I recompiled glibc without the kernel limitation, no need to change headers, and the compiled binaries work fine on old distros
This is a glibc-specific problem, there's no need to restrict the kernel version, people use the cross compilers at their own risk...
Talking about buildroot, the option to support older kernels was introduced on 2022-02-06 https://github.com/buildroot/buildroot/commit/525ffc2bb17fa11fc128124d2d3a92d8698eaab8
All the toolchains using Builroot 2016.02.23+ (git) are affected by the glibc kernel restriction https://github.com/buildroot/buildroot/commit/fd5bcd0eda8fb21f639c34a09b212e6f9b066a04
This is normally fixed by the recently released 2022.08 toolchains. Let me know if it works for you.
Yeah it works fine, thanks
Testing
x86-i686--glibc--stable-2021.11-1.tar.bz2
I get this error on debian stretch
currently using kernel 4.1...
Perhaps adding something like
--enable-kernel=3.2.0
or--enable-kernel=3.8.0
or--enable-kernel=3.14.0
will fix this issue. I've been using other cross compilers, and have no issues using the latest gcc (11.3) to compile static apps that run on old distroshttps://unix.stackexchange.com/questions/9705/can-new-glibc-versions-be-used-with-an-old-kernel