Linux - Find string in files.

Linux快速查找包含特定字符串的文件
本文介绍如何使用Linux命令find、xargs和grep快速查找当前目录下包含特定字符串的PHP文件,以及如何查找最近更新的文件。通过示例展示如何使用这些命令进行高效搜索。

原帖: http://www.liamdelahunty.com/tips/linux_find_string_files.php


find . | xargs grep 'string' -sl

xargs 参照: http://zh.wikipedia.org/wiki/Xargs


The -s is for summary and won't display warning messages such as grep: ./directory-name: Is a directory

The -l is for list, so we get just the filename and not all instances of the match displayed in the results.

Performing the search on the current directory I get:


I find this useful for just quickly seeing which files contain a search time. I would normally limit the files searched with a command such as :

find . -iname '*php' | xargs grep 'string' -sl

Another common search for me, is to just look at the recently updated files:

find . -iname '*php' -mtime -1 | xargs grep 'string' -sl

would find only files edited today, whilst the following finds the files older than today:

find . -iname '*php' -mtime +1 | xargs grep 'string' -slShare this!




gezi@ubuntu:~/curl-8.7.1$ ./configure \ > --host=arm-linux-gnueabi \ > --prefix=/usr/local/arm-curl \ > --with-ssl=/usr/bin/openssl \ configure: WARNING: you should use --build, --host, --target configure: WARNING: invalid host type: checking whether to enable maintainer-specific portions of Makefiles... no checking whether make supports nested variables... yes checking whether to enable debug build options... no checking whether to enable compiler optimizer... (assumed) yes checking whether to enable strict compiler warnings... no checking whether to enable compiler warnings as errors... no checking whether to enable curl debug memory tracking... no checking whether to enable hiding of library internal symbols... yes checking whether to enable c-ares for DNS lookups... no checking whether to disable dependency on -lrt... (assumed no) checking whether to enable ECH support... no checking for path separator... : checking for sed... /bin/sed checking for grep... /bin/grep checking that grep -E works... yes checking for arm-linux-gnueabi-ar... /usr/bin/arm-linux-gnueabi-ar checking for a BSD-compatible install... /usr/bin/install -c checking for arm-linux-gnueabi-gcc... arm-linux-gnueabi-gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... yes checking for suffix of object files... o checking whether the compiler supports GNU C... yes checking whether arm-linux-gnueabi-gcc accepts -g... yes checking for arm-linux-gnueabi-gcc option to enable C11 features... none needed checking whether arm-linux-gnueabi-gcc understands -c and -o together... yes checking how to run the C preprocessor... arm-linux-gnueabi-gcc -E checking for stdio.h... yes checking for stdlib.h... yes checking for string.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for strings.h... yes checking for sys/stat.h... yes checking for sys/types.h... yes checking for unistd.h... yes checking for stdatomic.h... yes checking if _Atomic is available... yes checking for a sed that does not truncate output... (cached) /bin/sed checking for code coverage support... no checking whether build environment is sane... yes checking for arm-linux-gnueabi-strip... arm-linux-gnueabi-strip checking for a race-free mkdir -p... /bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking whether make supports the include directive... yes (GNU style) checking dependency style of arm-linux-gnueabi-gcc... gcc3 checking curl version... 8.7.1 checking for httpd... no checking for apache2... no checking for apachectl... no checking for apxs... no configure: httpd/apache2 not in PATH, http tests disabled configure: apxs not in PATH, http tests disabled checking for nghttpx... no checking for caddy... no checking build system type... config.sub: missing argument Try `config.sub --help' for more information. configure: error: /bin/sh ./config.sub failed
10-11
make "make -C modules/arp_scanner MODULE_NAME=arp_scanner" make[4]: Entering directory '/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/modules/arp_scanner' arm-ca9-linux-uclibcgnueabihf-gcc -O2 -pipe -fgnu89-inline -march=armv7-a -mtune=cortex-a9 -mfpu=neon -mfloat-abi=hard -ftree-vectorize -fno-builtin -fno-common -g -Wno-stringop-truncation -Wno-format-truncation -Wno-sizeof-pointer-div -Wno-stringop-overflow -Wno-format-overflow -Wno-sizeof-pointer-memaccess -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/usr/lib/libiconv-full/include -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/usr/lib/libintl-full/include -DCONFIG_STATISTIC_REPORT_DOMAIN=n-da.tplinkcloud.com.cn -Wno-sizeof-pointer-div -Wno-restrict -Wno-format-truncation -Wno-format-overflow -Wno-stringop-truncation -DSUPPORT_PLUGIN -DCONFIG_MSG_PUSH_POST_URL=/surveillance/v1/reportMsg -DCONFIG_NTP_HOSTNAME=n-tss.tplinkcloud.com.cn -DUP_FIRMWARE_LIMIT_SIZE=16777216 -DSENSITIVITY_INT -DMAKEROOM_BEFORE_UPGRADE -DAUDIO_ENABLE -DCONFIG_TP_TAPO_MAP_ROOTFS -DTP_VIGI -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/usr/include -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/include -I/home/fuyu1/code/Platform_NVMP/nvmp/../sdk/soc/nvt9856x/uclibc-toolchain-1.0.32/arm-ca9-linux-uclibcgnueabihf-8.4.01/arm-ca9-linux-uclibcgnueabihf/sysroot/usr/include -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/usr/lib/libiconv-full/include -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/usr/lib/libintl-full/include -Wall -Werror -ffunction-sections -fdata-sections -DMODULE_LIST="\"tdpd tmpd mactool nifc ipcd dhcpc diagnose httpd tpntp system upgrade arp_scanner\"" -I/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/include -I/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/common -I/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/common/ds -I/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/modules/mactool -I./libXml -I./libutils -I./libmediautil -I../../include -c -o arp_scan.o arp_scan.c arm-ca9-linux-uclibcgnueabihf-gcc -O2 -pipe -fgnu89-inline -march=armv7-a -mtune=cortex-a9 -mfpu=neon -mfloat-abi=hard -ftree-vectorize -fno-builtin -fno-common -g -Wno-stringop-truncation -Wno-format-truncation -Wno-sizeof-pointer-div -Wno-stringop-overflow -Wno-format-overflow -Wno-sizeof-pointer-memaccess -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/usr/lib/libiconv-full/include -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/usr/lib/libintl-full/include -DCONFIG_STATISTIC_REPORT_DOMAIN=n-da.tplinkcloud.com.cn -Wno-sizeof-pointer-div -Wno-restrict -Wno-format-truncation -Wno-format-overflow -Wno-stringop-truncation -DSUPPORT_PLUGIN -DCONFIG_MSG_PUSH_POST_URL=/surveillance/v1/reportMsg -DCONFIG_NTP_HOSTNAME=n-tss.tplinkcloud.com.cn -DUP_FIRMWARE_LIMIT_SIZE=16777216 -DSENSITIVITY_INT -DMAKEROOM_BEFORE_UPGRADE -DAUDIO_ENABLE -DCONFIG_TP_TAPO_MAP_ROOTFS -DTP_VIGI -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/usr/include -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/include -I/home/fuyu1/code/Platform_NVMP/nvmp/../sdk/soc/nvt9856x/uclibc-toolchain-1.0.32/arm-ca9-linux-uclibcgnueabihf-8.4.01/arm-ca9-linux-uclibcgnueabihf/sysroot/usr/include -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/usr/lib/libiconv-full/include -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/usr/lib/libintl-full/include -Wall -Werror -ffunction-sections -fdata-sections -DMODULE_LIST="\"tdpd tmpd mactool nifc ipcd dhcpc diagnose httpd tpntp system upgrade arp_scanner\"" -I/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/include -I/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/common -I/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/common/ds -I/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/modules/mactool -I./libXml -I./libutils -I./libmediautil -I../../include -c -o arp_data.o arp_data.c arm-ca9-linux-uclibcgnueabihf-gcc -O2 -pipe -fgnu89-inline -march=armv7-a -mtune=cortex-a9 -mfpu=neon -mfloat-abi=hard -ftree-vectorize -fno-builtin -fno-common -g -Wno-stringop-truncation -Wno-format-truncation -Wno-sizeof-pointer-div -Wno-stringop-overflow -Wno-format-overflow -Wno-sizeof-pointer-memaccess -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/usr/lib/libiconv-full/include -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/usr/lib/libintl-full/include -DCONFIG_STATISTIC_REPORT_DOMAIN=n-da.tplinkcloud.com.cn -Wno-sizeof-pointer-div -Wno-restrict -Wno-format-truncation -Wno-format-overflow -Wno-stringop-truncation -DSUPPORT_PLUGIN -DCONFIG_MSG_PUSH_POST_URL=/surveillance/v1/reportMsg -DCONFIG_NTP_HOSTNAME=n-tss.tplinkcloud.com.cn -DUP_FIRMWARE_LIMIT_SIZE=16777216 -DSENSITIVITY_INT -DMAKEROOM_BEFORE_UPGRADE -DAUDIO_ENABLE -DCONFIG_TP_TAPO_MAP_ROOTFS -DTP_VIGI -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/usr/include -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/include -I/home/fuyu1/code/Platform_NVMP/nvmp/../sdk/soc/nvt9856x/uclibc-toolchain-1.0.32/arm-ca9-linux-uclibcgnueabihf-8.4.01/arm-ca9-linux-uclibcgnueabihf/sysroot/usr/include -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/usr/lib/libiconv-full/include -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/usr/lib/libintl-full/include -Wall -Werror -ffunction-sections -fdata-sections -DMODULE_LIST="\"tdpd tmpd mactool nifc ipcd dhcpc diagnose httpd tpntp system upgrade arp_scanner\"" -I/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/include -I/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/common -I/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/common/ds -I/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/modules/mactool -I./libXml -I./libutils -I./libmediautil -I../../include -c -o arp.o arp.c arm-ca9-linux-uclibcgnueabihf-gcc -O2 -pipe -fgnu89-inline -march=armv7-a -mtune=cortex-a9 -mfpu=neon -mfloat-abi=hard -ftree-vectorize -fno-builtin -fno-common -g -Wno-stringop-truncation -Wno-format-truncation -Wno-sizeof-pointer-div -Wno-stringop-overflow -Wno-format-overflow -Wno-sizeof-pointer-memaccess -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/usr/lib/libiconv-full/include -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/usr/lib/libintl-full/include -DCONFIG_STATISTIC_REPORT_DOMAIN=n-da.tplinkcloud.com.cn -Wno-sizeof-pointer-div -Wno-restrict -Wno-format-truncation -Wno-format-overflow -Wno-stringop-truncation -DSUPPORT_PLUGIN -DCONFIG_MSG_PUSH_POST_URL=/surveillance/v1/reportMsg -DCONFIG_NTP_HOSTNAME=n-tss.tplinkcloud.com.cn -DUP_FIRMWARE_LIMIT_SIZE=16777216 -DSENSITIVITY_INT -DMAKEROOM_BEFORE_UPGRADE -DAUDIO_ENABLE -DCONFIG_TP_TAPO_MAP_ROOTFS -DTP_VIGI -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/usr/include -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/include -I/home/fuyu1/code/Platform_NVMP/nvmp/../sdk/soc/nvt9856x/uclibc-toolchain-1.0.32/arm-ca9-linux-uclibcgnueabihf-8.4.01/arm-ca9-linux-uclibcgnueabihf/sysroot/usr/include -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/usr/lib/libiconv-full/include -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/usr/lib/libintl-full/include -Wall -Werror -ffunction-sections -fdata-sections -DMODULE_LIST="\"tdpd tmpd mactool nifc ipcd dhcpc diagnose httpd tpntp system upgrade arp_scanner\"" -I/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/include -I/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/common -I/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/common/ds -I/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/modules/mactool -I./libXml -I./libutils -I./libmediautil -I../../include -c -o arp_handle.o arp_handle.c arm-ca9-linux-uclibcgnueabihf-ar crus -o arp_scanner.a arp_scan.o arp_data.o arp.o arp_handle.o cp -f arp_scanner.a ../../libraries/ mkdir -p ../../files/ cp -fpR ./files/* ../../files/ make[4]: Leaving directory '/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/modules/arp_scanner' arm-ca9-linux-uclibcgnueabihf-gcc -O2 -pipe -fgnu89-inline -march=armv7-a -mtune=cortex-a9 -mfpu=neon -mfloat-abi=hard -ftree-vectorize -fno-builtin -fno-common -g -Wno-stringop-truncation -Wno-format-truncation -Wno-sizeof-pointer-div -Wno-stringop-overflow -Wno-format-overflow -Wno-sizeof-pointer-memaccess -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/usr/lib/libiconv-full/include -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/usr/lib/libintl-full/include -DCONFIG_STATISTIC_REPORT_DOMAIN=n-da.tplinkcloud.com.cn -Wno-sizeof-pointer-div -Wno-restrict -Wno-format-truncation -Wno-format-overflow -Wno-stringop-truncation -DSUPPORT_PLUGIN -DCONFIG_MSG_PUSH_POST_URL=/surveillance/v1/reportMsg -DCONFIG_NTP_HOSTNAME=n-tss.tplinkcloud.com.cn -DUP_FIRMWARE_LIMIT_SIZE=16777216 -DSENSITIVITY_INT -DMAKEROOM_BEFORE_UPGRADE -DAUDIO_ENABLE -DCONFIG_TP_TAPO_MAP_ROOTFS -DTP_VIGI -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/usr/include -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/include -I/home/fuyu1/code/Platform_NVMP/nvmp/../sdk/soc/nvt9856x/uclibc-toolchain-1.0.32/arm-ca9-linux-uclibcgnueabihf-8.4.01/arm-ca9-linux-uclibcgnueabihf/sysroot/usr/include -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/usr/lib/libiconv-full/include -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/usr/lib/libintl-full/include -Wall -Werror -ffunction-sections -fdata-sections -DMODULE_LIST="\"tdpd tmpd mactool nifc ipcd dhcpc diagnose httpd tpntp system upgrade arp_scanner\"" -I/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/include -I/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/common -I/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/common/ds -I/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/modules/mactool -I./libXml -I./libutils -I./libmediautil -c -o nsd.o nsd.c arm-ca9-linux-uclibcgnueabihf-ar build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/nsd.o "arm-ca9-linux-uclibcgnueabihf-ar crus -o nsd.a nsd.o" cp -f nsd.a libraries/ make[3]: Leaving directory '/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd' touch /home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/.built make V=ss -j1 clean-staging make[3]: Entering directory '/home/fuyu1/code/Platform_NVMP/nvmp/tp_package/nsd' rm -f /home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/stamp/.nsd_installed make[3]: Leaving directory '/home/fuyu1/code/Platform_NVMP/nvmp/tp_package/nsd' rm -rf /home/fuyu1/code/Platform_NVMP/nvmp/tmp/stage-nsd mkdir -p /home/fuyu1/code/Platform_NVMP/nvmp/tmp/stage-nsd/host /home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/packages /home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/host/packages # install -d -m0755 /home/fuyu1/code/Platform_NVMP/nvmp/tmp/stage-nsd/usr/include/video_share # cp -fpR /home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/modules/video_share/*.h /home/fuyu1/code/Platform_NVMP/nvmp/tmp/stage-nsd/usr/include/video_share install -d -m0755 /home/fuyu1/code/Platform_NVMP/nvmp/tmp/stage-nsd/usr/lib/nvmp/nsd cp -fpR /home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/libraries/*.a /home/fuyu1/code/Platform_NVMP/nvmp/tmp/stage-nsd/usr/lib/nvmp/nsd if [ -d /home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd ]; then /bin/tar cf /home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/nsd_pack.tar -C /home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20 nsd/include nsd/libraries --exclude=out.* --exclude-vcs; /bin/tar rf /home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/nsd_pack.tar -C /home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20 nsd/common nsd/modules --exclude=*.o --exclude=*.c --exclude=*.a --exclude=Makefile --exclude-vcs; bzip2 /home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/nsd_pack.tar -c > /home/fuyu1/code/Platform_NVMP/nvmp/bin/nvt9856x-cx20iv1.20/nsd_pack.tar.bz2; rm -f /home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/nsd_pack.tar; fi install -d -m0755 /home/fuyu1/code/Platform_NVMP/nvmp/tmp/stage-nsd/usr/lib/nvmp_files if [ -d /home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/files/ ]; then cp -fpR /home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/files/* /home/fuyu1/code/Platform_NVMP/nvmp/tmp/stage-nsd/usr/lib/nvmp_files/; fi find /home/fuyu1/code/Platform_NVMP/nvmp/tmp/stage-nsd -name '*.la' | xargs -r rm -f; if [ -d /home/fuyu1/code/Platform_NVMP/nvmp/tmp/stage-nsd ]; then (cd /home/fuyu1/code/Platform_NVMP/nvmp/tmp/stage-nsd; find ./ > /home/fuyu1/code/Platform_NVMP/nvmp/tmp/stage-nsd.files); SHELL= /home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/host/bin/flock /home/fuyu1/code/Platform_NVMP/nvmp/tmp/.staging-dir.flock -c ' mv /home/fuyu1/code/Platform_NVMP/nvmp/tmp/stage-nsd.files /home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/packages/nsd.list && cp -fpR /home/fuyu1/code/Platform_NVMP/nvmp/tmp/stage-nsd/* /home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/; '; fi rm -rf /home/fuyu1/code/Platform_NVMP/nvmp/tmp/stage-nsd touch /home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/stamp/.nsd_installed make[2]: Leaving directory '/home/fuyu1/code/Platform_NVMP/nvmp/tp_package/nsd' make[1]: Leaving directory '/home/fuyu1/code/Platform_NVMP/nvmp' ERROR: please fix package/tp_package/wlan/Makefile - see logs/package/tp_package/wlan/dump.txt for details ERROR: please fix package/tp_package/ams_package/nvmp_algorithm/ams/Makefile - see logs/package/tp_package/ams_package/nvmp_algorithm/ams/dump.txt for details ERROR: please fix package/tp_package/ams_package/nvmp_algorithm/libdla/Makefile - see logs/package/tp_package/ams_package/nvmp_algorithm/libdla/dump.txt for details Collecting package info: done AMS: buildams.config and ams.config updated from ams source make[1]: Entering directory '/home/fuyu1/code/Platform_NVMP/nvmp' make[2]: Entering directory '/home/fuyu1/code/Platform_NVMP/nvmp/tp_package/nsd' make[2]: Nothing to be done for 'install'. make[2]: Leaving directory '/home/fuyu1/code/Platform_NVMP/nvmp/tp_package/nsd' make[1]: Leaving directory '/home/fuyu1/code/Platform_NVMP/nvmp'
09-02
(edgenat) root@autodl-container-b2b911ba00-6b40f8a2:~/autodl-tmp/EdgeNAT-main# cp -r ~/autodl-tmp/NATTEN-main /root/ cd /root/NATTEN-main pip install --no-build-isolation --no-cache-dir . Looking in indexes: http://mirrors.aliyun.com/pypi/simple Processing /root/NATTEN-main Preparing metadata (pyproject.toml) ... error error: subprocess-exited-with-error × Preparing metadata (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [14 lines of output] `NATTEN_CUDA_ARCH` not set, but detected CUDA driver with PyTorch. Building for CUDA_ARCH='7.0'. Traceback (most recent call last): File "/root/miniconda3/envs/edgenat/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 389, in <module> main() File "/root/miniconda3/envs/edgenat/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 373, in main json_out["return_val"] = hook(**hook_input["kwargs"]) File "/root/miniconda3/envs/edgenat/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 175, in prepare_metadata_for_build_wheel return hook(metadata_directory, config_settings) File "/root/miniconda3/envs/edgenat/lib/python3.10/site-packages/setuptools/build_meta.py", line 374, in prepare_metadata_for_build_wheel self.run_setup() File "/root/miniconda3/envs/edgenat/lib/python3.10/site-packages/setuptools/build_meta.py", line 317, in run_setup exec(code, locals()) File "<string>", line 93, in <module> AssertionError: NATTEN only supports CUDA 12.0 and above. [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed × Encountered error while generating package metadata. ╰─> from file:///root/NATTEN-main note: This is an issue with the package mentioned above, not pip. hint: See above for details. (edgenat) root@autodl-container-b2b911ba00-6b40f8a2:~/NATTEN-main# pip install natten -f https://download.openmmlab.com/mmcv/dist/cu118/torch2.7.1/index.html -i https://mirrors.aliyun.com/pypi/simple/ Looking in indexes: https://mirrors.aliyun.com/pypi/simple/ Looking in links: https://download.openmmlab.com/mmcv/dist/cu118/torch2.7.1/index.html Collecting natten Downloading https://mirrors.aliyun.com/pypi/packages/5a/ca/002c2a2bb8503af754831b60b89f86ab5b289605bbcfba65daf9923eaccd/natten-0.21.1.tar.gz (2.7 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.7/2.7 MB 6.8 MB/s 0:00:00 Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Building wheels for collected packages: natten Building wheel for natten (pyproject.toml) ... error error: subprocess-exited-with-error × Building wheel for natten (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [185 lines of output] /tmp/pip-build-env-gyhmwhcs/overlay/lib/python3.10/site-packages/torch/_subclasses/functional_tensor.py:279: UserWarning: Failed to initialize NumPy: No module named 'numpy' (Triggered internally at /pytorch/torch/csrc/utils/tensor_numpy.cpp:84.) cpu = _conversion_method_template(device=torch.device("cpu")) `NATTEN_CUDA_ARCH` not set, but detected CUDA driver with PyTorch. Building for CUDA_ARCH='7.0'. PyTorch was built with CUDA Toolkit 128 Building NATTEN for the following architecture(s): 7.0 Number of workers: 13 running bdist_wheel running build running build_py creating build/lib.linux-x86_64-cpython-310/natten copying src/natten/__init__.py -> build/lib.linux-x86_64-cpython-310/natten copying src/natten/_environment.py -> build/lib.linux-x86_64-cpython-310/natten copying src/natten/_libnatten.py -> build/lib.linux-x86_64-cpython-310/natten copying src/natten/attn_merge.py -> build/lib.linux-x86_64-cpython-310/natten copying src/natten/context.py -> build/lib.linux-x86_64-cpython-310/natten copying src/natten/functional.py -> build/lib.linux-x86_64-cpython-310/natten copying src/natten/modules.py -> build/lib.linux-x86_64-cpython-310/natten copying src/natten/profiler.py -> build/lib.linux-x86_64-cpython-310/natten copying src/natten/token_permute.py -> build/lib.linux-x86_64-cpython-310/natten copying src/natten/types.py -> build/lib.linux-x86_64-cpython-310/natten copying src/natten/version.py -> build/lib.linux-x86_64-cpython-310/natten creating build/lib.linux-x86_64-cpython-310/natten/backends copying src/natten/backends/__init__.py -> build/lib.linux-x86_64-cpython-310/natten/backends copying src/natten/backends/blackwell_fmha.py -> build/lib.linux-x86_64-cpython-310/natten/backends copying src/natten/backends/blackwell_fna.py -> build/lib.linux-x86_64-cpython-310/natten/backends copying src/natten/backends/flex.py -> build/lib.linux-x86_64-cpython-310/natten/backends copying src/natten/backends/fmha.py -> build/lib.linux-x86_64-cpython-310/natten/backends copying src/natten/backends/fna.py -> build/lib.linux-x86_64-cpython-310/natten/backends copying src/natten/backends/hopper_fmha.py -> build/lib.linux-x86_64-cpython-310/natten/backends copying src/natten/backends/hopper_fna.py -> build/lib.linux-x86_64-cpython-310/natten/backends copying src/natten/backends/reference.py -> build/lib.linux-x86_64-cpython-310/natten/backends creating build/lib.linux-x86_64-cpython-310/natten/profiling_utils copying src/natten/profiling_utils/__init__.py -> build/lib.linux-x86_64-cpython-310/natten/profiling_utils copying src/natten/profiling_utils/dry_run.py -> build/lib.linux-x86_64-cpython-310/natten/profiling_utils copying src/natten/profiling_utils/formatting.py -> build/lib.linux-x86_64-cpython-310/natten/profiling_utils copying src/natten/profiling_utils/ops.py -> build/lib.linux-x86_64-cpython-310/natten/profiling_utils copying src/natten/profiling_utils/pretty_printer.py -> build/lib.linux-x86_64-cpython-310/natten/profiling_utils copying src/natten/profiling_utils/problem.py -> build/lib.linux-x86_64-cpython-310/natten/profiling_utils copying src/natten/profiling_utils/profiling.py -> build/lib.linux-x86_64-cpython-310/natten/profiling_utils creating build/lib.linux-x86_64-cpython-310/natten/utils copying src/natten/utils/__init__.py -> build/lib.linux-x86_64-cpython-310/natten/utils copying src/natten/utils/checks.py -> build/lib.linux-x86_64-cpython-310/natten/utils copying src/natten/utils/device.py -> build/lib.linux-x86_64-cpython-310/natten/utils copying src/natten/utils/dtype.py -> build/lib.linux-x86_64-cpython-310/natten/utils copying src/natten/utils/log.py -> build/lib.linux-x86_64-cpython-310/natten/utils copying src/natten/utils/tensor.py -> build/lib.linux-x86_64-cpython-310/natten/utils copying src/natten/utils/testing.py -> build/lib.linux-x86_64-cpython-310/natten/utils copying src/natten/utils/tuples.py -> build/lib.linux-x86_64-cpython-310/natten/utils creating build/lib.linux-x86_64-cpython-310/natten/backends/configs copying src/natten/backends/configs/__init__.py -> build/lib.linux-x86_64-cpython-310/natten/backends/configs copying src/natten/backends/configs/checks.py -> build/lib.linux-x86_64-cpython-310/natten/backends/configs creating build/lib.linux-x86_64-cpython-310/natten/backends/configs/cutlass copying src/natten/backends/configs/cutlass/__init__.py -> build/lib.linux-x86_64-cpython-310/natten/backends/configs/cutlass copying src/natten/backends/configs/cutlass/fna_backward_128x128.py -> build/lib.linux-x86_64-cpython-310/natten/backends/configs/cutlass copying src/natten/backends/configs/cutlass/fna_backward_128x64.py -> build/lib.linux-x86_64-cpython-310/natten/backends/configs/cutlass copying src/natten/backends/configs/cutlass/fna_backward_64x64.py -> build/lib.linux-x86_64-cpython-310/natten/backends/configs/cutlass copying src/natten/backends/configs/cutlass/fna_forward_32x128.py -> build/lib.linux-x86_64-cpython-310/natten/backends/configs/cutlass copying src/natten/backends/configs/cutlass/fna_forward_64x128.py -> build/lib.linux-x86_64-cpython-310/natten/backends/configs/cutlass copying src/natten/backends/configs/cutlass/fna_forward_64x64.py -> build/lib.linux-x86_64-cpython-310/natten/backends/configs/cutlass creating build/lib.linux-x86_64-cpython-310/natten/backends/configs/cutlass_blackwell copying src/natten/backends/configs/cutlass_blackwell/__init__.py -> build/lib.linux-x86_64-cpython-310/natten/backends/configs/cutlass_blackwell creating build/lib.linux-x86_64-cpython-310/natten/backends/configs/cutlass_hopper copying src/natten/backends/configs/cutlass_hopper/__init__.py -> build/lib.linux-x86_64-cpython-310/natten/backends/configs/cutlass_hopper creating build/lib.linux-x86_64-cpython-310/natten/backends/configs/flex copying src/natten/backends/configs/flex/__init__.py -> build/lib.linux-x86_64-cpython-310/natten/backends/configs/flex running egg_info writing src/NATTEN.egg-info/PKG-INFO writing dependency_links to src/NATTEN.egg-info/dependency_links.txt writing top-level names to src/NATTEN.egg-info/top_level.txt reading manifest file 'src/NATTEN.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no files found matching '*.cc' under directory 'csrc' warning: no files found matching '*.inl' under directory 'csrc' warning: no files found matching '*.cpp' under directory 'third_party/cutlass/include' warning: no files found matching '*.cuh' under directory 'third_party/cutlass/include' warning: no files found matching '*.cu' under directory 'third_party/cutlass/include' warning: no files found matching '*.txt' under directory 'third_party/cutlass/include' warning: no files found matching '*.cc' under directory 'third_party/cutlass/include' no previously-included directories found matching 'dev' no previously-included directories found matching 'site' no previously-included directories found matching 'csrc/autogen' no previously-included directories found matching 'tests' no previously-included directories found matching 'assets' no previously-included directories found matching '*/__pycache__' no previously-included directories found matching 'build/*' no previously-included directories found matching 'build_dir/*' no previously-included directories found matching 'CMakeFiles/*' adding license file 'LICENSE' adding license file 'NOTICE' writing manifest file 'src/NATTEN.egg-info/SOURCES.txt' running build_ext -- The CXX compiler identification is GNU 11.3.0 -- The CUDA compiler identification is NVIDIA 11.8.89 with host compiler GNU 11.3.0 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Detecting CUDA compiler ABI info -- Detecting CUDA compiler ABI info - done -- Check for working CUDA compiler: /usr/local/cuda/bin/nvcc - skipped -- Detecting CUDA compile features -- Detecting CUDA compile features - done CMake Error at /tmp/pip-build-env-gyhmwhcs/overlay/lib/python3.10/site-packages/cmake/data/share/cmake-4.1/Modules/FindPackageHandleStandardArgs.cmake:227 (message): Could NOT find CUDAToolkit: Found unsuitable version "11.8.89", but required is at least "12.0" (found /usr/local/cuda/targets/x86_64-linux/include) Call Stack (most recent call first): /tmp/pip-build-env-gyhmwhcs/overlay/lib/python3.10/site-packages/cmake/data/share/cmake-4.1/Modules/FindPackageHandleStandardArgs.cmake:589 (_FPHSA_FAILURE_MESSAGE) /tmp/pip-build-env-gyhmwhcs/overlay/lib/python3.10/site-packages/cmake/data/share/cmake-4.1/Modules/FindCUDAToolkit.cmake:1090 (find_package_handle_standard_args) CMakeLists.txt:6 (find_package) -- Configuring incomplete, errors occurred! Preparing to build LIBNATTEN Auto-generating kernel instantiations Stamping out reference kernels -- reference did not have any previously generated targets; direct copy. -- reference did not have any previously generated targets; direct copy. Stamping out fna kernels -- fna did not have any previously generated targets; direct copy. -- fna did not have any previously generated targets; direct copy. Stamping out fmha kernels -- fmha did not have any previously generated targets; direct copy. -- fmha did not have any previously generated targets; direct copy. Building NATTEN for the following archs: [70] (max: 70) Building with 13 workers. Build directory: /tmp/tmp7ktgpckm IS_LIBTORCH_BUILT_WITH_CXX11_ABI=True Traceback (most recent call last): File "/root/miniconda3/envs/edgenat/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 389, in <module> main() File "/root/miniconda3/envs/edgenat/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 373, in main json_out["return_val"] = hook(**hook_input["kwargs"]) File "/root/miniconda3/envs/edgenat/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 280, in build_wheel return _build_backend().build_wheel( File "/tmp/pip-build-env-gyhmwhcs/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 435, in build_wheel return _build(['bdist_wheel', '--dist-info-dir', str(metadata_directory)]) File "/tmp/pip-build-env-gyhmwhcs/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 423, in _build return self._build_with_temp_dir( File "/tmp/pip-build-env-gyhmwhcs/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 404, in _build_with_temp_dir self.run_setup() File "/tmp/pip-build-env-gyhmwhcs/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 317, in run_setup exec(code, locals()) File "<string>", line 500, in <module> File "/tmp/pip-build-env-gyhmwhcs/overlay/lib/python3.10/site-packages/setuptools/__init__.py", line 115, in setup return distutils.core.setup(**attrs) File "/tmp/pip-build-env-gyhmwhcs/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 186, in setup return run_commands(dist) File "/tmp/pip-build-env-gyhmwhcs/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 202, in run_commands dist.run_commands() File "/tmp/pip-build-env-gyhmwhcs/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 1002, in run_commands self.run_command(cmd) File "/tmp/pip-build-env-gyhmwhcs/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 1102, in run_command super().run_command(command) File "/tmp/pip-build-env-gyhmwhcs/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 1021, in run_command cmd_obj.run() File "/tmp/pip-build-env-gyhmwhcs/overlay/lib/python3.10/site-packages/setuptools/command/bdist_wheel.py", line 370, in run self.run_command("build") File "/tmp/pip-build-env-gyhmwhcs/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 357, in run_command self.distribution.run_command(command) File "/tmp/pip-build-env-gyhmwhcs/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 1102, in run_command super().run_command(command) File "/tmp/pip-build-env-gyhmwhcs/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 1021, in run_command cmd_obj.run() File "/tmp/pip-build-env-gyhmwhcs/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 135, in run self.run_command(cmd_name) File "/tmp/pip-build-env-gyhmwhcs/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 357, in run_command self.distribution.run_command(command) File "/tmp/pip-build-env-gyhmwhcs/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 1102, in run_command super().run_command(command) File "/tmp/pip-build-env-gyhmwhcs/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 1021, in run_command cmd_obj.run() File "/tmp/pip-build-env-gyhmwhcs/overlay/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 96, in run _build_ext.run(self) File "/tmp/pip-build-env-gyhmwhcs/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 368, in run self.build_extensions() File "/tmp/pip-build-env-gyhmwhcs/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 484, in build_extensions self._build_extensions_serial() File "/tmp/pip-build-env-gyhmwhcs/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 510, in _build_extensions_serial self.build_extension(ext) File "<string>", line 466, in build_extension File "/root/miniconda3/envs/edgenat/lib/python3.10/subprocess.py", line 369, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['cmake', '/tmp/pip-install-fb67jcs4/natten_8921a7027ba34c649a135d215e8392a9/csrc', '-DPYTHON_PATH=/root/miniconda3/envs/edgenat/bin/python3.10', '-DOUTPUT_FILE_NAME=natten/libnatten.cpython-310-x86_64-linux-gnu', '-DNATTEN_CUDA_ARCH_LIST=70-real', '-DNATTEN_IS_WINDOWS=0', '-DIS_LIBTORCH_BUILT_WITH_CXX11_ABI=1']' returned non-zero exit status 1. [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for natten Failed to build natten error: failed-wheel-build-for-install × Failed to build installable wheels for some pyproject.toml based projects ╰─> natten
最新发布
11-11
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值