biren@ubuntu:~/crossbuild/src/linux-5.5.15$ cd ../build-glibc/
biren@ubuntu:~/crossbuild/src/build-glibc$ ../glibc-2.28/configure --prefix=/home/biren/crossbuild/toolchain/aarch64-linux-gnueabihf --target=aarch64-linux-gnueabihf --with-headers=/home/biren/crossbuild/toolchain/aarch64-linux-gnueabihf/include --build=$MACHTYPE --host=aarch64-linux-gnueabihf --disable-multilib libc_cv_forced_unwind=yes
biren@ubuntu:~/crossbuild/src/build-glibc$ make install-bootstrap-headers=yes install-headers
biren@ubuntu:~/crossbuild/src/build-glibc$ make csu/subdir_lib
biren@ubuntu:~/crossbuild/src/build-glibc$ install csu/crt1.o csu/crti.o csu/crtn.o /home/biren/crossbuild/toolchain/aarch64-linux-gnueabihf/lib
biren@ubuntu:~/crossbuild/src/build-glibc$ aarch64-linux-gnueabihf-gcc -nostdlib -nostartfiles -shared -x c /dev/null -o /home/biren/crossbuild/toolchain/aarch64-linux-gnueabihf/lib/libc.so
biren@ubuntu:~/crossbuild/src/build-glibc$ touch /home/biren/crossbuild/toolchain/aarch64-linux-gnueabihf/include/gnu/stubs.h
问题一:
cpu-features.c:60:35: error: ‘glibc_tune_cpu’ undeclared (first use in this function); did you mean ‘glibc_tune_hwcaps’?
../sysdeps/unix/sysv/linux/aarch64/cpu-features.c: In function ‘init_cpu_features’:
../sysdeps/unix/sysv/linux/aarch64/cpu-features.c:60:35: error: ‘glibc_tune_cpu’ undeclared (first use in this function); did you mean ‘glibc_tune_hwcaps’?
const char *mcpu = TUNABLE_GET (glibc, tune, cpu, const char *, NULL);
^~~~~
../elf/dl-tunables.h:65:46: note: in definition of macro ‘TUNABLE_ENUM_NAME1’
# define TUNABLE_ENUM_NAME1(__top,__ns,__id) __top ## _ ## __ns ## _ ## __id
^~~~~
../elf/dl-tunables.h:94:21: note: in expansion of macro ‘TUNABLE_ENUM_NAME’
tunable_id_t id = TUNABLE_ENUM_NAME (__top, __ns, __id);
/home/biren/crossbuild/src/build-glibc/sysd-rules:9: recipe for target '/home/biren/crossbuild/src/build-glibc/csu/libc-start.o' failed
make[2]: *** [/home/biren/crossbuild/src/build-glibc/csu/libc-start.o] Error 1
make[2]: Leaving directory '/home/biren/crossbuild/src/glibc-2.28/csu'
Makefile:258: recipe for target 'csu/subdir_lib' failed
make[1]: *** [csu/subdir_lib] Error 2
make[1]: Leaving directory '/home/biren/crossbuild/src/glibc-2.28'
Makefile:9: recipe for target 'csu/subdir_lib' failed
make: *** [csu/subdir_lib] Error 2
原因:
是在configure参数里指定了ARCH,删除ARCH=arm64这个即可
…/glibc-2.28/configure ARCH=arm64 --prefix=/home/biren/crossbuild/toolchain/aarch64-linux-gnueabihf --target=aarch64-linux-gnueabihf --with-headers=/home/biren/crossbuild/toolchain/aarch64-linux-gnueabihf/include --build=$MACHTYPE --host=aarch64-linux-gnueabihf --disable-multilib libc_cv_forced_unwind=yes
问题二:
prctl.h:5:15: fatal error: asm/prctl.h: No such file or directory
#include_next <asm/prctl.h>