dongju-chae / nns-contributhon

4 stars 1 forks source link

[Build] NNStreamer 우분투 패키지 만들기 (using pbuilder) #6

Open dongju-chae opened 4 years ago

dongju-chae commented 4 years ago

아래 설명은 우분투 16.04/18.04 기준입니다 (sudo 권한이 필요).

Pbuilder는 로컬 시스템이 아닌, 가상의 파일 시스템에 관련 패키지들을 자동으로 설치하여 패키지를 안전하게 생성해주는 툴입니다. 로컬 시스템은 사용자마다 설치되어 있는 라이브러리가 달라서 버전 충돌이 있을 수 있지만, pbuilder는 이 문제를 해결해 줍니다.

  1. Pbuilder 세팅 (~/.pbuilderrc 파일에 repository 정보를 입력한다)
    
    $ sudo apt install pbuilder debootstrap devscripts

[ Ubuntu 16.04 (xenial) 기준 ] $ cat ~/.pbuilderrc DISTRIBUTION=xenial COMPONENTS="main restricted universe multiverse" OTHERMIRROR="deb http://archive.ubuntu.com/ubuntu xenial main restricted universe multiverse |\ deb http://archive.ubuntu.com/ubuntu xenial-security main restricted universe multiverse |\ deb http://archive.ubuntu.com/ubuntu xenial-updates main restricted universe multiverse |\ deb [trusted=yes] http://ppa.launchpad.net/nnstreamer/ppa/ubuntu xenial main"

[ Ubuntu 18.04 (bionic) 기준 ] $ cat ~/.pbuilderrc DISTRIBUTION=bionic COMPONENTS="main restricted universe multiverse" OTHERMIRROR="deb http://archive.ubuntu.com/ubuntu bionic main restricted universe multiverse |\ deb http://archive.ubuntu.com/ubuntu bionic-security main restricted universe multiverse |\ deb http://archive.ubuntu.com/ubuntu bionic-updates main restricted universe multiverse |\ deb [trusted=yes] http://ppa.launchpad.net/nnstreamer/ppa/ubuntu bionic main"

[첨언] cat이라는 명령어는 단순히 파일을 출력해주는 명령어로서, 저런 식으로 파일을 생성하라는 의미입니다!


2. Pbuilder를 위한 가상 파일 시스템 생성 (`base.tgz`)

$ sudo pbuilder create I: Distribution is xenial. I: Current time: Tue Jul 28 20:03:27 KST 2020 I: pbuilder-time-stamp: 1595934207 I: Building the build environment I: running debootstrap /usr/sbin/debootstrap I: Retrieving InRelease I: Checking Release signature I: Valid Release signature (key id 790BC7277767219C42C86F933B4FE6ACC0B21F32) I: Retrieving Packages I: Validating Packages I: Resolving dependencies of required packages... I: Resolving dependencies of base packages... I: Checking component main on http://ftp.daumkakao.com/ubuntu... I: Retrieving adduser 3.113+nmu3ubuntu4 I: Validating adduser 3.113+nmu3ubuntu4 ... [패키지 설치 중 생략] ... Setting up libcwidget3v5:amd64 (0.5.17-4ubuntu2) ... Setting up libxapian22v5:amd64 (1.2.22-2) ... Setting up aptitude (0.7.4-2ubuntu2) ... update-alternatives: using /usr/bin/aptitude-curses to provide /usr/bin/aptitude (aptitude) in auto mode Processing triggers for libc-bin (2.23-0ubuntu3) ... I: Copying back the cached apt archive contents I: new cache content 'libboost-iostreams1.58.0_1.58.0+dfsg-5ubuntu3_amd64.deb' added I: new cache content 'libsqlite3-0_3.11.0-1ubuntu1_amd64.deb' added I: unmounting dev/pts filesystem I: unmounting run/shm filesystem I: unmounting proc filesystem I: creating base tarball [/var/cache/pbuilder/base.tgz] I: cleaning the build env I: removing directory /var/cache/pbuilder/build/8167 and its subdirectories

$ ls -al /var/cache/pbuilder/base.tgz -rw-r--r-- 1 root root 120155214 7월 28 20:07 /var/cache/pbuilder/base.tgz


3. nnstreamer 빌드 및 유닛테스트 동작 (필요한 패키지들은 자동으로 설치)

$ pwd /home/dchae/nnstreamer

