openwrt编译sdk是报错“File “/usr/lib/python2.7/subprocess.py“, line 1047, raise child_exception “

  • 问题
    在编译openwrt的SDK时, 执行 python genimg.py --bootconfig_gen=bootconfig_tool --mbn_gen=nand_mbn_generator.py --configdir=config/ --skip_export --outdir=image/bin --image_name=BOOTCONFIG_IMAGES 包如下错误:

    	Processing ENTRY_SVH01-C1
            Using existing directory: /home/pam/mt_sdk/source/image_build/image/bin
    
            Nand page size: 2048, pages/block: 64
            Bootconfig info: /home/pam/mt_sdk/source/image_build/config/bootconfig.xml
            Creating raw partition ...Raw partition created
            Creating Nand bootconfig partition
    Traceback (most recent call last):
      File "genimg.py", line 1067, in 
        main()
      File "genimg.py", line 940, in main
        if process_nand_bootconfig(Config, section, outputdir) < 0:
      File "genimg.py", line 540, in process_nand_bootconfig
        ], cwd=brdoutpath)
      File "/usr/lib/python2.7/subprocess.py", line 394, in __init__
        errread, errwrite)
      File "/usr/lib/python2.7/subprocess.py", line 1047, in _execute_child
        raise child_exception
    OSError: [Errno 2] No such file or directory
    ***********
    
  • 解决方法
    同样的code在另一台服务器上却没报错, 于是我我从新装了一台 ubuntu18.04 的虚拟机, 安装以下packets后:

    sudo apt-get install gcc g++ binutils patch bzip2 flex make gettext \
    pkg-config unzip zlib1g-dev libc6-dev subversion libncurses5-dev gawk \
    sharutils curl libxml-parser-perl ocaml-nox ocaml-nox ocaml ocaml-findlib \
    libpcre3-dev binutils-gold python-yaml u-boot-tools device-tree-compiler
    

    复现了上图的错误, 加log追踪了下python的code没发现什么问题, 仔细思量, 在服务器上的18.04能正常运行为何在我自己装的虚拟机上不能运行, 白死不得其解. 是在没办法, 暴力手段用 dpkg -l 把服务器里的已经安装的包和本地虚拟机上的包对比一下, 看看是不是服务器上的包在本地虚拟机上没有安装.

    在服务器上:
    找出所有已经安装的packets,
    dpkg -l | awk 'NR>=6 {print $2}' | sed "s/:amd64//g" | tr "\n" " " > server.packets
    用以下脚本在本地虚拟机上找出所有未安装的packets:

    #!/bin/bash
    # filename:  packet_fd.sh
    packets=`sed -n "1p" $1`
    
    for word in ${packets[@]}
    do
            # echo "*****************************"
            result=`dpkg --status $word 2>&1 | awk {'print $1'} | sed -n '1p'`
            if [ $result = "dpkg-query:" ]; then
                    echo $word
            fi;
            # echo "==========+ done +==========="
    done;
    

    运行./packet_fd.sh ./server.packets即可.

    用二分法安装再删除上述未安装的packets, 发现安装 sudo apt install lib32stdc++6 libc6-i386 lib32gcc1 可解决上述subprocess.py错误.

你可能感兴趣的:(openwrt)