Skip to content

Tutorial for Linux

Takuya Takeuchi edited this page Apr 29, 2022 · 22 revisions

Requirements

How to build dlib

DlibDotNet.Native requires libdlib.a. You can refer official page

Preparations

git clone https://github.com/takuya-takeuchi/DlibDotNet
cd DlibDotNet
./Initialize.sh

RHEL/Fedora/CentOS 7

$ sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
$ sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm
$ sudo yum update
$ sudo yum groupinstall 'Development tools'
$ sudo yum install -y dotnet-sdk-2.1 openblas-devel powershell cmake3
$ sudo ln -s /usr/bin/cmake3 /usr/bin/cmake
$ sudo yum install https://github.com/PowerShell/PowerShell/releases/download/v7.2.2/powershell-lts-7.2.2-1.rh.x86_64.rpm

Ubuntu/debian

sudo apt-get install libx11-dev libopenblas-dev

How to build DlibDotNet.Native

Build

  1. Open DlibDotNet/src/DlibDotNet.Native in console
  2. Type the following code in a console:
$ pwsh Build.ps1 <Release/Debug> <cpu/cuda> <32/64> <desktop/uwp> <optional: cuda version [92/100/101]
$ apt-get update
$ apt install -y wget apt-transport-https
$ wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
$ apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
$ sh -c 'echo deb https://apt.repos.intel.com/mkl all main > /etc/apt/sources.list.d/intel-mkl.list'
$ apt-get update
$ apt-get install -y intel-mkl-64bit-2019.0-045
  1. libDlibDotNetNative.so will be in build_*\Release or build_*\Debug

How to build DlibDotNet.Native.Dnn

Build

  1. Open DlibDotNet/src/DlibDotNet.Native.Dnn in console
  2. Type the following code in a console:
$ pwsh Build.ps1 <Release/Debug> <cpu/cuda/mkl> <32/64> <desktop/uwp> <optional: cuda version [92/100/101]
$ apt-get update
$ apt install -y wget apt-transport-https
$ wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
$ apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
$ sh -c 'echo deb https://apt.repos.intel.com/mkl all main > /etc/apt/sources.list.d/intel-mkl.list'
$ apt-get update
$ apt-get install -y intel-mkl-64bit-2019.0-045
  1. libDlibDotNetNativeDnn.so will be in build_*\Release or build_*\Debug

How to build DlibDotNet

Preparations

  1. Install .NET Core 2.0 by following the official page

Build

  1. Open DlibDotNet/src/DlibDotNet in console

  2. Type the following code in a console:

  3. Open DlibDotNet\src\DlibDotNet in console

  4. Type the following code in a console:

dotnet build -c <Release/Debug>