本文介绍了为 arm 交叉编译 glibc,得到了对一些展开函数的未定义引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我需要为我们的 armv7 soc 平台构建 glic-2.15.我按照以下步骤来构建它:

Now I need to build glic-2.15 for our armv7 soc platform. I follow the following steps to build it:

http://ftp.gnu.org/下载并提取 glibc-2.15 和 glibc-portsgnu/libc/

mkdir build-glibc
cd build-glibc
echo "CFLAGS += -D__ARM_ARCH_7__ -D__LINUX_ARM_ARCH__=7 -march=armv7 -U_FORTIFY_SOURCE -fno-stack-protector" > configparms
PATH={toolchain}/bin
BUILD_CC={build}/bin/gcc
CC={toolchain}/bin/arm-linux-gnueabihf-gcc
AR={toolchain}/bin/arm-linux-gnueabihf-ar
RANLIB={toolchain}/bin/arm-linux-gnueabihf-ranlib
../glibc-2.15/configure --prefix=/linaro-toolchain/ \
                        --exec-prefix=/linaro-toolchain/ \
                        --host=arm-linux-gnueabihf \
                        --build=i686-pc-linux-gnu \
                        --disable-profile --enable-add-ons=ports,nptl \
                        --enable-kernel=2.4.0 --with-tls --with-__thread \
                        --without-gd --without-cvs \
                        --with-headers=/linaro-toolchain/arm-linux-gnueabihf/libc/usr/include \
                        --disable-multilib --enable-shared \
                        libc_cv_forced_unwind=yes \
                        libc_cv_c_cleanup=yes \
                        lic_cv_gnu89_inline=yes lic_cv_ssp=no \
                        libc_cv_ctors_header=yes
make all

我遇到了很多问题,却被这个问题困住了:

I met many issues and got stuck with this one:

