当前位置: 首页 > news >正文

源码安装libunwind库

源码安装libunwind库

下载libunwind源码
https://github.com/libunwind/libunwind/releases/download/v1.7.2/libunwind-1.7.2.tar.gz
在这里插入图片描述
注:需要下载github上release版本,如果直接下载master分支上源码,将可能出现各种编译报错

Linux Centos

[root@localhost libunwind-1.7.2]# cat /etc/os-release 
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"[root@localhost libunwind-1.7.2]# 
[root@localhost gb]# pwd
/home/gb
[root@localhost gb]# mkdir build
[root@localhost gb]# ls -tlr
-rw-rw-r--. 1 gb   gb    912590 May 17 17:03 libunwind-1.7.2.tar.gz
-rw-rw-r--. 1 gb   gb   2405927 May 17 17:03 gperftools-2.16.tar.gz
drwxr-xr-x. 9 gb   gb      4096 May 17 17:05 gperftools-2.16
[root@localhost gb]# tar -zxvf libunwind-1.7.2.tar.gz
[root@localhost gb]# cd libunwind-1.7.2/
[root@localhost libunwind-1.7.2]# ./configure --prefix=/home/gb/build
[root@localhost libunwind-1.7.2]# make
[root@localhost libunwind-1.7.2]# make install
[root@localhost libunwind-1.7.2]# cd ../
[root@localhost gb]# ls -tlr
total 8984
drwxrwxr-x.  8 root root     273 Jul 30  2023 libunwind-1.7.2
-rw-rw-r--.  1 gb   gb    912590 May 17 17:03 libunwind-1.7.2.tar.gz
-rw-rw-r--.  1 gb   gb   2405927 May 17 17:03 gperftools-2.16.tar.gz
drwxr-xr-x. 10 gb   gb      4096 May 17 17:32 gperftools-2.16
drwxrwxr-x.  2 gb   gb         6 May 17 17:42 build
[root@localhost gb]#
[root@localhost gb]# cd build/
[root@localhost build]# ls -tlr
total 4
drwxr-xr-x. 3 root root 4096 May 17 17:47 lib
drwxr-xr-x. 2 root root  174 May 17 17:47 include
[root@localhost build]# cd lib
[root@localhost lib]# ls -tlr
total 5736
-rwxr-xr-x. 1 root root  627368 May 17 17:47 libunwind.so.8.0.1
lrwxrwxrwx. 1 root root      18 May 17 17:47 libunwind.so.8 -> libunwind.so.8.0.1
lrwxrwxrwx. 1 root root      18 May 17 17:47 libunwind.so -> libunwind.so.8.0.1
-rwxr-xr-x. 1 root root     967 May 17 17:47 libunwind.la
-rwxr-xr-x. 1 root root  862264 May 17 17:47 libunwind-x86_64.so.8.0.1
lrwxrwxrwx. 1 root root      25 May 17 17:47 libunwind-x86_64.so.8 -> libunwind-x86_64.so.8.0.1
lrwxrwxrwx. 1 root root      25 May 17 17:47 libunwind-x86_64.so -> libunwind-x86_64.so.8.0.1
-rwxr-xr-x. 1 root root    1048 May 17 17:47 libunwind-x86_64.la
-rwxr-xr-x. 1 root root  198296 May 17 17:47 libunwind-coredump.so.0.0.0
lrwxrwxrwx. 1 root root      27 May 17 17:47 libunwind-coredump.so.0 -> libunwind-coredump.so.0.0.0
lrwxrwxrwx. 1 root root      27 May 17 17:47 libunwind-coredump.so -> libunwind-coredump.so.0.0.0
-rwxr-xr-x. 1 root root    1101 May 17 17:47 libunwind-coredump.la
-rwxr-xr-x. 1 root root  127704 May 17 17:47 libunwind-ptrace.so.0.0.0
lrwxrwxrwx. 1 root root      25 May 17 17:47 libunwind-ptrace.so.0 -> libunwind-ptrace.so.0.0.0
lrwxrwxrwx. 1 root root      25 May 17 17:47 libunwind-ptrace.so -> libunwind-ptrace.so.0.0.0
-rwxr-xr-x. 1 root root    1087 May 17 17:47 libunwind-ptrace.la
-rwxr-xr-x. 1 root root   42824 May 17 17:47 libunwind-setjmp.so.0.0.0
lrwxrwxrwx. 1 root root      25 May 17 17:47 libunwind-setjmp.so.0 -> libunwind-setjmp.so.0.0.0
lrwxrwxrwx. 1 root root      25 May 17 17:47 libunwind-setjmp.so -> libunwind-setjmp.so.0.0.0
-rwxr-xr-x. 1 root root    1087 May 17 17:47 libunwind-setjmp.la
-rw-r--r--. 1 root root 1416038 May 17 17:47 libunwind.a
-rw-r--r--. 1 root root 1736082 May 17 17:47 libunwind-x86_64.a
-rw-r--r--. 1 root root  462772 May 17 17:47 libunwind-coredump.a
-rw-r--r--. 1 root root  291124 May 17 17:47 libunwind-ptrace.a
-rw-r--r--. 1 root root   69560 May 17 17:47 libunwind-setjmp.a
lrwxrwxrwx. 1 root root      18 May 17 17:47 libunwind-generic.a -> libunwind-x86_64.a
lrwxrwxrwx. 1 root root      19 May 17 17:47 libunwind-generic.so -> libunwind-x86_64.so
drwxr-xr-x. 2 root root     137 May 17 17:47 pkgconfig
[root@localhost lib]# 

