I am tying to cross-compile GLIBC_2.36 from source for ARM. I am using arm-linux-gnueabihf toolchain to do this. The command I am passing from my build directory is below:
../glibc-2.36/configure --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf --prefix=$PWD --enable-kernel=5.10 CFLAGS="-O2 -Wno-error=pragmas -Wno-error=builtin-declaration-mismatch"
Then I do make -j4 to start the build process but it fails with the below error:
In file included from <command-line>:
iofgetpos.c:84:40: error: conflicting types for ‘fgetpos’; have ‘int(FILE *, __fpos_t *)’ {aka ‘int(struct _IO_FILE *, struct _G_fpos_t *)’}
84 | versioned_symbol (libc, __new_fgetpos, fgetpos, GLIBC_2_2);
| ^~~~~~~
./../include/libc-symbols.h:155:26: note: in definition of macro ‘_weak_alias’
155 | extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))) \
| ^~~~~~~~~
../include/shlib-compat.h:117:3: note: in expansion of macro ‘weak_alias’
117 | weak_alias (local, symbol)
| ^~~~~~~~~~
iofgetpos.c:84:1: note: in expansion of macro ‘versioned_symbol’
84 | versioned_symbol (libc, __new_fgetpos, fgetpos, GLIBC_2_2);
| ^~~~~~~~~~~~~~~~
In file included from ../include/sys/cdefs.h:10,
from ../include/features.h:490,
from ../stdlib/errno.h:25,
from ../include/errno.h:2,
from libioP.h:40,
from iofgetpos.c:34:
../libio/stdio.h:768:24: note: previous declaration of ‘fgetpos’ with type ‘int(FILE * restrict, fpos_t * restrict)’ {aka ‘int(struct _IO_FILE * restrict, struct _G_fpos64_t * restrict)’}
768 | extern int __REDIRECT (fgetpos, (FILE *__restrict __stream,
| ^~~~~~~
../misc/sys/cdefs.h:247:41: note: in definition of macro ‘__REDIRECT’
247 | # define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias))
I need GLIBC_2.36 specifically since my target platform has this version, and static linking is not an option. My build platform is x86_64
../glibc-2.36/configure --target=arm-linux-gneabihf --prefix=$PWD --enable-kernel=5.10 CFLAGS="-O2 -Wno-error=pragmas -Wno-error=builtin-declaration-mismatch"filein linux i found that it's compiled for ARM.--hostit tries to make a native build but uses your specification rather than guessing. Looking at the docs, you need--buildto specify what you are building on and--hostfor the system that the library is for.