静态交叉编译错误

当通过增加-static静态交叉编译的时候,编译出现以下问题:

libc.a(vfprintf.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
libc.a(vfprintf.o):(.ARM.exidx+0x10): undefined reference to `__aeabi_unwind_cpp_pr1'
libc.a(vfwprintf.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
libc.a(vfwprintf.o):(.ARM.exidx+0x18): undefined reference to `__aeabi_unwind_cpp_pr1'
libpthread.a(ptw-close.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
libpthread.a(ptw-close.o):(.ARM.exidx+0x10): undefined reference to `__aeabi_unwind_cpp_pr1'
libpthread.a(ptw-open.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
libpthread.a(ptw-open.o):(.ARM.exidx+0x10): undefined reference to `__aeabi_unwind_cpp_pr1'
libpthread.a(cancellation.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
libpthread.a(unwind.o): In function `unwind_stop':
unwind.c:(.text+0x28): undefined reference to `_Unwind_GetCFA'
unwind.c:(.text+0x60): undefined reference to `_Unwind_GetCFA'
libpthread.a(unwind.o): In function `__pthread_unwind':
unwind.c:(.text+0x124): undefined reference to `_Unwind_ForcedUnwind'
libpthread.a(unwind.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
libc.a(libc-start.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
libc.a(bsearch.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
libc.a(msort.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
libc.a(printf.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr1'
libc.a(isoc99_scanf.o): In function `__isoc99_scanf':
isoc99_scanf.c:(.text+0x184): undefined reference to `_Unwind_Resume'
libc.a(isoc99_scanf.o):(.ARM.extab+0x0): undefined reference to `__gcc_personality_v0'
libc.a(iofclose.o): In function `_IO_fclose':
iofclose.c:(.text+0x250): undefined reference to `_Unwind_Resume'
libc.a(iofclose.o):(.ARM.extab+0x0): undefined reference to `__gcc_personality_v0'
libc.a(iofflush.o): In function `fflush':
iofflush.c:(.text+0x15c): undefined reference to `_Unwind_Resume'
libc.a(iofflush.o):(.ARM.extab+0x0): undefined reference to `__gcc_personality_v0'
libc.a(iofopen.o):(.ARM.exidx+0x8): undefined reference to `__aeabi_unwind_cpp_pr0'
libc.a(iofread.o): In function `fread':
iofread.c:(.text+0x174): undefined reference to `_Unwind_Resume'
libc.a(iofread.o):(.ARM.extab+0x0): undefined reference to `__gcc_personality_v0'
libc.a(iofwrite.o): In function `fwrite':
iofwrite.c:(.text+0x1a0): undefined reference to `_Unwind_Resume'
libc.a(iofwrite.o):(.ARM.extab+0x0): undefined reference to `__gcc_personality_v0'
libc.a(ioputs.o): In function `puts':
ioputs.c:(.text+0x1c4): undefined reference to `_Unwind_Resume'
libc.a(ioputs.o):(.ARM.extab+0x0): undefined reference to `__gcc_personality_v0'
libc.a(wfileops.o): In function `_IO_wfile_underflow':
wfileops.c:(.text+0x680): undefined reference to `_Unwind_Resume'
libc.a(wfileops.o):(.ARM.extab+0x0): undefined reference to `__gcc_personality_v0'
libc.a(wfileops.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
libc.a(fseek.o): In function `fseek':
fseek.c:(.text+0x16c): undefined reference to `_Unwind_Resume'
libc.a(fseek.o):(.ARM.extab+0x0): undefined reference to `__gcc_personality_v0'
libc.a(getchar.o): In function `getchar':
getchar.c:(.text+0x160): undefined reference to `_Unwind_Resume'
libc.a(getchar.o):(.ARM.extab+0x0): undefined reference to `__gcc_personality_v0'
libc.a(fileops.o): In function `_IO_file_underflow':
fileops.c:(.text+0x934): undefined reference to `_Unwind_Resume'
libc.a(fileops.o):(.ARM.extab+0x0): undefined reference to `__gcc_personality_v0'
libc.a(fileops.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
libc.a(fileops.o):(.ARM.exidx+0x58): undefined reference to `__aeabi_unwind_cpp_pr1'
libc.a(genops.o):(.ARM.exidx+0x38): undefined reference to `__aeabi_unwind_cpp_pr0'
libc.a(sysconf.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
libc.a(sched_yield.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
libc.a(read.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
libc.a(read.o):(.ARM.exidx+0x10): undefined reference to `__aeabi_unwind_cpp_pr1'
libc.a(write.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
libc.a(write.o):(.ARM.exidx+0x10): undefined reference to `__aeabi_unwind_cpp_pr1'
libc.a(fcntl.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr1'
libc.a(getrlimit.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
libc.a(ioctl.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
libc.a(select.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
libc.a(select.o):(.ARM.exidx+0x10): undefined reference to `__aeabi_unwind_cpp_pr1'
libc.a(munmap.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
libc.a(mprotect.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
libc.a(madvise.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
libc.a(tsearch.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
libc.a(getsysstats.o):(.ARM.exidx+0x8): undefined reference to `__aeabi_unwind_cpp_pr0'
libc.a(mremap.o):(.ARM.exidx+0x0): more undefined references to `__aeabi_unwind_cpp_pr0' follow
libc.a(backtrace.o): In function `backtrace_helper':
backtrace.c:(.text+0x34): undefined reference to `_Unwind_VRS_Get'
libc.a(backtrace.o): In function `backtrace':
backtrace.c:(.text+0x94): undefined reference to `_Unwind_Backtrace'
libc.a(backtrace.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr1'
libc.a(sigrestorer.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr1'
libc.a(qsort.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
libc.a(fprintf.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr1'
libc.a(vfscanf.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
libc.a(vfscanf.o):(.ARM.exidx+0x8): undefined reference to `__aeabi_unwind_cpp_pr1'
libc.a(iofputs.o): In function `fputs':
iofputs.c:(.text+0x184): undefined reference to `_Unwind_Resume'
libc.a(iofputs.o):(.ARM.extab+0x0): undefined reference to `__gcc_personality_v0'
libc.a(iogetdelim.o): In function `__getdelim':
iogetdelim.c:(.text+0x2b0): undefined reference to `_Unwind_Resume'
libc.a(iogetdelim.o):(.ARM.extab+0x0): undefined reference to `__gcc_personality_v0'
libc.a(iogetline.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
libc.a(ioseekoff.o): In function `_IO_seekoff':
ioseekoff.c:(.text+0x25c): undefined reference to `_Unwind_Resume'
libc.a(ioseekoff.o):(.ARM.extab+0x0): undefined reference to `__gcc_personality_v0'
libc.a(wgenops.o):(.ARM.exidx+0x38): undefined reference to `__aeabi_unwind_cpp_pr0'
libc.a(ftello.o): In function `ftello':
ftello.c:(.text+0x1f4): undefined reference to `_Unwind_Resume'
libc.a(ftello.o):(.ARM.extab+0x0): undefined reference to `__gcc_personality_v0'
libc.a(uname.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
libc.a(getuid.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
libc.a(geteuid.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
libc.a(getgid.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
libc.a(getegid.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
libc.a(lseek.o):(.ARM.exidx+0x0): more undefined references to `__aeabi_unwind_cpp_pr0' follow
libc.a(writev.o):(.ARM.exidx+0x10): undefined reference to `__aeabi_unwind_cpp_pr1'
libc.a(dl-lookup.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
libc.a(dl-tlsdesc.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
libc.a(dl-tlsdesc.o):(.ARM.exidx+0x10): undefined reference to `__aeabi_unwind_cpp_pr1'
libc.a(dl-runtime.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
libc.a(setitimer.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'

可通过增加编译参数-lc -lgcc_eh解决这个问题。

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
### 回答1: libmnl是一个用于内核与用户空间之间通信的库,提供了一些函数和数据结构,可以方便地在用户空间中进行Netlink消息的创建和处理。 若需要进行libmnl的交叉编译,则需要首先安装交叉编译工具链,并在编译时指定正确的工具链路径和相关设置选项。具体的步骤可以如下: 1. 下载libmnl源码包,可以从官方网站或GitHub上获取。 2. 解压源码包,并进入到其目录中。 3. 配置交叉编译工具链路径,例如: export CROSS_COMPILE=arm-linux-gnueabihf- 4. 配置设置选项,例如: ./configure --host=arm-linux-gnueabihf --prefix=/usr/arm-linux-gnueabihf 其中,--host选项指定目标机器的体系结构和操作系统;--prefix选项指定交叉编译后的库文件和头文件安装路径。 5. 执行make命令进行编译,例如: make -j4 其中,-j选项指定并行编译的进程数,可以根据实际情况进行调整。 6. 编译完成后,执行make install命令进行安装,例如: make install 安装完成后,可以在指定的安装路径中找到生成的库文件和头文件,就可以在交叉编译的项目中使用libmnl库了。 ### 回答2: libmnl是一个Linux内核中的用户空间库,它提供了简单的接口来访问netlink家族协议(一种套接字协议)的控制功能。如果你想要在嵌入式系统或其他特定平台上使用libmnl,你可能需要进行交叉编译。下面是关于libmnl交叉编译的一些信息和步骤: 1. 下载libmnl的源代码:你可以从libmnl的官方网站或者其他源码库中下载最新版本的libmnl源码文件。进入下载目录,使用命令行工具解压文件。 2. 准备交叉编译环境:为了进行交叉编译,你需要准备一个包含交叉编译器的工具链(toolchain)。你可以使用现有的工具链,或者自己构建。一旦你有了工具链,你需要将其添加到系统环境变量中。 3. 配置libmnl:进入解压后的libmnl目录,运行./configure命令,它会根据你的系统配置进行设置。在这个命令中,你可以指定交叉编译器路径、构建工具和其他选项。如果你使用了自己构建的工具链,你需要指定交叉编译器和库路径。 4. 构建libmnl:运行make命令以开始构建过程。make工具会自动执行构建任务,包括编译和链接代码。在构建过程中可能会出现错误,需要根据错误提示进行调试。如果一切正常,将生成libmnl库的静态和动态链接库文件(.a和.so文件)。 5. 安装libmnl:如果你需要安装libmnl库以在其他项目中使用,运行make install命令。这将会安装libmnl库到系统默认位置,通常是/usr/lib/或/usr/local/lib/。如果你使用了自定义路径,可以在configure命令中指定路径。 以上就是关于libmnl交叉编译的基本信息和步骤。需要注意的是,不同平台和工具链的设置会有所不同,因此需要根据实际情况进行调整。 ### 回答3: 在进行libmnl交叉编译之前,需要先从官网http://www.netfilter.org/projects/libmnl/下载libmnl源代码包。下载后解压到本地磁盘。 在进行交叉编译之前,需要确保本地已经安装了交叉编译工具链,并且已经正确配置好了环境变量。 下一步,进入到libmnl源代码目录中,执行以下命令: ./configure --host=交叉编译工具链的主机名 --prefix=安装路径 其中,–host参数指定了交叉编译工具链的主机名,–prefix参数用来指定安装路径。 执行完configure脚本后,就可以执行make来进行编译了。在编译完成后,可以执行make install将编译好的库安装到指定的安装路径中。如果需要使用编译好的库文件进行开发或者测试,还需要将库文件路径添加到LD_LIBRARY_PATH环境变量中。 总之,要进行libmnl交叉编译,需要先下载源代码,然后进行configure配置和make编译,最后将编译好的库安装到指定路径中。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

chengwei_peng

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值