目标:
编译出libc库文件,进行替换验证;
下载源码:
https://www.gnu.org/software/libc/
编译:
mkdir libc
cd libc
tar -xzf glibc-2.18.tar.gz
cd glibc-2.18/
mkdir build
cd build
../configure CC=arm-cortex_a9-linux-gnueabi-gcc CXX=arm-cortex_a9-linux-gnueabi-g++ --host=arm-linux-gnueabi --build=i686-pc-linux-gnu --prefix=$ROOTDIR/out --enable-add-ons=nptl,ports --with-headers=$ROOTDIR/headers/include --enable-kernel=3.4.39 libc_cv_forced_unwind=yes libc_cv_ctors_header=yes libc_cv_c_cleanup=yes --disable-oldest-abi
make
make install
编译过程中问题及解决:
问题1:
configure: error: Old ABI no longer supported
解决:
--host=arm-linux-gnueabi
(
这里如果为--host=arm-linux将会报上面的错误,因为
glibc-2.18/ports/sysdeps/arm/preconfigure中要求--host=arm-linux-gnueabi
5 arm*)
6 case $config_os in
7 linux-gnueabi*)
8 # If the compiler enables unwind tables by default, this causes
9 # problems with undefined symbols in -nostdlib link tests. To
10 # avoid this, add -fno-unwind-tables here and remove it in
11 # sysdeps/unix/sysv/linux/arm/configure.in after those tests have
12 # been run.
13 if test "${CFLAGS+set}" != "set"; then
14 CFLAGS="-g -O2"
15 fi
16 CFLAGS="$CFLAGS -fno-unwind-tables"
17 ;;
18 linux*)
19 as_fn_error $? "Old ABI no longer supported" "$LINENO" 5
20 ;;
)