....
....
checking whether gcc supports -Wl,--as-needed... yes
configure: using compiler=gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
configure: using CFLAGS=-Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2
configure: using CPPFLAGS= -D_GNU_SOURCE
configure: using LDFLAGS= -Wl,--as-needed
configure: creating ./config.status
config.status: creating GNUmakefile
config.status: creating src/Makefile.global
config.status: creating src/include/pg_config.h
config.status: src/include/pg_config.h is unchanged
config.status: creating src/include/pg_config_ext.h
config.status: src/include/pg_config_ext.h is unchanged
config.status: creating src/interfaces/ecpg/include/ecpg_config.h
config.status: src/interfaces/ecpg/include/ecpg_config.h is unchanged
config.status: linking src/backend/port/tas/dummy.s to src/backend/port/tas.s
config.status: linking src/backend/port/posix_sema.c to src/backend/port/pg_sema.c
config.status: linking src/backend/port/sysv_shmem.c to src/backend/port/pg_shmem.c
config.status: linking src/include/port/linux.h to src/include/pg_config_os.h
config.status: linking src/makefiles/Makefile.linux to src/Makefile.port
试图粗略地了解 postgresql 是如何编译的。我希望它运行 ./configure 并将输出信息通过管道传输到文本文件中。
sudo ./configure | /home/jian/fo1.txt
错误:
./configure: line 2885: printf: write error: Broken pipe
答案1
您搜索的运算符是>
。这会将命令的输出重定向到特定设备或文件:
sudo ./configure >output_file.txt
如果您想捕获不同文件中的错误(STDERR),您应该使用:
sudo ./configure >output_file.txt 2>>output_err.txt
如果您想将输出附加到现有文件,您应该使用>>
sudo ./configure >>output_file.txt
答案2
你不需要sudo
上./configure
线。
你的命令可能应该是:
./configure. |& tee home/jian/fo1.txt
您可能必须清理root
您之前尝试创建的所有 -owned 文件,因此:
sudo find . -maxdepth 1 -user root -ls
# when you're happy with the list of files, replace `-ls` with `-delete`.
sudo find . -maxdepth 1 -user root -delete