Setting for Development Environment

12 minute read

Written by SGLee, VCANUS

The New Version

Install Nvidia driver (Ubuntu 20.04)

  1. install graphic driver (auto)
  2. install cuda toolkit (https://developer.nvidia.com/cuda-toolkit-archive)
    $ wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
    $ sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
    $ wget https://developer.download.nvidia.com/compute/cuda/11.3.1/local_installers/cuda-repo-ubuntu2004-11-3-local_11.3.1-465.19.01-1_amd64.deb
    $ sudo dpkg -i cuda-repo-ubuntu2004-11-3-local_11.3.1-465.19.01-1_amd64.deb
    $ sudo apt-key add /var/cuda-repo-ubuntu2004-11-3-local/7fa2af80.pub
    $ sudo apt-get update
    $ sudo apt-get -y install cuda
    
  3. install cudnn (https://developer.nvidia.com/cudnn) (don’t use)
    $ tar xvzf cudnn-11.2-linux-x64-v8.1.0.77.tgz
    $ sudo cp cuda/include/cudnn* /usr/local/cuda/include
    $ sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
    $ sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
    
  4. Setup environment .prifile ``` CUDA_HOME=/usr/local/cuda-11.3 export PATH=$CUDA_HOME/bin:$PATH

export LD_LIBRARY_PATH=$CUDA_HOME/lib64:$LD_LIBRARY_PATH

7. install cudnn toolkit (don't install)

$ # sudo apt install nvidia-cuda-toolkit (don’t install)

8. solve link warning

$ sudo ln -sf /usr/local/cuda/targets/x86_64-linux/lib/libcudnn_adv_train.so.8.2.0 /usr/local/cuda/targets/x86_64-linux/lib/libcudnn_adv_train.so.8 $ sudo ln -sf /usr/local/cuda/targets/x86_64-linux/lib/libcudnn_ops_infer.so.8.2.0 /usr/local/cuda/targets/x86_64-linux/lib/libcudnn_ops_infer.so.8 $ sudo ln -sf /usr/local/cuda/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8.2.0 /usr/local/cuda/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8 $ sudo ln -sf /usr/local/cuda/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8.2.0 /usr/local/cuda/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8 $ sudo ln -sf /usr/local/cuda/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8.2.0 /usr/local/cuda/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8 $ sudo ln -sf /usr/local/cuda/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8.2.0 /usr/local/cuda/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8 $ sudo ln -sf /usr/local/cuda/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8.2.0 /usr/local/cuda/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8


## Install Java
### Install OpenJdk

$ sudo apt install openjdk-8-jdk $ sudo apt install openjdk-11-jdk

### change java version

$ sudo update-alternatives –config java


## Build Essential

$ sudo apt install build-essential $ sudo apt install ubuntu-restricted-extras #(to intall extra media codecs)


$ sudo apt install curl $ sudo apt install libcurl4-openssl-dev zlib1g-dev $ sudo apt install libssl-dev $ sudo apt install openssl


## Install Cmake
0. install curl-devel zlib-devel (the cmake with Https support is needed for installing opencv) 
https://github.com/opencv/opencv_contrib/issues/1131 (check skvark's comment and ./bootstrap --system-curl. from the version of Cmake-3.12, --system-curls might be not needed for Https support)
    ```
    $ sudo yum -y install curl-devel zlib-devel
    ```
    For Ubuntu,
    ```
    $ sudo apt install libcurl4-openssl-dev zlib1g-dev
    ```
1. goto https://cmake.org/download/, and download the latest stable install file
2. tar -zxvf cmake-xxxversionxxx.tar.gz
3. cd cmake-xxxversionxxx
4. install
    ```
    $ ./bootstrap --system-curl
    $ make
    $ sudo make install
    ```

## Install Miscellaneous

$ sudo apt install maven $ sudo apt install ant $ sudo apt install libhiredis-dev $ sudo apt install -y libthrift-dev $ sudo apt install -y libprotobuf-dev libprotobuf-c-dev

To install NATS,

$ sudo apt install snapd $ sudo snap install nats

To install GTest,

$ sudo apt install googletest $ sudo apt install googletest-tools


## Install Boost

$ sudo apt install libboost-all-dev


## Install OpenCV
### Preparation

$ sudo apt install -y libssl-dev $ sudo apt install -y git pkg-config $ sudo apt install -y libcurl4-gnutls-dev $ sudo apt install -y libcurl4-openssl-dev $ sudo apt install -y libgtk-3-dev libgtk2.0-dev $ sudo apt install -y libpng-dev libjpeg-dev libjpeg-turbo8-dev libtiff-dev libwebp-dev $ sudo apt install -y libdc1394-22-dev libv4l-dev v4l-utils libxine2-dev $ sudo apt install -y libavcodec-dev libavformat-dev $ sudo apt install -y libxvidcore-dev libx264-dev $ sudo apt install -y gstreamer1.0-opencv libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev $ sudo apt install -y mesa-utils libgl1-mesa-dri $ sudo apt install -y libatlas-base-dev gfortran $ sudo apt install -y libtbb-dev libeigen3-dev $ sudo apt install -y ffmpeg libswscale-dev $ sudo apt install -y libavcodec-dev libavformat-dev libavutil-dev libavresample-dev

### Install OpenCV

$ sudo apt install -y libopencv-contrib4.2 (is already installed on Ubuntu 20.04? check!!) $ sudo apt install -y libopencv-dev $ sudo apt install -y libopencv-contrib-dev # check please


## Install darknet
1. download source

$ git clone https://github.com/AlexeyAB/darknet.git

3. modify MakeFile

$ cd darknet $ vi Makefile

Makefile

GPU=1 CUDNN=1 CUDNN_HALF=0 OPENCV=1 AVX=0 OPENMP=0 LIBSO=0 ZED_CAMERA=0 ZED_CAMERA_v2_8=0

4. build

$ make

5. use darknet folder and files

## Install Python3
python3.8 is already installed on Ubutu 20.04

$ sudo apt install python3-pip # python3-dev will be installed with python3-pip $ sudo pip3 install opencv-python


## Update .profile

JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64

$ JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk

export JAVA_HOME

export CPLUS_INCLUDE_PATH=”/usr/local/include” export LIBRARY_PATH=”/usr/local/lib”

CUDA_PATH=/usr/local/cuda-11.3 export CUDAT_PATH

export LD_LIBRARY_PATH=$CUDA_PATH/lib64:$LD_LIBRARY_PATH export LD_LIBRARY_PATH=”$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu/”

export PATH=$JAVA_HOME/bin:$PATH export PATH=$CUDA_PATH/bin:$PATH


## Install Dev. IDE
https://linuxconfig.org/how-to-install-intellij-idea-on-ubuntu-20-04-linux-desktop

## Opencascade (Optional)
 - download .tar file and unzip
 - install 3rd party first
### Install 3rd party

$ sudo apt install ffmpeg $ sudo apt install libfreeimage-dev $ sudo apt install libfreetype-dev $ sudo apt install libvtk6-dev libvtk6-qt-dev $ sudo apt install libocct-visualization-7.3 $ sudo apt install libvtk7-dev libvtk7-qt-dev $ sudo apt install tcl-vtk7 install qt creator $ sudo apt install libtbb-dev $ sudo apt install tcl $ sudo apt install libtclcl1-dev $ sudo apt install libxmu-dev libxmu-headers libxi-dev $ sudo apt install liblxi-dev lxi-tools # ??

https://wiki.qt.io/Install_Qt_5_on_Ubuntu

### Build Opencascade
 - cmake
 - make
 - make install

$ mkdir build $ cd build $ cmake .. $ make $ sudo make install


# ========================================================================================================================

# Install Graphic driver (old)
## Install Nvidia driver on CentOS
1. nvidia 홈페이지에서 Long Lived Branch Version 다운, 권한 변경(https://www.nvidia.com/en-us/drivers/unix/)

$ chmod +x NVIDIA-Linux-x86_64-4xx.run

2. nvidia 홈페이지에서 CUDA Toolkit 버전 확인 후 설치 명령어 확인 후 terminal에 입력(https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&target_distro=CentOS&target_version=8&target_type=runfilelocal)

$ wget http://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda_10.1.243_418.87.00_linux.run $ sudo sh cuda_10.1.243_418.87.00_linux.run


3. 루트로 변경 후 기본 dev tools 다운

$ sudo su

dnf groupinstall “Development Tools”

dnf install libglvnd-devel elfutils-libelf-devel “kernel-devel-uname-r == $(uname -r)”


4. Nouveau driver를 Grub부트메뉴에서 사용안하도록 변경

grub2-editenv - set “$(grub2-editenv - list | grep kernelopts) nouveau.modeset=0”


5. cli화면에서만 설치가 가능하기에 설정 후 reboot

systemctl set-default multi-user.target

reboot


6. 설치를 진행

bash NVIDIA-Linux-x86_64-4xx.run


7. Gui로 변경 후 reboot

systemctl set-default graphical.target

reboot


## Install Nvidia driver (Ubuntu 18.04v2)
1. add ppa:graphics-drivers/ppa
    ```
    $ sudo add-apt-repository ppa:graphics-drivers/ppa
    ```
2. install graphic driver
    ```
    $ sudo apt install nvidia-driver-418
    ```
    
## Install Nvidia driver (Ubuntu 20.04)
1. install graphic driver (auto)
2. install cuda toolkit (https://developer.nvidia.com/cuda-toolkit-archive)
4. install cudnn (https://developer.nvidia.com/cudnn)

$ tar xvzf cudnn-11.2-linux-x64-v8.1.0.77.tgz $ sudo cp cuda/include/cudnn* /usr/local/cuda/include $ sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64 $ sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*

5. install cudnn toolkit

$ sudo apt install nvidia-cuda-toolkit


# Install Machine Learning Environment
## Install cuda driver
1. installation instruction
 - refer to https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html

2. check the installation
    ```
    $nvcc --version
    ```
3. add path into .bashrc if you can not run nvcc although you've installed cuda
    ```
    CUDA_HOME=/usr/local/cuda
    export PATH=$CUDA_HOME/bin:$PATH
    ```
4. update .bash_profile (Ubuntu, .profile)
    ```
    $source ~/.bash_profile
    ```
## Install cuDNN
 - refer https://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html
 - notice: check the version of cuda and cuDNN 

# Update Repository
1. update yum 
    ```
    $ sudo yum -y update
    $ sudo yum -y install yum-utils
    ```
2. install epel repository
    ```
    $ sudo yum -y install epel-release
    ```
3. install ius repository(not recommended)
    ```
    $ sudo yum -y install https://centos8.iuscommunity.org/ius-release.rpm
    ```
4. update yum again
    ```
    $ sudo yum -y update
    ```
5. install default environment
    ```
    $ sudo yum groupinstall "Development Tools"
    ```
    For Ubuntu,
    ```
    $ sudo apt install build-essential
    $ sudo apt install ubuntu-restricted-extras (to intall extra media codecs)
    ```
 *** important ***
 *** after update and upgrade, do step.0 process again ***

6. install docker
    ```
    $ sudo yum install -y yum-utils \
    device-mapper-persistent-data \
    lvm2
    $ sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo
    ```
    __newest version download__
    ```
    $ sudo yum install docker-ce docker-ce-cli containerd.io --nobest
    ```
    __tarket version download__
    ```
    $ yum list docker-ce --showduplicates | sort -r
    $ sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io
    ```
    
    ```
    # systemctl register
    $ sudo sytemctl enable docker
    $ sudo systemctl start docker
    # root permission 
    $ sudo usermod -aG docker [username]
    $ sudo systemctl reboot
    ```

# Install Cmake
0. install curl-devel zlib-devel (the cmake with Https support is needed for installing opencv) 
https://github.com/opencv/opencv_contrib/issues/1131 (check skvark's comment and ./bootstrap --system-curl. from the version of Cmake-3.12, --system-curls might be not needed for Https support)
    ```
    $ sudo yum -y install curl-devel zlib-devel
    ```
    For Ubuntu,
    ```
    $ sudo apt install libcurl4-openssl-dev zlib1g-dev
    ```
1. goto https://cmake.org, and download the latest stable install file
2. tar -zxvf cmake-xxxversionxxx.tar.gz
3. cd cmake-xxxversionxxx
4. install
    ```
    $ ./bootstrap --system-curl
    $ sudo make
    $ sudo make install
    ```

# Install Java(openjdk), and modify environment 
1. search and install openjdk
    ```
    $ yum search openjdk
    $ sudo yum install java-1.8.0-openjdk
    $ sudo yum install java-1.8.0-openjdk-devel
    ```
    For Ubuntu, 
    ```
    $ sudo apt install openjdk-8-jdk openjdk-8-jre
    ```
    
2. add the below to .bash_profile
    ```
    $ JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk (or /etc/alternatives/java_sdk_1.8.0_openjdk)
    $ export JAVA_HOME
    ```

# Install Maven
1. goto maven webpage(https://maven.apache.org), and download the binary install file
2. copy to /opt, and unzip the file
    ```
    $ sudo cp ~/Downloads/apache-maven-xxx.tar.gz /opt/
    $ cd opt
    $ sudo tar -zxvf apache-maven-xxx.tar.gz
    ```
3. make the link, and update environment
    ```
    $ sudo ln -s apache-maven-xxx maven
    $ vi ~/.bash_profile
    $ MAVEN_HOME=/opt/maven
    $ export PATH=$MAVEN_HOME/bin:$PATH
    ```

# Install Ant
1. goto ant webpage(https://ant.apache.org), and download the binary install file
2. copy to /opt, and unzip the file
    ```
    $ sudo cp ~/Downloads/apache-ant-xxx.tar.gz /opt/
    $ cd opt
    $ sudo tar -zxvf apahce-ant-xxx.tar.gz
    ```
    For Ubuntu,
    You can just install ant with apt on Ubuntu18.04. Check the installed path if you use apt.
    ```
    $ sudo apt install ant
    ```
3. make the link, and update environment
    ```
    $ sudo ln -s apache-ant-xxx ant
    $ vi ~/.bash_profile
    $ ANT_HOME=/opt/ant
    $ export PATH=$ANT_HOME/bin:$PATH
    ```
    
# Update Source
 * Centos: .bash_profile, Ubuntu: .profile
    ```
    $ source ~/.bash_profile
    ```

# Install Environment(Python, other libraries) to install opencv
1. upgrade and update
    ```
    $ sudo yum update
    $ sudo yum upgrade
    ```
2. install python2xx and tools
    ```
    $ sudo yum install python-devel
    $ sudo yum install python-pip
    ```
3. install python36 and tools
 * CentOS8: python3 is default
 * CentOS7: python36u, Ubutu18.04: python3
    ```
    $ sudo yum -y install python36
    $ sudo yum -y install python36-devel
    $ sudo yum -y install python36-pip
    ```
4. install python packages
    ```
    $ python --version (check the version of python2x)
    $ sudo pip install numpy (this is for version 2.7x)
    $ python3.6 --version (check the version of python3x)
    $ sudo pip3.6 install numpy (this is for version 3.6x)
    ```
# Install Virtual Envirionment
https://wsvincent.com/install-python3-mac/
## install virtualenv and set environment

$sudo apt install pip3 python3-dev (python36 for CentOS) $pip3 install (–userId) virtualenv (check PermissionError can be occurred without ‘userId’) $cd ~/ $mkdir virtualenvs $cd virtualenvs $source .profile (if path is not updated) $virtualenv –python=python3.6 your_virtualenv_name

## run virtualenv

$source ./your_virtualenv_name/bin/activate $pip3 install … … $which python3 /home/your_id/virtualenvs/your_virtialenv_name/bin/python3 (important!!) $deactivate


# Install OpenCV
1. install additional packages for opencv (CentOS, check the newest way)
    ```
    $ sudo yum install curl-devel zlib-devel
    $ sudo yum install gtk+-devel gtk2-devel gtk3-devel
    $ sudo yum install git pkgconfig (they might be installed)
    $ sudo yum install libpng-devel libjpeg-turbo-devel jasper-devel openexr-devel libtiff-devel libwebp-devel (to support various image format)
    $ sudo yum install libdc1394-devel libv4l-devel (for video format)
    $ sudo yum install gstreamer-dev gstreamer-plugins-base-devel gstreamer1-dev gstreamer1-plugins-base-devel 
    $ sudo yum install tbb-devel eigen3-devel
    $ sudo yum install epel-release (might be installed in the environment setting step)
    $ sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm 
    $ sudo yum install ffmpeg ffmpeg-dev (for libavcodec libavformat libavutil libswscale libavresample)

    ```
    For Ubuntu,
    ```
    $ sudo apt install git pkg-config (default for development)
    $ sudo apt install libcurl4-gnutls-dev libcurl4-openssl-dev
    $ sudo apt install libgtk-3-dev libgtk2.0-dev
    $ sudo apt install libpng-dev libjpeg-dev libjpeg-turbo8-dev libtiff-dev libwebp-dev
    $ sudo apt install libdc1394-22-dev libv4l-dev 
    $ sudo apt install libavcodec-dev libavformat-dev ***
    $ sudo apt install libxvidcore-dev libx264-dev ***
    $ sudo apt-get install gstreamer1.0-opencv libgstreamer1.0-dev 
    $ sudo apt install libtbb-dev libeigen3-dev
    $ sudo apt install ffmpeg libswscale-dev
    $ sudo apt install libavcodec-dev libavformat-dev libavutil-dev libsescale-dev libavresample-dev
    $ sudo apt install libatlas-base-dev gfortran ***
    $ sudo apt install libgoogle-glog-dev
    ```
2. set virtual envirionment for opencv
3. prepair install file
    ```
    $ mkdir opencv
    $ cd opencv
    $ git clone https://github.com/opencv/opencv_contrib.git
    $ git clone https://github.com/opencv/opencv.git
    $ mkdir build (this is <opencv_build_derectory> as the below)
    ```
3. install opencv-contrib (you can use xfeature2 with opencv_contrib version), https://github.com/opencv/opencv_contrib
    ```
    $ cd <opencv_build_directory>
    $ cmake -DOPENCV_EXTRA_MODULES_PATH=<opencv_contrib>/modules <opencv_source_directory> -DOPENCV_ENABLE_NONFREE=ON
    $ make -j5
    $ sudo make install
    ```
https://mickael-k.tistory.com/46

# How to fix locale error
Edit /etc/environment and add the following. Replace en_US with your actual locale if you are not using en_US:

LC_ALL=”en_US.UTF-8” LC_CTYPE=”en_US.UTF-8” LANGUAGE=”en_US.UTF-8”


# Install Boost and Thrift
1. install additional packages for thrift
    ```
    $ sudo yum install wget autoconf automake bison (might be installed) (flex?)
    $ sudo yum install libevent-devel
    $ sudo yum install zlib-devel
    $ sudo yum install openssl-devel
    $ sudo yum install nodejs
    ```
    For Ubuntu,
    ```
    $ sudo apt install git wget autoconf automake bison
    $ sudo apt install libevent-dev zlib1g-dev libcurl4-openssl-dev
    $ sudo apt install libtool
    $ sudo apt install pkg-config curl flex
    $ sudo apt install nodejs
    $ sudo apt install npm
    ```
2. go to the boost site (http://www.boost.org), and download the install file
3. unzip the downloaed file
    ```
    $ tar -zxvf boost_1_6xx.tar.gz
    ```
4. install boost
    ```
    $ cd boost_1_6xx
    $ sudo ./bootstrap.sh (option: --prefix=/opt/boost(install directory), recommend to use default directory)
    $ sudo ./b2 
    $ sudo ./b2 install
    ```
5. install thrift
    ```
    $ git clone https://github.com/apache/thrift
    $ cd thrift
    $ ./bootstrap.sh
    $ ./configure --with-boost=/opt/boost --without-ruby --without-lua
    $ make
    $ sudo make install
    ```
    
    The default ruby version of CentOS is 2.0, but thrift 0.12 needs over 2.3.
    It is not easy to install ruby 2.3 with other libraries, such as bundler...
    So, I recommend --without-ruby
    If you meet bundler version problem (version down could be needed) during make, uninstall bundler and reinstall
    ```
    $ gem uninstall bundler
    $ gem install bundler --version '1.11'
    ```

# Install Nats and Porobuf

### Linux

#### 1. install protobuf and protobuf-c

$ sudo yum install -y protobuf protobuf-c


#### 2. install protobuf

reference: https://github.com/protocolbuffers/protobuf/tree/master/src

$ git clone https://github.com/protocolbuffers/protobuf.git $ cd protobuf $ git submodule update –init –recursive $ ./autogen.sh


$ ./configure $ make $ make check $ sudo make install $ sudo ldconfig # refresh shared library cache.


#### 3. install protobuf-c 

update ~/.bash_profile for protobuf configuration

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ```

reference: https://github.com/protobuf-c/protobuf-c

$ git clone https://github.com/protobuf-c/protobuf-c.git
$ cd protobuf-c
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install

(option) install protobuf-c

reference: http://google.github.io/proto-lens/installing-protoc.html

$ PROTOC_ZIP=protoc-3.7.1-linux-x86_64.zip
$ curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.7.1/$PROTOC_ZIP
$ sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
$ sudo unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
$ rm -f $PROTOC_ZIP

4. install openssl and openssl-devel

$ sudo yum install -y openssl openssl-devel

5. install nats client (C version)

reference: https://nats.io/download/nats-io/nats.c/

$ git clone https://github.com/nats-io/nats.c.git
$ cd nats.c
$ mkdir build
$ cd build
$ cmake ..
$ make
$ sudo make install

Mac

1. install protobuf protobuf-c

$ brew install protobuf protobuf-c

2. install openssl and openssl-devel

$ brew install openssl openssl-devel

3. add environment variable “OPENSSL_HOME” to .bash_profile

OPENSSL_HOME=/usr/local/opt/openssl@1.1
export PATH=$OPENSSL_HOME/bin:$PATH

4. install nats clienht (C version)

$ git clone https://github.com/nats-io/nats.c.git
$ cd nats.c
$ mkdir build
$ cd build
$ cmake 
$ make
$ sudo make install

Windows

1. vcpkg integrate

visual studio 랑 vcpkg 통합 시켜주는 기능

C:\vcpkg > vcpkg integrate install

2. protobuf (for streaming) install

vcpkg install protobuf:x64-windows

3. install openssl, zlib, curl with vcpkg

vcpkg install openssl:x64-windows zlib:x64-windows curl:x64-windows
  • 시스템 속성->환경 변수->시스템 변수 추가 후 재부팅
  • 변수명: OPENSSL_ROOT_DIR, 경로명: C:\vcpkg-master\installed\x64-windows (depends on your system)

4. install cmake install

  • install cmake with windows installer (binary)
  • 모든 유저에 환경 변수 등록 적용
  • 적용된 환경 변수 사용을 위해, cmake 설치 후 새로운 콘솔창 띄우고 사용

5. install Boost [install] (https://boost.org)

  • go to boost homepage and download boost_version.zip
  • unzip boost_version.zip and put it on proper place
  • go to boost folder and run the below
$ bootstrap.bat
$ .\b2

6. install NATS C client install

  • download .zip file and decompress it
  • 압축 푼 디렉토리 밑에 build 디렉토리 생성
  • 윈도우즈에서 protobuf-c 설치 실패 시, cmake 실행 때 -DNATS_BUILD_STREAMING=OFF 옵션 사용 (NATS Streaming API 지원 불가)
  • 참고로, 2020년 8월 현재 vcpkg install protobuf-c 설치 지원하지 않음
mkdir build
cd build
cmake .. -DNATS_BUILD_STREAMING=OFF

7. NATS C Client 설치 결과

  • 5번 build 디텍토리에 cnats.sln 파일 생성됨
  • Visual Studio로 cnats.sln 로딩 후 All Build
  • 빌드 경로 디렉터리에 lib, dll 파일이 생성된다. ex) C:\nats.c-master\build\src\Release
  • include 파일 ex) C:\nats.c-master\src
C
└── nats.c-master
    └── src
         └── adapters
         └── nats.h
         └── status.h
         └── version.h

####

Leave a comment