chmod 555 {glibc}/build-glibc/elf/sotruss.new
mv -f {glibc}/build-glibc/elf/sotruss.new {glibc}/build-glibc/elf/sotruss
gcc -nostdlib -nostartfiles -static -o {glibc}/build-glibc/elf/sln    {glibc}/build-glibc/csu/crt1.o {glibc}/build-glibc/csu/crti.o `gcc  --print-file-name=crtbegin.o` {glibc}/build-glibc/elf/sln.o  -Wl,--start-group {glibc}/build-glibc/libc.a -lgcc   -Wl,--end-group `gcc  --print-file-name=crtend.o` {glibc}/build-glibc/csu/crtn.o
{glibc}/build-glibc/libc.a(vfprintf.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(vfprintf.o):(.ARM.exidx+0x8): undefined reference to `__aeabi_unwind_cpp_pr1'
{glibc}/build-glibc/libc.a(vfprintf.o):(.ARM.exidx.text.unlikely+0x8): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(vfwprintf.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(vfwprintf.o):(.ARM.exidx+0x8): undefined reference to `__aeabi_unwind_cpp_pr1'
{glibc}/build-glibc/libc.a(vfwprintf.o):(.ARM.exidx.text.unlikely+0x8): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(libc-start.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(libc-do-syscall.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(bsearch.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(msort.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(fprintf.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr1'
{glibc}/build-glibc/libc.a(printf.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr1'
{glibc}/build-glibc/libc.a(iofclose.o): In function `_IO_acquire_lock_fct':
{glibc}/glibc-2.15/libio/libioP.h:969: undefined reference to `_Unwind_Resume'
{glibc}/build-glibc/libc.a(iofclose.o):(.ARM.extab+0x0): undefined reference to `__gcc_personality_v0'
{glibc}/build-glibc/libc.a(iofflush.o): In function `_IO_acquire_lock_fct':
{glibc}/glibc-2.15/libio/libioP.h:969: undefined reference to `_Unwind_Resume'
{glibc}/build-glibc/libc.a(iofflush.o):(.ARM.extab+0x0): undefined reference to `__gcc_personality_v0'
{glibc}/build-glibc/libc.a(iofopen.o):(.ARM.exidx+0x8): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(iofputs.o): In function `_IO_acquire_lock_fct':
{glibc}/glibc-2.15/libio/libioP.h:969: undefined reference to `_Unwind_Resume'
{glibc}/build-glibc/libc.a(iofputs.o):(.ARM.extab+0x0): undefined reference to `__gcc_personality_v0'
{glibc}/build-glibc/libc.a(iogetdelim.o): In function `_IO_acquire_lock_fct':
{glibc}/glibc-2.15/libio/libioP.h:969: undefined reference to `_Unwind_Resume'
{glibc}/build-glibc/libc.a(iogetdelim.o):(.ARM.extab+0x0): undefined reference to `__gcc_personality_v0'
{glibc}/build-glibc/libc.a(wfileops.o): In function `_IO_acquire_lock_fct':
{glibc}/glibc-2.15/libio/../libio/libioP.h:969: undefined reference to `_Unwind_Resume'
{glibc}/build-glibc/libc.a(wfileops.o):(.ARM.extab+0x0): undefined reference to `__gcc_personality_v0'
{glibc}/build-glibc/libc.a(wfileops.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(fileops.o): In function `_IO_acquire_lock_fct':
{glibc}/glibc-2.15/libio/libioP.h:969: undefined reference to `_Unwind_Resume'
{glibc}/build-glibc/libc.a(fileops.o):(.ARM.extab+0x0): undefined reference to `__gcc_personality_v0'
{glibc}/build-glibc/libc.a(fileops.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(genops.o):(.ARM.exidx__libc_freeres_fn+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(genops.o):(.ARM.exidx+0x38): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(genops.o):(.ARM.exidx+0x48): undefined reference to `__aeabi_unwind_cpp_pr1'
{glibc}/build-glibc/libc.a(sysconf.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(sched_yield.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(exit-thread.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(open.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(open.o):(.ARM.exidx+0x10): undefined reference to `__aeabi_unwind_cpp_pr1'
{glibc}/build-glibc/libc.a(read.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(read.o):(.ARM.exidx+0x10): undefined reference to `__aeabi_unwind_cpp_pr1'
{glibc}/build-glibc/libc.a(write.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(write.o):(.ARM.exidx+0x10): undefined reference to `__aeabi_unwind_cpp_pr1'
{glibc}/build-glibc/libc.a(access.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(fcntl.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr1'
{glibc}/build-glibc/libc.a(symlink.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(unlink.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(syslog.o): In function `__libc_cleanup_routine':
{glibc}/glibc-2.15/misc/../nptl/sysdeps/pthread/bits/libc-lock.h:432: undefined reference to `_Unwind_Resume'
{glibc}/glibc-2.15/misc/../nptl/sysdeps/pthread/bits/libc-lock.h:432: undefined reference to `_Unwind_Resume'
{glibc}/glibc-2.15/misc/../nptl/sysdeps/pthread/bits/libc-lock.h:432: undefined reference to `_Unwind_Resume'
{glibc}/glibc-2.15/misc/../nptl/sysdeps/pthread/bits/libc-lock.h:432: undefined reference to `_Unwind_Resume'
{glibc}/build-glibc/libc.a(syslog.o):(.ARM.extab+0x0): undefined reference to `__gcc_personality_v0'
{glibc}/build-glibc/libc.a(syslog.o):(.ARM.extab+0x54): undefined reference to `__gcc_personality_v0'
{glibc}/build-glibc/libc.a(syslog.o):(.ARM.extab+0x68): undefined reference to `__gcc_personality_v0'
{glibc}/build-glibc/libc.a(syslog.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(syslog.o):(.ARM.exidx+0x20): undefined reference to `__aeabi_unwind_cpp_pr1'
{glibc}/build-glibc/libc.a(mmap.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(mmap64.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(munmap.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(mprotect.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(madvise.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(tsearch.o):(.ARM.exidx+0x0): more undefined references to `__aeabi_unwind_cpp_pr0' follow
{glibc}/build-glibc/libc.a(getsysstats.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr1'
{glibc}/build-glibc/libc.a(getsysstats.o):(.ARM.exidx+0x10): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(mremap.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(connect.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(connect.o):(.ARM.exidx+0x10): undefined reference to `__aeabi_unwind_cpp_pr1'
{glibc}/build-glibc/libc.a(send.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(send.o):(.ARM.exidx+0x10): undefined reference to `__aeabi_unwind_cpp_pr1'
{glibc}/build-glibc/libc.a(socket.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(libc-cancellation.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(backtrace.o): In function `_Unwind_GetGR':
{glibc}/glibc-2.15/debug/../ports/sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind.h:251: undefined reference to `_Unwind_VRS_Get'
{glibc}/build-glibc/libc.a(backtrace.o): In function `__backtrace':
{glibc}/glibc-2.15/debug/../ports/sysdeps/arm/eabi/backtrace.c:105: undefined reference to `_Unwind_Backtrace'
{glibc}/build-glibc/libc.a(backtrace.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(backtrace.o):(.ARM.exidx+0x8): undefined reference to `__aeabi_unwind_cpp_pr1'
{glibc}/build-glibc/libc.a(vfprintf_chk.o): In function `_IO_acquire_lock_clear_flags2_fct':
{glibc}/glibc-2.15/debug/../libio/libioP.h:979: undefined reference to `_Unwind_Resume'
{glibc}/build-glibc/libc.a(vfprintf_chk.o):(.ARM.extab+0x0): undefined reference to `__gcc_personality_v0'
{glibc}/build-glibc/libc.a(sigrestorer.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr1'
{glibc}/build-glibc/libc.a(qsort.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(ioftell.o): In function `_IO_acquire_lock_fct':
{glibc}/glibc-2.15/libio/libioP.h:969: undefined reference to `_Unwind_Resume'
{glibc}/build-glibc/libc.a(ioftell.o):(.ARM.extab+0x0): undefined reference to `__gcc_personality_v0'
{glibc}/build-glibc/libc.a(iofwrite.o): In function `_IO_acquire_lock_fct':
{glibc}/glibc-2.15/libio/libioP.h:969: undefined reference to `_Unwind_Resume'
{glibc}/build-glibc/libc.a(iofwrite.o):(.ARM.extab+0x0): undefined reference to `__gcc_personality_v0'
{glibc}/build-glibc/libc.a(iogetline.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(ioseekoff.o): In function `_IO_acquire_lock_fct':
{glibc}/glibc-2.15/libio/../libio/libioP.h:969: undefined reference to `_Unwind_Resume'
{glibc}/build-glibc/libc.a(ioseekoff.o):(.ARM.extab+0x0): undefined reference to `__gcc_personality_v0'
{glibc}/build-glibc/libc.a(ioseekoff.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(wgenops.o):(.ARM.exidx+0x38): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(gettimeofday.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(uname.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(close.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(close.o):(.ARM.exidx+0x10): undefined reference to `__aeabi_unwind_cpp_pr1'
{glibc}/build-glibc/libc.a(lseek.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(writev.o): In function `ifree':
{glibc}/glibc-2.15/misc/../sysdeps/posix/writev.c:32: undefined reference to `_Unwind_Resume'
{glibc}/build-glibc/libc.a(writev.o):(.ARM.extab+0x0): undefined reference to `__gcc_personality_v0'
{glibc}/build-glibc/libc.a(writev.o):(.ARM.exidx+0x8): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(dl-lookup.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(dl-tlsdesc.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(dl-tlsdesc.o):(.ARM.exidx+0x10): undefined reference to `__aeabi_unwind_cpp_pr1'
{glibc}/build-glibc/libc.a(vfscanf.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr1'
{glibc}/build-glibc/libc.a(fseek.o): In function `_IO_acquire_lock_fct':
{glibc}/glibc-2.15/libio/libioP.h:969: undefined reference to `_Unwind_Resume'
{glibc}/build-glibc/libc.a(fseek.o):(.ARM.extab+0x0): undefined reference to `__gcc_personality_v0'
{glibc}/build-glibc/libc.a(ftello.o): In function `_IO_acquire_lock_fct':
{glibc}/glibc-2.15/libio/../libio/libioP.h:969: undefined reference to `_Unwind_Resume'
{glibc}/build-glibc/libc.a(ftello.o):(.ARM.extab+0x0): undefined reference to `__gcc_personality_v0'
{glibc}/build-glibc/libc.a(dl-runtime.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
{glibc}/build-glibc/libc.a(setitimer.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
collect2: error: ld returned 1 exit status
make[2]: *** [{glibc}/build-glibc/elf/sln] Error 1
make[2]: Leaving directory `{glibc}/glibc-2.15/elf'
make[1]: *** [elf/others] Error 2
make[1]: Leaving directory `{glibc}/glibc-2.15'
make: *** [all] Error 2

有人对此有什么想法吗?

Is there someone have any ideas about this?

推荐答案

最后我发现是因为我的 Makeconfig 漏掉了 -lgcc_eh.当 GCC 是为动态构建时,我们必须添加这个.

Finally I found it's because my Makeconfig missed -lgcc_eh. We have to add this when GCC was built for dynamic.

如果您的 GCC 仅是静态构建的,您似乎可以删除此标志.

It seems you can remove this flag if your GCC is built only static.

这篇关于为 arm 交叉编译 glibc,得到了对一些展开函数的未定义引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 14:33