Pages - Menu

標籤

AWS (1) bash (1) Boost (2) C (2) CMake (2) Concurrency_Programming (3) CPP (37) Database (2) DNS (1) Docker (4) Docker-Compose (1) ELK (1) emacs (4) gcp (1) gdrive (1) git (1) gitbash (2) gitlab (1) kvm (4) Linux (5) MT4 (4) MT5 (4) Multicast (2) MySQL (2) Nijatrader8 (1) OpenCV (1) Python (4) QT5 (1) R (1) rdp (3) screenshot (1) ssh (3) Tabnine (1) TCP (1) TensorFlow (1) Tools (12) Ubuntu_1904 (11) Ubuntu_20_04 (5) UDP (1) VS2010 (1) VS2015 (1) VS2019 (1) WebServer (1) Win10 (1) winmerge (1) WSL (1) xrdp (1)

搜尋此網誌

2020年1月15日星期三

Linux dynamic library installation, ldconfig, .so file, application distribution

Problem

  • Using ubuntu 19.04
  • Local build cpp application
  • Installed to /usr/local/yourLib
  • Error message
    • cannot open shared object file: No such file or directory

Structure

  • /usr/local/yourLib/bin
  • /usr/local/yourLib/lib
  • /usr/local/yourLib/include

Solution

  • Add path permanent
    • sudo touch /etc/ld.so.conf.d/user.conf
      sudo echo "/usr/local/yourLib/lib" >> /etc/ld.so.conf.d/user.conf
      sudo ldconfig
      
  • Add path temporary
    • export LD_LIBRARY_PATH=/usr/local/yourLib/lib
      

2020年1月12日星期日

Ubuntu 19.04 cannot access external disk after install chrome-remote-desktop

Problem

  • Using ubuntu 19.04
  • Installed chrome-remote-desktop
  • Cannot auto mount external usb drive, authorization problem

Reason

  • user under group chrome-remote-desktop

Work around

  • Remove user from that group

Learn from

Current status

  • Cannot find a way to solve this problem yet.

2020年1月7日星期二

Install dlib

Install dlib on python 3

Learn from

Installation Steps

$ pip install numpy
$ pip install scipy
$ pip install -U scikit-image
$ pip install dlib

Install dlib on c++

# build dlib locally
wget http://dlib.net/files/dlib-19.6.tar.bz2
tar xvf dlib-19.9.tar.bz2
cd dlib-19.6/
mkdir build
cd build
cmake ..
cmake --build . --config Release
sudo make install
# update the link libraries, so that programs knows where to find the dynamic lib during run time
sudo ldconfig
cd ..
# Now you can use pkg-config to provide path to Dlib’s include directory and link Dlib library file. This is useful during build time
pkg-config --libs --cflags dlib-1

2020年1月6日星期一

Install TensorFlow 2.0 on Ubuntu 19.04, Python 3

Learn From

Install TensorFlow 2.0

sudo apt-get install screen
sudo apt-get install libxmu-dev libxi-dev libglu1-mesa libglu1-mesa-dev 
sudo apt-get install libjpeg-dev libpng-dev libtiff-dev
sudo apt-get install libavcodec-dev libavformat-dev libswscale-del libv4l-dev 
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev 
sudo apt-get install libxvidcore-dev libx264-dev
sudo apt-get install libopenblas-dev libatlas-base-dev liblapack-dev gfortran
sudo apt-get install libhdf5-dev
sudo apt-get install python3-dev python3-tk python-pil.imagetk
sudo apt-get install libgtk-3-dev

Install CUDA 10.0

You may try to install the latest CUDA.

cd ~
mkdir installers
cd installers/
wget https://developer.nvidia.com/compute/cuda/10.0/Prod/local_installers/cuda_10.0.130_410.48_linux

===========
= Summary =
===========

Driver:   Not Selected
Toolkit:  Installed in /usr/local/cuda-10.0
Samples:  Installed in /home/sulfred

