You need to enable JavaScript to run this app. 编译glibc-2.32时执行make报错找不到po2test.awk,求正确编译方法
优惠活动
大模型
产品
解决方案
定价
更多

编译glibc-2.32时执行make报错找不到po2test.awk,求正确编译方法

自建glibc编译报错:找不到po2test.awk文件

我的操作流程

我参考公开教程的命令编译glibc 2.32版本,执行步骤如下:

git clone git://sourceware.org/git/glibc.git
cd glibc
git checkout glibc-2.32
mkdir build
cd build
export glibc_install="$(pwd)/install"
../configure --prefix "$glibc_install"
make -j `nproc`
make install -j `nproc`

报错日志

执行make -j \nproc``阶段中断,关键报错信息如下:

...
LC_ALL=C gawk -f po2test.awk /home/xxx/glibc/build/intl/tst-gettext-de.po > /home/xxx/glibc/build/intl/msgs.h
gawk: fatal: cannot open source file `po2test.awk' for reading: No such file or directory
make[2]: *** [Makefile:129: /home/xxx/glibc/build/intl/msgs.h] Error 2
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/home/xxx/glibc/intl'
make[1]: *** [Makefile:470: intl/subdir_lib] Error 2
make[1]: Leaving directory '/home/xxx/glibc'
make: *** [Makefile:9: all] Error 2

问题原因

该报错是glibc 2.32早期标签版本的已知构建问题:po2test.awk脚本默认存放在源码根目录的po/文件夹下,但intl子目录的Makefile没有正确指定脚本的绝对路径,导致make执行时无法找到文件。

修复&正确编译步骤

  1. 清理之前的构建残留,避免旧生成文件干扰:
    cd ~/glibc/build
    rm -rf ./*
    
  2. 安装前置编译依赖(Debian/Ubuntu系):
    sudo apt install build-essential bison gawk
    
  3. 拉取glibc-2.32标签的最新补丁,修复已知构建问题:
    cd ~/glibc
    git pull origin glibc-2.32
    
  4. 重新配置编译参数,使用绝对路径调用configure脚本,避免相对路径解析错误:
    cd ~/glibc/build
    export glibc_install=$(pwd)/install
    /home/你的用户名/glibc/configure --prefix="$glibc_install"
    
  5. 执行编译,避免用nproc拉满核心并行编译,防止子目录构建规则的竞态错误:
    make -j2
    make install -j2
    

临时快速修复(不想拉取补丁时使用)

直接手动复制缺失的脚本到build目录对应位置,再重新执行make:

cp ~/glibc/po/po2test.awk ~/glibc/build/intl/
cd ~/glibc/build
make -j2

内容的提问来源于stack exchange,提问作者user1424739

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.22 13:36:07