ARM64 交叉编译

[root@localhost libunwind-1.7.2]# cat /etc/os-release 
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"[root@localhost libunwind-1.7.2]# 
[root@localhost gb]# pwd
/home/gb
[root@localhost gb]# mkdir build
[root@localhost gb]# ls -tlr
-rw-rw-r--. 1 gb   gb    912590 May 17 17:03 libunwind-1.7.2.tar.gz
-rw-rw-r--. 1 gb   gb   2405927 May 17 17:03 gperftools-2.16.tar.gz
drwxr-xr-x. 9 gb   gb      4096 May 17 17:05 gperftools-2.16
[root@localhost gb]# tar -zxvf libunwind-1.7.2.tar.gz
[root@localhost gb]# cd libunwind-1.7.2/
#设置交叉工具链安装的目录
[root@localhost gb]# export PATH=$PATH:/opt/chain_tool/gcc_arm_10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin
[root@localhost libunwind-1.7.2]# ./configure --host=aarch64-none-linux-gnu --prefix=/home/gb/build
[root@localhost gperftools-2.16]# make
[root@localhost gperftools-2.16]# make install
[root@localhost gperftools-2.16]# cd ../
[root@localhost gb]# ls -tlr
total 8984
drwxrwxr-x.  8 root root     273 Jul 30  2023 libunwind-1.7.2
-rw-rw-r--.  1 gb   gb    912590 May 17 17:03 libunwind-1.7.2.tar.gz
-rw-rw-r--.  1 gb   gb   2405927 May 17 17:03 gperftools-2.16.tar.gz
drwxr-xr-x. 10 gb   gb      4096 May 17 17:32 gperftools-2.16
drwxrwxr-x.  2 gb   gb         6 May 17 17:42 build
[root@localhost gb]#
[root@localhost gb]# cd build/
[root@localhost build]# ls -tlr
total 4
drwxr-xr-x. 3 root root 4096 May 17 17:47 lib
drwxr-xr-x. 2 root root  174 May 17 17:47 include
[root@localhost build]# cd lib
[root@localhost lib]# ls -tlr
total 5736
-rwxr-xr-x. 1 root root  627368 May 17 17:47 libunwind.so.8.0.1
lrwxrwxrwx. 1 root root      18 May 17 17:47 libunwind.so.8 -> libunwind.so.8.0.1
lrwxrwxrwx. 1 root root      18 May 17 17:47 libunwind.so -> libunwind.so.8.0.1
-rwxr-xr-x. 1 root root     967 May 17 17:47 libunwind.la
-rwxr-xr-x. 1 root root  862264 May 17 17:47 libunwind-x86_64.so.8.0.1
lrwxrwxrwx. 1 root root      25 May 17 17:47 libunwind-x86_64.so.8 -> libunwind-x86_64.so.8.0.1
lrwxrwxrwx. 1 root root      25 May 17 17:47 libunwind-x86_64.so -> libunwind-x86_64.so.8.0.1
-rwxr-xr-x. 1 root root    1048 May 17 17:47 libunwind-x86_64.la
-rwxr-xr-x. 1 root root  198296 May 17 17:47 libunwind-coredump.so.0.0.0
lrwxrwxrwx. 1 root root      27 May 17 17:47 libunwind-coredump.so.0 -> libunwind-coredump.so.0.0.0
lrwxrwxrwx. 1 root root      27 May 17 17:47 libunwind-coredump.so -> libunwind-coredump.so.0.0.0
-rwxr-xr-x. 1 root root    1101 May 17 17:47 libunwind-coredump.la
-rwxr-xr-x. 1 root root  127704 May 17 17:47 libunwind-ptrace.so.0.0.0
lrwxrwxrwx. 1 root root      25 May 17 17:47 libunwind-ptrace.so.0 -> libunwind-ptrace.so.0.0.0
lrwxrwxrwx. 1 root root      25 May 17 17:47 libunwind-ptrace.so -> libunwind-ptrace.so.0.0.0
-rwxr-xr-x. 1 root root    1087 May 17 17:47 libunwind-ptrace.la
-rwxr-xr-x. 1 root root   42824 May 17 17:47 libunwind-setjmp.so.0.0.0
lrwxrwxrwx. 1 root root      25 May 17 17:47 libunwind-setjmp.so.0 -> libunwind-setjmp.so.0.0.0
lrwxrwxrwx. 1 root root      25 May 17 17:47 libunwind-setjmp.so -> libunwind-setjmp.so.0.0.0
-rwxr-xr-x. 1 root root    1087 May 17 17:47 libunwind-setjmp.la
-rw-r--r--. 1 root root 1416038 May 17 17:47 libunwind.a
-rw-r--r--. 1 root root 1736082 May 17 17:47 libunwind-x86_64.a
-rw-r--r--. 1 root root  462772 May 17 17:47 libunwind-coredump.a
-rw-r--r--. 1 root root  291124 May 17 17:47 libunwind-ptrace.a
-rw-r--r--. 1 root root   69560 May 17 17:47 libunwind-setjmp.a
lrwxrwxrwx. 1 root root      18 May 17 17:47 libunwind-generic.a -> libunwind-x86_64.a
lrwxrwxrwx. 1 root root      19 May 17 17:47 libunwind-generic.so -> libunwind-x86_64.so
drwxr-xr-x. 2 root root     137 May 17 17:47 pkgconfig
[root@localhost lib]# 

