linux查看线程/进程/调用栈信息-pstack/pstree

本文通过使用pstree、ps及pstack等命令,详细分析了一个名为ad_preprocess的进程及其所启动的多个子线程的情况,展示了如何查看进程树、获取进程详细信息以及追踪线程的具体状态。
部署运行你感兴趣的模型镜像
¥ pstree -p work | grep ad
sshd(22669)---bash(22670)---ad_preprocess(4551)-+-{ad_preprocess}(4552)
                                                |-{ad_preprocess}(4553)
                                                |-{ad_preprocess}(4554)
                                                |-{ad_preprocess}(4555)
                                                |-{ad_preprocess}(4556)
                                                `-{ad_preprocess}(4557)


work为工感化户,-p为显示过程辨认码,ad_preprocess共启动了6个子线程,加上主线程共7个线程

2. ps -Lf

¥ ps -Lf 4551
UID        PID  PPID   LWP  C NLWP STIME TTY      STAT   TIME CMD
work      4551 22670  4551  2    7 16:30 pts/2    Sl+    0:02 ./ad_preprocess
work      4551 22670  4552  0    7 16:30 pts/2    Sl+    0:00 ./ad_preprocess
work      4551 22670  4553  0    7 16:30 pts/2    Sl+    0:00 ./ad_preprocess
work      4551 22670  4554  0    7 16:30 pts/2    Sl+    0:00 ./ad_preprocess
work      4551 22670  4555  0    7 16:30 pts/2    Sl+    0:00 ./ad_preprocess
work      4551 22670  4556  0    7 16:30 pts/2    Sl+    0:00 ./ad_preprocess
work      4551 22670  4557  0    7 16:30 pts/2    Sl+    0:00 ./ad_preprocess

过程共启动了7个线程

3. pstack

pstack显示每个过程的栈跟踪

¥ pstack 4551
Thread 7 (Thread 1084229984 (LWP 4552)):
#0  0 x000000302afc63dc in epoll_wait () /lib64/tls/libc.so.6
#1  0 x00000000006f0730 in ub::EPollEx::poll ()
#2  0 x00000000006f172a in ub::NetReactor::callback ()
#3  0 x00000000006fbbbb in ub::UBTask::CALLBACK ()
#4  0 x000000302b80610a in start_thread () /lib64/tls/libpthread.so.0
#5  0 x000000302afc6003 in clone () /lib64/tls/libc.so.6
#6  0 x0000000000000000 in ?? ()
Thread 6 (Thread 1094719840 (LWP 4553)):
#0  0 x000000302afc63dc in epoll_wait () /lib64/tls/libc.so.6
#1  0 x00000000006f0730 in ub::EPollEx::poll ()
#2  0 x00000000006f172a in ub::NetReactor::callback ()
#3  0 x00000000006fbbbb in ub::UBTask::CALLBACK ()
#4  0 x000000302b80610a in start_thread () /lib64/tls/libpthread.so.0
#5  0 x000000302afc6003 in clone () /lib64/tls/libc.so.6
#6  0 x0000000000000000 in ?? ()
Thread 5 (Thread 1105209696 (LWP 4554)):
#0  0 x000000302b80baa5 in __nanosleep_nocancel ()
#1  0 x000000000079e758 in comcm::ms_sleep ()
#2  0 x00000000006c8581 in ub::UbClientManager::healthyCheck ()
#3  0 x00000000006c8471 in ub::UbClientManager::start_healthy_check ()
#4  0 x000000302b80610a in start_thread () /lib64/tls/libpthread.so.0
#5  0 x000000302afc6003 in clone () /lib64/tls/libc.so.6
#6  0 x0000000000000000 in ?? ()
Thread 4 (Thread 1115699552 (LWP 4555)):
#0  0 x000000302b80baa5 in __nanosleep_nocancel ()
#1  0 x0000000000482b0e in armor::armor_check_thread ()
#2  0 x000000302b80610a in start_thread () /lib64/tls/libpthread.so.0
#3  0 x000000302afc6003 in clone () /lib64/tls/libc.so.6
#4  0 x0000000000000000 in ?? ()
Thread 3 (Thread 1126189408 (LWP 4556)):
#0  0 x000000302af8f1a5 in __nanosleep_nocancel () /lib64/tls/libc.so.6
#1  0 x000000302af8f010 in sleep () /lib64/tls/libc.so.6
#2  0 x000000000044c972 in Business_config_manager::run ()
#3  0 x0000000000457b83 in Thread::run_thread ()
#4  0 x000000302b80610a in start_thread () /lib64/tls/libpthread.so.0
#5  0 x000000302afc6003 in clone () /lib64/tls/libc.so.6
#6  0 x0000000000000000 in ?? ()
Thread 2 (Thread 1136679264 (LWP 4557)):
#0  0 x000000302af8f1a5 in __nanosleep_nocancel () /lib64/tls/libc.so.6
#1  0 x000000302af8f010 in sleep () /lib64/tls/libc.so.6
#2  0 x00000000004524bb in Process_thread::sleep_period ()
#3  0 x0000000000452641 in Process_thread::run ()
#4  0 x0000000000457b83 in Thread::run_thread ()
#5  0 x000000302b80610a in start_thread () /lib64/tls/libpthread.so.0
#6  0 x000000302afc6003 in clone () /lib64/tls/libc.so.6
#7  0 x0000000000000000 in ?? ()
Thread 1 (Thread 182894129792 (LWP 4551)):
#0  0 x000000302af8f1a5 in __nanosleep_nocancel () /lib64/tls/libc.so.6
#1  0 x000000302af8f010 in sleep () /lib64/tls/libc.so.6
#2  0 x0000000000420d79 in Ad_preprocess::run ()
#3  0 x0000000000450ad0 in main ()巴尔扎克


您可能感兴趣的与本文相关的镜像

Dify

Dify

AI应用
Agent编排

Dify 是一款开源的大语言模型(LLM)应用开发平台,它结合了 后端即服务(Backend as a Service) 和LLMOps 的理念,让开发者能快速、高效地构建和部署生产级的生成式AI应用。 它提供了包含模型兼容支持、Prompt 编排界面、RAG 引擎、Agent 框架、工作流编排等核心技术栈,并且提供了易用的界面和API,让技术和非技术人员都能参与到AI应用的开发过程中

fi /bin/bash ./../../mkinstalldirs /home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/ipkg-install/usr/share/gdb/system-gdbinit mkdir -p -- /home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/ipkg-install/usr/share/gdb/system-gdbinit files='elinos.py wrs-linux.py' ; \ for file in $files; do \ f=./../system-gdbinit/$file ; \ if test -f $f ; then \ /usr/bin/install -c -m 644 $f /home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/ipkg-install/usr/share/gdb/system-gdbinit ; \ fi ; \ done make[9]: Leaving directory '/home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/gdb/data-directory' make[8]: Leaving directory '/home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/gdb/data-directory' make[8]: Entering directory '/home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/gdb/build-gnulib' make[9]: Entering directory '/home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/gdb/build-gnulib' make[10]: Entering directory '/home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/gdb/build-gnulib/import' make all-recursive make[11]: Entering directory '/home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/gdb/build-gnulib/import' make[12]: Entering directory '/home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/gdb/build-gnulib/import' make[12]: Nothing to be done for 'all-am'. make[12]: Leaving directory '/home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/gdb/build-gnulib/import' make[11]: Leaving directory '/home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/gdb/build-gnulib/import' make[10]: Leaving directory '/home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/gdb/build-gnulib/import' make[9]: Leaving directory '/home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/gdb/build-gnulib' make[9]: Entering directory '/home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/gdb/build-gnulib' make[10]: Entering directory '/home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/gdb/build-gnulib' make[11]: Entering directory '/home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/gdb/build-gnulib/import' make install-recursive make[12]: Entering directory '/home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/gdb/build-gnulib/import' make[13]: Entering directory '/home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/gdb/build-gnulib/import' make[14]: Entering directory '/home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/gdb/build-gnulib/import' if test yes = no; then \ case 'linux-gnu' in \ darwin[56]*) \ need_charset_alias=true ;; \ darwin* | cygwin* | mingw* | pw32* | cegcc*) \ need_charset_alias=false ;; \ *) \ need_charset_alias=true ;; \ esac ; \ else \ need_charset_alias=false ; \ fi ; \ if $need_charset_alias; then \ /bin/bash ../.././gnulib/../../mkinstalldirs /home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/ipkg-install/usr/lib ; \ fi ; \ if test -f /home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/ipkg-install/usr/lib/charset.alias; then \ sed -f ref-add.sed /home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/ipkg-install/usr/lib/charset.alias > /home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/ipkg-install/usr/lib/charset.tmp ; \ /usr/bin/install -c -m 644 /home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/ipkg-install/usr/lib/charset.tmp /home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/ipkg-install/usr/lib/charset.alias ; \ rm -f /home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/ipkg-install/usr/lib/charset.tmp ; \ else \ if $need_charset_alias; then \ sed -f ref-add.sed charset.alias > /home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/ipkg-install/usr/lib/charset.tmp ; \ /usr/bin/install -c -m 644 /home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/ipkg-install/usr/lib/charset.tmp /home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/ipkg-install/usr/lib/charset.alias ; \ rm -f /home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/ipkg-install/usr/lib/charset.tmp ; \ fi ; \ fi make[14]: Nothing to be done for 'install-data-am'. make[14]: Leaving directory '/home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/gdb/build-gnulib/import' make[13]: Leaving directory '/home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/gdb/build-gnulib/import' make[12]: Leaving directory '/home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/gdb/build-gnulib/import' make[11]: Leaving directory '/home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/gdb/build-gnulib/import' make[10]: Leaving directory '/home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/gdb/build-gnulib' make[9]: Leaving directory '/home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/gdb/build-gnulib' make[8]: Leaving directory '/home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/gdb/build-gnulib' make[7]: Leaving directory '/home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/gdb' make[6]: Leaving directory '/home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/gdb' make[5]: Leaving directory '/home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/gdb' make[4]: Leaving directory '/home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1' touch /home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/.built mkdir -p /home/felix/mydisk/enterprise_gateway/bin/cn913x-cn25g-vpp_v1/packages /home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/ipkg-cn913x/gdb/CONTROL /home/felix/mydisk/enterprise_gateway/staging_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/pkginfo install -d -m0755 /home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/ipkg-cn913x/gdb/usr/bin /home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/ipkg-cn913x/gdb/usr/sbin/ install -m0755 /home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/ipkg-install/usr/bin/gdb /home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/ipkg-cn913x/gdb/usr/bin/ install -m0755 ./files/usr/sbin/pstack /home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/ipkg-cn913x/gdb/usr/sbin/ find /home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/ipkg-cn913x/gdb -name 'CVS' -o -name '.svn' -o -name '.#*' -o -name '*~'| xargs -r rm -rf export CROSS="aarch64-marvell-linux-gnu-" NO_RENAME=1 ; NM="aarch64-marvell-linux-gnu-nm" STRIP="/home/felix/mydisk/enterprise_gateway/staging_dir/host/bin/sstrip" STRIP_KMOD="/home/felix/mydisk/enterprise_gateway/scripts/strip-kmod.sh" /home/felix/mydisk/enterprise_gateway/scripts/rstrip.sh /home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/ipkg-cn913x/gdb rstrip.sh: /home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/ipkg-cn913x/gdb/usr/bin/gdb:executable ( echo "Package: gdb"; echo "Version: 8.1-1"; DEPENDS=''; for depend in libc zlib libreadline libncurses zlib; do DEPENDS=${DEPENDS:+$DEPENDS, }${depend##+}; done; [ -z "$DEPENDS" ] || echo "Depends: $DEPENDS"; echo "Source: package/devel/gdb"; echo "License: GPL-3.0+"; echo "Section: devel"; echo "Architecture: cn913x"; echo "Installed-Size: 0"; echo -n "Description: "; . /home/felix/mydisk/enterprise_gateway/include/shell.sh; getvar V_Package_gdb_description | sed -e 's,^[[:space:]]*, ,g'; ) > /home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/ipkg-cn913x/gdb/CONTROL/control chmod 644 /home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/ipkg-cn913x/gdb/CONTROL/control . /home/felix/mydisk/enterprise_gateway/include/shell.sh; (cd /home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/ipkg-cn913x/gdb/CONTROL; ) install -d -m0755 /home/felix/mydisk/enterprise_gateway/bin/cn913x-cn25g-vpp_v1/packages ipkg-build -c -o 0 -g 0 /home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/ipkg-cn913x/gdb /home/felix/mydisk/enterprise_gateway/bin/cn913x-cn25g-vpp_v1/packages Packaged contents of /home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/ipkg-cn913x/gdb into /home/felix/mydisk/enterprise_gateway/bin/cn913x-cn25g-vpp_v1/packages/gdb_8.1-1_cn913x.ipk rm -rf /home/felix/mydisk/enterprise_gateway/staging_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/root-cn913x/tmp-gdb mkdir -p /home/felix/mydisk/enterprise_gateway/staging_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/root-cn913x/stamp /home/felix/mydisk/enterprise_gateway/staging_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/root-cn913x/tmp-gdb install -d -m0755 /home/felix/mydisk/enterprise_gateway/staging_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/root-cn913x/tmp-gdb/usr/bin /home/felix/mydisk/enterprise_gateway/staging_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/root-cn913x/tmp-gdb/usr/sbin/ install -m0755 /home/felix/mydisk/enterprise_gateway/build_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/gdb-8.1/ipkg-install/usr/bin/gdb /home/felix/mydisk/enterprise_gateway/staging_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/root-cn913x/tmp-gdb/usr/bin/ install -m0755 ./files/usr/sbin/pstack /home/felix/mydisk/enterprise_gateway/staging_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/root-cn913x/tmp-gdb/usr/sbin/ SHELL= /home/felix/mydisk/enterprise_gateway/staging_dir/host/bin/flock /home/felix/mydisk/enterprise_gateway/tmp/.root-copy.flock -c 'cp -fpR /home/felix/mydisk/enterprise_gateway/staging_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/root-cn913x/tmp-gdb/. /home/felix/mydisk/enterprise_gateway/staging_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/root-cn913x/' rm -rf /home/felix/mydisk/enterprise_gateway/staging_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/root-cn913x/tmp-gdb touch /home/felix/mydisk/enterprise_gateway/staging_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/root-cn913x/stamp/.gdb_installed if [ -f /home/felix/mydisk/enterprise_gateway/staging_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/pkginfo/gdb.default.install.clean ]; then rm -f /home/felix/mydisk/enterprise_gateway/staging_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/pkginfo/gdb.default.install /home/felix/mydisk/enterprise_gateway/staging_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/pkginfo/gdb.default.install.clean; fi; echo "gdb" >> /home/felix/mydisk/enterprise_gateway/staging_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/pkginfo/gdb.default.install WARNING: skipping gdbserver -- package not selected make[3]: Leaving directory '/home/felix/mydisk/enterprise_gateway/package/devel/gdb' make[2]: Leaving directory '/home/felix/mydisk/enterprise_gateway' package/Makefile:190: recipe for target '/home/felix/mydisk/enterprise_gateway/staging_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/stamp/.package_compile' failed make[1]: *** [/home/felix/mydisk/enterprise_gateway/staging_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/stamp/.package_compile] Error 2 make[1]: Leaving directory '/home/felix/mydisk/enterprise_gateway' /home/felix/mydisk/enterprise_gateway/include/toplevel.mk:171: recipe for target 'world' failed make: *** [world] Error 2 这个报错怎么解决啊
07-30
### 问题分析 用户在编译过程中遇到如下错误信息: ``` package/Makefile:190: recipe for target '/home/felix/mydisk/enterprise_gateway/staging_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/stamp/.package_compile' failed make[1]: *** [/home/felix/mydisk/enterprise_gateway/staging_dir/target-aarch64-marvell-linux-gnu-cn25g-vpp_v1/stamp/.package_compile] Error 2 ``` 该错误表明在 `make` 编译流程中,`package_compile` 目标未能成功执行,通常由依赖项缺失、路径错误或配置不完整引起。从 OpenWrt 构建系统的角度来看,`staging_dir` 是编译过程中用于存放中间构建结果的目录,若该目录下的 `.package_compile` 文件未能正确生成,则说明某个 package 编译失败[^1]。 ### 解决方案 #### 1. 检查依赖项和路径配置 确保所有依赖库和源码路径正确配置。OpenWrt 编译系统依赖于 `feeds` 和 `package` 目录下的符号链接,若路径错误或链接缺失,会导致编译失败。检查如下内容: - 确认 `feeds` 是否已正确更新和安装: ```bash ./scripts/feeds update -a ./scripts/feeds install -a ``` - 检查 `package/` 目录下的依赖是否完整,特别是与 `cn25g-vpp_v1` 相关的模块。 #### 2. 启用详细输出排查错误 使用 `V=s` 参数可启用详细输出,便于定位具体失败的 package: ```bash make V=s package/Makefile ``` 此方式会显示完整的编译日志,有助于识别哪个 package 或命令导致了 `package_compile` 失败。 #### 3. 清理并重新编译 执行 `make clean` 或 `make dirclean` 清理构建环境,确保没有残留文件干扰编译过程: ```bash make clean make dirclean ``` 若仍无法解决,可尝试清除整个 `staging_dir` 和 `build_dir`: ```bash rm -rf staging_dir build_dir make V=s ``` #### 4. 检查交叉编译工具链 由于目标平台为 `aarch64-marvell-linux-gnu`,需确保交叉编译工具链正确配置。若工具链版本不匹配或缺失,可能导致编译失败。检查以下内容: - 确保 `toolchain/gcc` 路径下的编译器版本与内核版本兼容。 - 若使用了自定义工具链,确认其路径已正确写入 `Makefile` 或 `config/target.in`。 #### 5. 单线程编译排查依赖冲突 若多线程编译(如 `-j4`)导致依赖冲突,可尝试使用单线程模式执行: ```bash make -j1 V=s ``` 此方式可避免并行编译中的依赖竞争问题,有助于识别是否为并发导致的错误。 ###
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值