$ sudo pdebuild dpkg-checkbuilddeps: error: Unmet build dependencies: openvino-dev openvino-cpu-mkldnn W: Unmet build-dependency in source dpkg-buildpackage: warning: using a gain-root-command while being root dpkg-buildpackage: source package nnstreamer dpkg-buildpackage: source version 1.5.3.0 dpkg-buildpackage: source distribution unstable xenial bionic dpkg-buildpackage: source changed by MyungJoo Ham myungjoo.ham@samsung.com dpkg-source --before-build nnstreamer fakeroot debian/rules clean dh clean --parallel dh_testdir debian/rules override_dh_auto_clean make[1]: Entering directory '/home/dchae/nnstreamer' rm -rf build make[1]: Leaving directory '/home/dchae/nnstreamer' dh_clean dpkg-source -b nnstreamer dpkg-source: warning: no source format specified in debian/source/format, see dpkg-source(1) dpkg-source: warning: source directory 'nnstreamer' is not - 'nnstreamer-1.5.3.0' dpkg-source: info: using source format '1.0' dpkg-source: info: building nnstreamer in nnstreamer_1.5.3.0.tar.gz ... [ 빌드 중 생략 ] ... dpkg-deb: building package 'nnstreamer' in '../nnstreamer_1.5.3.0_amd64.deb'.
dpkg-deb: building package 'nnstreamer-tensorflow' in '../nnstreamer-tensorflow_1.5.3.0_amd64.deb'.
dpkg-deb: building package 'nnstreamer-tensorflow-lite' in '../nnstreamer-tensorflow-lite_1.5.3.0_amd6 4.deb'.
dpkg-deb: building package 'nnstreamer-pytorch' in '../nnstreamer-pytorch_1.5.3.0_amd64.deb'.
dpkg-deb: building package 'nnstreamer-caffe2' in '../nnstreamer-caffe2_1.5.3.0_amd64.deb'.
dpkg-deb: building package 'nnstreamer-python2' in '../nnstreamer-python2_1.5.3.0_amd64.deb'.
dpkg-deb: building package 'nnstreamer-python3' in '../nnstreamer-python3_1.5.3.0_amd64.deb'.
dpkg-deb: building package 'nnstreamer-cpp' in '../nnstreamer-cpp_1.5.3.0_amd64.deb'.
dpkg-deb: building package 'nnstreamer-cpp-dev' in '../nnstreamer-cpp-dev_1.5.3.0_amd64.deb'.
dpkg-deb: building package 'nnstreamer-edgetpu' in '../nnstreamer-edgetpu_1.5.3.0_amd64.deb'.
dpkg-deb: building package 'nnstreamer-openvino' in '../nnstreamer-openvino_1.5.3.0_amd64.deb'.
dpkg-deb: building package 'nnstreamer-protobuf' in '../nnstreamer-protobuf_1.5.3.0_amd64.deb'.
dpkg-deb: building package 'nnstreamer-flatbuf' in '../nnstreamer-flatbuf_1.5.3.0_amd64.deb'.
dpkg-deb: building package 'nnstreamer-dev' in '../nnstreamer-dev_1.5.3.0_amd64.deb'.
dpkg-genchanges >../nnstreamer_1.5.3.0_amd64.changes
dpkg-genchanges: including full source code in upload
dpkg-source --after-build nnstreamer-1.5.3.0
dpkg-buildpackage: full upload; Debian-native package (full source is included)
I: copying local configuration
I: Copying back the cached apt archive contents
I: unmounting dev/pts filesystem
I: unmounting run/shm filesystem
I: unmounting proc filesystem
I: cleaning the build env
I: removing directory /var/cache/pbuilder/build/19126 and its subdirectories
I: Current time: Tue Jul 28 20:25:50 KST 2020
I: pbuilder-time-stamp: 1595935550


4. 생성된 nnstreamer 패키지 확인

$ ls /var/cache/pbuilder/result/*.deb /var/cache/pbuilder/result/nnstreamer_1.5.3.0_amd64.changes
/var/cache/pbuilder/result/nnstreamer_1.5.3.0_amd64.deb
/var/cache/pbuilder/result/nnstreamer_1.5.3.0.dsc
/var/cache/pbuilder/result/nnstreamer_1.5.3.0.tar.gz
/var/cache/pbuilder/result/nnstreamer-caffe2_1.5.3.0_amd64.deb
/var/cache/pbuilder/result/nnstreamer-cpp_1.5.3.0_amd64.deb
/var/cache/pbuilder/result/nnstreamer-cpp-dev_1.5.3.0_amd64.deb
/var/cache/pbuilder/result/nnstreamer-dev_1.5.3.0_amd64.deb
/var/cache/pbuilder/result/nnstreamer-edgetpu_1.5.3.0_amd64.deb
/var/cache/pbuilder/result/nnstreamer-flatbuf_1.5.3.0_amd64.deb
/var/cache/pbuilder/result/nnstreamer-openvino_1.5.3.0_amd64.deb
/var/cache/pbuilder/result/nnstreamer-protobuf_1.5.3.0_amd64.deb
/var/cache/pbuilder/result/nnstreamer-python2_1.5.3.0_amd64.deb
/var/cache/pbuilder/result/nnstreamer-python3_1.5.3.0_amd64.deb
/var/cache/pbuilder/result/nnstreamer-pytorch_1.5.3.0_amd64.deb
/var/cache/pbuilder/result/nnstreamer-tensorflow_1.5.3.0_amd64.deb
/var/cache/pbuilder/result/nnstreamer-tensorflow-lite_1.5.3.0_amd64.deb


5. 원하는 nnstreamer 패키지 설치하기

$ sudo dpkg -i /var/cache/pbuilder/result/nnstreamer_1.5.3.0_amd64.deb