注:交叉编译libunwind-0.99.tar.gz时,出现下面报错误提示


configure: WARNING: If you wanted to set the --build type, don't use --host.If a cross compiler is detected then cross compile mode will be used.
checking for egrep... grep -E
Configuring NCURSES 5.7 ABI 5 (Tue Apr 22 11:06:28 CST 2025)
checking build system type... x86_64-unknown-linux-gnu
checking host system type... Invalid configuration `aarch64-none-linux-gnu': machine `aarch64' not recognized
configure: error: /bin/sh ../config.sub aarch64-linux-gnu failed 

解决方法:下载更高版本源码,因低版本confgiure不识别aarch64-none-linux-gnu

参考文献

libunwind github下载地址
Invalid configuration ‘aarch64-linux-gnu‘: machine ‘aarch64‘ not recognized

相关文章:

  • 常见平方数和立方数的计算
  • UDP--DDR--SFP,FPGA实现之模块梳理及AXI读写DDR读写上板测试
  • 【自然语言处理与大模型】大模型(LLM)基础知识④
  • 六、磁盘划分与磁盘配额
  • 鸿蒙ArkUI体验:Hexo博客客户端开发心得
  • day016-系统负载压力测试-磁盘管理
  • linux标准库头文件解析
  • C++ -命名空间-详解
  • chmod 777含义:
  • 全端同步!ZKmall开源商城如何用B2B2C模板让消费者跨设备购物体验无缝衔接?
  • QT之LayOut布局
  • MCP LLM Bridge:连接Model Context Protocol与OpenAI兼容LLM的桥梁
  • (4)python爬虫--JsonPath
  • 学习笔记:黑马程序员JavaWeb开发教程(2025.4.7)
  • 如何在前端页面上展示解析后的 JSON 数据?
  • DeepSeek 赋能量子计算:突破与未来图景
  • CoverM:contig/bin的相对丰度计算
  • 思路收集文档
  • 高频面试题(含笔试高频算法整理)基本总结回顾61
  • 2.单链表两数相加(java)
  • 南京艺术学院博导、雕塑家尹悟铭病逝,年仅45岁
  • 菲律宾中期选举结果揭晓,马科斯与杜特尔特家族重回“权力的游戏”
  • 上海国际碳中和博览会下月举办,首次打造民营经济专区
  • 阿里上季度营收增7%:淘天营收创新高,AI产品营收连续七个季度三位数增长
  • 商务部新闻发言人就出口管制管控名单答记者问
  • 中科飞测将投资超10亿元,在上海张江成立第二总部