Please make sure that
 -   PATH includes /usr/local/cuda-10.0/bin
 -   LD_LIBRARY_PATH includes /usr/local/cuda-10.0/lib64, or, add /usr/local/cuda-10.0/lib64 to /etc/ld.so.conf and run ldconfig as root

To uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-10.0/bin

Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-10.0/doc/pdf for detailed information on setting up CUDA.

Add CUDA Path

vim ~/.bashrc

# NVIDIA CUDA Toolkit
export PATH=/usr/local/cuda-10.0/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64:$LD_LIBRARY_PATH

Install cuDNN

Download from : download page

You may download the latest cudnn. Here we are using cudnn-10.0, for example: cudnn-10.0-linux-x64-v7.4.2.24.tgz to ~/installers


cd ~/installers
tar -zxf cudnn-10.0-linux-x64-v7.4.2.24.tgz
cd cuda
sudo cp -P lib64/* /usr/local/cuda/lib64/
sudo cp -P include/* /usr/local/cuda/include/

Prepare python virtual environment

# standard image processing
pip install opencv-contrib-python
pip install scikit-image
pip install pillow
pip install imutils

# machine learning libraries
pip install scikit-learn
pip install matplotlib
pip install pregressbar2
pip install beautifulsoup4
pip install pandas

2020年1月5日星期日

Create cpp tags for code navigation on spacemacs

Aim

We would like to use cscope and gtags to create tags for c++ development.

prepareSpacemacsTags.sh

#!/bin/bash
buildPath="$PWD"

# remove old tags
rm ${buildPath}/GPATH
rm ${buildPath}/GRTAGS
rm ${buildPath}/GTAGS

rm ${buildPath}/cscope.files
rm ${buildPath}/cscope.out
rm ${buildPath}/cscope.in.out
rm ${buildPath}/cscope.po.out

# make tags
echo "######### make GTag"
gtags
echo "######### make cscope"
find . -name "*.cc" -o -name "*.c" -o -name "*.cpp" -o -name "*.h" -o -name "*.hpp" > cscope.files
cscope -q -R -b -k -i cscope.files

Usage

$ cd /path/to/project/root
$ prepareSpacemacsTags.sh

prepareTags.YourProject.sh

#!/bin/bash
basePath=`pwd`
tempTagPath="$basePath/../tempTagFolder"
appFolders=("APPFolderName") # filter out

# move all folders beyond root
if [ ! -d "$tempTagPath" ]; then
    mkdir "$tempTagPath"
fi
if [ ! -d "$tempTagPath/app" ]; then
    mkdir "$tempTagPath/app"
fi
for folder in ${appFolders[@]}; do
    nextFolder="$basePath/app/$folder"
    mv $nextFolder $tempTagPath/app
done

prepareSpacemacsTags.sh

mv $tempTagPath/app/* ./app

if [ -d "$tempTagPath/app" ] && [ -z "$(ls -A $tempTagPath/app/)" ]; then
    rm -rf $tempTagPath/app
else
    echo "No need to have further action $tempTagPath/app"
fi
if [ -d "$tempTagPath" ] && [ -z "$(ls -A $tempTagPath)" ]; then
    rm -rf $tempTagPath
else
    echo "No need to have further action $tempTagPath"
fi

Usage

$ cd /path/to/project/root
$ ls
./app
./lib
$ prepareTags.YourProject.sh

2020年1月3日星期五

Ubuntu 19.04 stay in splash screen after installed nvidia driver

Spec:

  • Ubuntu 19.04
  • GTX 1070
  • HP 420 workstation
Problems:
  • Stay in splash screen and cannot login after installed Nvidia driver 418
  • No problem when using Nouveau open source display driver
Work around:
  • Install Ubuntu without installing 3rd party and updates
  • edit /etc/default/grub
    • from
      • GRUB_TIMEOUT=0
      • GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
    • to
      • GRUB_TIMEOUT=8
      • GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset"
    • Now OS boot without display driver enabled in kernel
Final solution: