环境
操作系统是Ubuntu 18.04.6 LTS.
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.6 LTS
Release: 18.04
Codename: bionic
工具是2022.1
hankf@XSZGS4:vck190-base-trd$ which vivado
/opt/Xilinx/Vivado/2022.1/bin/vivado
hankf@XSZGS4:vck190-base-trd$ which vitis
/opt/Xilinx/Vitis/2022.1/bin/vitis
错误
在编译vck190-base-trd的xvdpu时,遇到了错误"INFO:Buiding libadf.a... /bin/sh: 1: source: not found"。
在此之前,已经成功执行“make platform PFM=vck190_mipiRxSingle_hdmiTx”。
执行“make overlay PFM=vck190_mipiRxSingle_hdmiTx OVERLAY=xvdpu”时,得到下列输出,有错误"INFO:Buiding libadf.a... /bin/sh: 1: source: not found"。
hankf@XSZGS4:vck190-base-trd$ make overlay PFM=vck190_mipiRxSingle_hdmiTx OVERLAY=filter2d
............
updating: vpl_gen_fixed.pdi (deflated 47%)
zip warning: Local Version Needed To Extract does not match CD: xsa.json
zip warning: Local Version Needed To Extract does not match CD: xsa.json
adding: binary_container_1.xclbin (deflated 47%)
make[2]: Leaving directory '/proj/hankf/hankf/vck190/trd/vck190-base-trd/overlays/filter2d/kernels/filter2d_combined'
make[1]: Leaving directory '/proj/hankf/hankf/vck190/trd/vck190-base-trd/overlays/filter2d/kernels'
hankf@XSZGS4:vck190-base-trd$ make overlay PFM=vck190_mipiRxSingle_hdmiTx OVERLAY=xvdpu
Build xvdpu Vitis overlay using platform vck190_mipiRxSingle_hdmiTx
make[1]: Entering directory '/proj/hankf/hankf/vck190/trd/vck190-base-trd/overlays/xvdpu/kernels'
make[2]: Entering directory '/proj/hankf/hankf/vck190/trd/vck190-base-trd/overlays/xvdpu/kernels/vitis_prj'
INFO:- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
INFO:Preparing files for project
make -C scripts all CPB_N=32 BATCH_N=1 UBANK_IMG_N=16 UBANK_WGT_N=17 BATCH_SHRWGT_N=4
make[3]: Entering directory '/proj/hankf/hankf/vck190/trd/vck190-base-trd/overlays/xvdpu/kernels/vitis_prj/scripts'
#Preparing files for project
cp -r ../../xvdpu_ip/aie ../.
cp -r ../../xvdpu_ip/rtl/hdl ../xvdpu/.
cp -r ../../xvdpu_ip/rtl/vitis_cfg ../xvdpu/.
cp -r ../../xvdpu_ip/rtl/inc ../xvdpu/.
cp -r ../../xvdpu_ip/rtl/ttcl ../xvdpu/.
python xvdpu_aie_noc.py 1 32 2 4 4 && python kernel_xml.py 1 2 32 4 4
#Change parameters in 'vitis_cfg.vh'
sed -i "s/define wrp_CPB_N .*/define wrp_CPB_N 32/g" ../xvdpu/vitis_cfg/vitis_cfg.vh
sed -i "s/define wrp_BATCH_N .*/define wrp_BATCH_N 1/g" ../xvdpu/vitis_cfg/vitis_cfg.vh
sed -i "s/define wrp_BATCH_SHRWGT_N .*/define wrp_BATCH_SHRWGT_N 4/g" ../xvdpu/vitis_cfg/vitis_cfg.vh
sed -i "s/define wrp_UBANK_IMG_N .*/define wrp_UBANK_IMG_N 16/g" ../xvdpu/vitis_cfg/vitis_cfg.vh
sed -i "s/define wrp_UBANK_WGT_N .*/define wrp_UBANK_WGT_N 17/g" ../xvdpu/vitis_cfg/vitis_cfg.vh
sed -i "s/define wrp_LOAD_PARALLEL_IMG .*/define wrp_LOAD_PARALLEL_IMG 2/g" ../xvdpu/vitis_cfg/vitis_cfg.vh
sed -i "s/define wrp_SAVE_PARALLEL_IMG .*/define wrp_SAVE_PARALLEL_IMG 2/g" ../xvdpu/vitis_cfg/vitis_cfg.vh
printf "\`define wrp_LOAD_PARALLEL_WGT 4\n" >> ../xvdpu/vitis_cfg/vitis_cfg.vh
printf "\`define wrp_RAM_IMG_ADDR_BW 13\n" >> ../xvdpu/vitis_cfg/vitis_cfg.vh
printf "\`define wrp_RAM_WGT_ADDR_BW 13\n" >> ../xvdpu/vitis_cfg/vitis_cfg.vh
printf "\`define wrp_UBANK_IMG_MRS 0\n" >> ../xvdpu/vitis_cfg/vitis_cfg.vh
printf "\`define wrp_UBANK_WGT_MRS 0\n" >> ../xvdpu/vitis_cfg/vitis_cfg.vh
printf "\`define wrp_UBANK_BIAS 1\n" >> ../xvdpu/vitis_cfg/vitis_cfg.vh
make[3]: Leaving directory '/proj/hankf/hankf/vck190/trd/vck190-base-trd/overlays/xvdpu/kernels/vitis_prj/scripts'
INFO:- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
INFO:Buiding libadf.a...
/bin/sh: 1: source: not found
Makefile:71: recipe for target '/proj/hankf/hankf/vck190/trd/vck190-base-trd/overlays/xvdpu/kernels/vitis_prj/aie/ip/libadf.a' failed
make[2]: *** [/proj/hankf/hankf/vck190/trd/vck190-base-trd/overlays/xvdpu/kernels/vitis_prj/aie/ip/libadf.a] Error 127
make[2]: Leaving directory '/proj/hankf/hankf/vck190/trd/vck190-base-trd/overlays/xvdpu/kernels/vitis_prj'
Makefile:13: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/proj/hankf/hankf/vck190/trd/vck190-base-trd/overlays/xvdpu/kernels'
Makefile:79: recipe for target 'overlays/xvdpu/kernels/binary_container_1.xclbin' failed
make: *** [overlays/xvdpu/kernels/binary_container_1.xclbin] Error 2
解决办法
Ubuntu 默认使用DASH。但是Vitis希望使用bash。
使用命令“sudo dpkg-reconfigure dash”,更改系统默认sh工具为bash,能解决问题,编译工程能继续进行。
hankf@XSZGS4:vck190-base-trd$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Oct 19 2020 /bin/sh -> dash
hankf@XSZGS4:vck190-base-trd$ sudo dpkg-reconfigure dash
[sudo] password for hankf:
Removing 'diversion of /bin/sh to /bin/sh.distrib by dash'
Adding 'diversion of /bin/sh to /bin/sh.distrib by bash'
Removing 'diversion of /usr/share/man/man1/sh.1.gz to /usr/share/man/man1/sh.distrib.1.gz by dash'
Adding 'diversion of /usr/share/man/man1/sh.1.gz to /usr/share/man/man1/sh.distrib.1.gz by bash'
hankf@XSZGS4:vck190-base-trd$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Aug 30 09:03 /bin/sh -> bash
hankf@XSZGS4:vck190-base-trd$ make overlay PFM=vck190_mipiRxSingle_hdmiTx OVERLAY=xvdpu
Create Vitis platform vck190_mipiRxSingle_hdmiTx
make[1]: Entering directory '/proj/hankf/hankf/vck190/trd/vck190-base-trd/platforms'
make -C vivado/vck190_mipiRxSingle_hdmiTx xsa JOBS=8
make[2]: Entering directory '/proj/hankf/hankf/vck190/trd/vck190-base-trd/platforms/vivado/vck190_mipiRxSingle_hdmiTx'
make -C ../ip/isp_single ip XPART=xcvc1902-vsva2197-1LP-e-S
make[3]: Entering directory '/proj/hankf/hankf/vck190/trd/vck190-base-trd/platforms/vivado/ip/isp_single'
vitis_hls -f run_hls.tcl