Vitis AIの構造を勉強してみる(10日目)

とうとう、10日目に入った。

久々にのんびりと長期戦をしている。

ライブラリをビルドする方法を考えよう。

cmakeはやめよう

まず、cmakeはやめよう。

ソースコードを見るかぎり、別にcmakeがなければいけないというわけでもなさそう。

opencv2vitisがインクルードできていればビルドできそうだ。

$ source /opt/petalinux/2020.2/environment-setup-aarch64-xilinx-linux

Makefileを作成する前にコマンドラインでビルドしてみよう。

ざっと調べるとインクルードパスはこんなものかしら?

$ aarch64-xilinx-linux-g++ -c \
  ../src/facedetect.cpp \
  -I./ -I../include \
  -I../../../../tools/Vitis-AI-Library/facedetect/include \
  -I/opt/petalinux/2020.2/sysroots/aarch64-xilinx-linux/usr/include/c++/9.2.0/ \
  -I/opt/petalinux/2020.2/sysroots/aarch64-xilinx-linux/usr/include/c++/9.2.0/aarch64-xilinx-linux \
  -I/opt/petalinux/2020.2/sysroots/aarch64-xilinx-linux/usr/include/c++/9.2.0/parallel/ \
  -I/opt/petalinux/2020.2/sysroots/aarch64-xilinx-linux/usr/include/

でも、実行すると大量のエラーが発生した。

これは難しい。

わからんなぁ。

$ ./Vitis-AI/tools/Vitis-AI-Library
$ source /opt/petalinux/2020.2/environment-setup-aarch64-xilinx-linux
$ ./cmake.sh
Cross-platform building...
Found target sysroot /disk/opt/petalinux/2020.2/sysroots/aarch64-xilinx-linux
cd /home/hidemi/build/build.linux.2020.2.aarch64.Debug/Vitis-AI-Library
cmake -DBUILD_TEST=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_TOOLCHAIN_FILE=/disk/opt/petalinux/2020.2/sysroots/x86_64-petalinux-linux/usr/share/cmake/OEToolchainConfig.cmake -DCMAKE_PREFIX_PATH=/install/Debug -DCPACK_DEBIAN_PACKAGE_ARCHITECTURE=arm64 -DCMAKE_INSTALL_PREFIX=/disk/opt/petalinux/2020.2/sysroots/aarch64-xilinx-linux/install/Debug /home/hidemi/workspace/VitisAI/VitisAI_2020.2/Vitis-AI/tools/Vitis-AI-Library
-- The C compiler identification is GNU 9.2.0
-- The CXX compiler identification is GNU 9.2.0
-- Check for working C compiler: /disk/opt/petalinux/2020.2/sysroots/x86_64-petalinux-linux/usr/bin/aarch64-xilinx-linux/aarch64-xilinx-linux-gcc
-- Check for working C compiler: /disk/opt/petalinux/2020.2/sysroots/x86_64-petalinux-linux/usr/bin/aarch64-xilinx-linux/aarch64-xilinx-linux-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /disk/opt/petalinux/2020.2/sysroots/x86_64-petalinux-linux/usr/bin/aarch64-xilinx-linux/aarch64-xilinx-linux-g++
-- Check for working CXX compiler: /disk/opt/petalinux/2020.2/sysroots/x86_64-petalinux-linux/usr/bin/aarch64-xilinx-linux/aarch64-xilinx-linux-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found importable target xir::xir: /disk/opt/petalinux/2020.2/sysroots/aarch64-xilinx-linux/usr/lib/libxir.so.1.3.0
-- Found importable target unilog::unilog: /disk/opt/petalinux/2020.2/sysroots/aarch64-xilinx-linux/usr/lib/libunilog.so.1.3.0
-- Found importable target vart::util: /disk/opt/petalinux/2020.2/sysroots/aarch64-xilinx-linux/usr/lib/libvart-util.so.1.3.0
-- Found importable target vart::xrt-device-handle: /disk/opt/petalinux/2020.2/sysroots/aarch64-xilinx-linux/usr/lib/libvart-xrt-device-handle.so.1.3.0
-- Found importable target vart::buffer-object: /disk/opt/petalinux/2020.2/sysroots/aarch64-xilinx-linux/usr/lib/libvart-buffer-object.so.1.3.0
-- Found importable target vart::dpu-controller: /disk/opt/petalinux/2020.2/sysroots/aarch64-xilinx-linux/usr/lib/libvart-dpu-controller.so.1.3.0
-- Found importable target vart::runner: /disk/opt/petalinux/2020.2/sysroots/aarch64-xilinx-linux/usr/lib/libvart-runner.so.1.3.0
-- Found importable target vart::dpu-runner: /disk/opt/petalinux/2020.2/sysroots/aarch64-xilinx-linux/usr/lib/libvart-dpu-runner.so.1.3.0
-- Found importable target vart::mem-manager: /disk/opt/petalinux/2020.2/sysroots/aarch64-xilinx-linux/usr/lib/libvart-mem-manager.so.1.3.0
-- Found Protobuf: /disk/opt/petalinux/2020.2/sysroots/aarch64-xilinx-linux/usr/lib/libprotobuf.so;-lpthread (found suitable version "3.9.2", minimum required is "3.4.0") 
-- Found OpenCV: /disk/opt/petalinux/2020.2/sysroots/aarch64-xilinx-linux/usr (found version "3.4.3") found components:  opencv_core opencv_video opencv_videoio opencv_imgproc opencv_imgcodecs opencv_highgui 
-- Looking for C++ include arm_neon.h
-- Looking for C++ include arm_neon.h - found
-- Found importable target xir::xir: /disk/opt/petalinux/2020.2/sysroots/aarch64-xilinx-linux/usr/lib/libxir.so.1.3.0
-- Looking for xf86drm.h
-- Looking for xf86drm.h - found
-- Using DRM.
-- Looking for C++ include eigen3/Eigen/Dense
-- Looking for C++ include eigen3/Eigen/Dense - found
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    BUILD_TEST

-- Build files have been written to: /home/hidemi/build/build.linux.2020.2.aarch64.Debug/Vitis-AI-Library
Scanning dependencies of target xilinx_mpic
Scanning dependencies of target xilinx_mem_read
Scanning dependencies of target xilinx_read_version
Scanning dependencies of target tf_wb_conv
Scanning dependencies of target xilinx_upgrade-reboot
Scanning dependencies of target xilinx_xmodel_to_svg
Scanning dependencies of target xilinx_irps5401
Scanning dependencies of target xilinx_test_dpu_runner
Scanning dependencies of target xilinx_test_camera
Scanning dependencies of target xilinx_show_devices
[  1%] Building CXX object usefultools/CMakeFiles/xilinx_mpic.dir/src/mpic.cpp.o
[  1%] Building C object usefultools/CMakeFiles/xilinx_read_version.dir/src/read_version.c.o
多いので中略
[100%] Built target show_proto
Install the project...
-- Install configuration: "Debug"
CMake Error at cmake_install.cmake:41 (file):
  file cannot create directory:
  /opt/petalinux/2020.2/sysroots/aarch64-xilinx-linux/install/Debug/share/cmake/vitis_ai_library.
  Maybe need administrative privileges.

あれ?

100%まではビルドしてインストールらしきところでエラーになった。

前はビルドできなかったと思ったけど?

手順が違ってた?

試しにビルドだけにしてみよう。

$ ./cmake.sh --build-only --build-dir=build

エラーなしでビルドできた。

あれ?

今までなにやってたんだろう?

とりあえず、ここから先は明日にしよう。

write: 2021/01/17/ 00:00:00