Monday, July 10, 2017

[Solved] Problems in installing caffe in ubuntu 16.04

A very complete guidline
https://github.com/BVLC/caffe/wiki/Ubuntu-16.04-or-15.10-Installation-Guide

It is easier to use cmake than to use the Makefile.config.

1. Problems caused by Anaconda.
Since Anaconda use gcc 4.7 and the Ubuntu 16 system use gcc 5.4, there occur a lot problems.

Solution:
Don't use Anaconda.
$ vim ~/.bashrc
comment line #export PATH="/home/ks/anaconda2/bin:$PATH"
$ sudo apt install python-pip
$ cd <caffe-master>/python
$ for req in $(cat requirements.txt); do pip install $req; done
$ cd ..
$ mkdir build1
$ cd build1
$ cmake ..
$ make -j<nproc>

Description copied from http://www.cnblogs.com/kingstrong/p/6015157.html
CXX/LD -o .build_release/tools/compute_image_mean.bin
.build_release/tools/test_net.o:在函数‘boost::system::system_error::what() const’中:
test_net.cpp:(.text._ZNK5boost6system12system_error4whatEv[_ZNK5boost6system12system_error4whatEv]+0x74):对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace(unsigned long, unsigned long, char const*, unsigned long)’未定义的引用
test_net.cpp:(.text._ZNK5boost6system12system_error4whatEv[_ZNK5boost6system12system_error4whatEv]+0xa1):对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_append(char const*, unsigned long)’未定义的引用
test_net.cpp:(.text._ZNK5boost6system12system_error4whatEv[_ZNK5boost6system12system_error4whatEv]+0xe3):对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_append(char const*, unsigned long)’未定义的引用
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libgflags.so:对��.build_release/tools/train_net.o:在函数‘boost::system::system_error::what() const’中:
train_net.cpp:(.text._ZNK5boost6system12system_error4whatEv[_ZNK5boost6system12system_error4whatEv]+0x74):对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace(unsigned long, unsigned long, char const*, unsigned long)’未定义的引用
train_net.cpp:(.text._ZNK5boost6system12system_error4whatEv[_ZNK5boost6system12system_error4whatEv]+0xa1):对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_append(char const*, unsigned long)’未定义的引用
train_net.cpp:(.text._ZNK5boost6system12system_error4whatEv[_ZNK5boost6system12system_error4whatEv]+0xe3):对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_append(char const*, unsigned long)’未定义的引用
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libgflags.so:对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const@GLIBCXX_3.4.21’未定义的引用
/usr/local/lib/libglog.so:对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long)@GLIBCXX_3.4.21’未定义的引用
/usr/local/lib/libglog.so:对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace_aux(unsigned long, unsigned long, unsigned long, char)@GLIBCXX_3.4.21’未定义的引用
/usr/local/lib/libglog.so:对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_append(char const*, unsigned long)@GLIBCXX_3.4.21’未定义的引用
/usr/local/lib/libglog.so:对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace(unsigned long, unsigned long, char const*, unsigned long)@GLIBCXX_3.4.21’未定义的引用
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libgflags.so:对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct(unsigned long, char)@GLIBCXX_3.4.21’未定义的引用
/usr/local/lib/libglog.so:对‘vtable for std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >@GLIBCXX_3.4.21’未定义的引用
/usr/local/lib/libglog.so:对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::assign(char const*)@GLIBCXX_3.4.21’未定义的引用
/usr/local/lib/libglog.so:对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_assign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libgflags.so:对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(std::__cxx11::basic_string<char, std::<char_traits<char>char>, std:> :allocator<char> > const&) const@GLIBCXX_3.4.21’未定义的引用
/usr/local/lib/libglog.so:对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long)@GLIBCXX_3.4.21’未定义的引用
/usr/local/lib/libglog.so:对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace_aux(unsigned long, unsigned long, unsigned long, char)@GLIBCXX_3.4.21’未定义的引用
/usr/local/lib/libglog.so:对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_append(char const*, unsigned long)@GLIBCXX_3.4.21’未定义的引用
/usr/local/lib/libglog.so:对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace(unsigned long, unsigned long, char const*, unsigned long)@GLIBCXX_3.4.21’未定义的引用
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libgflags.so:对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct(unsigned long, char)@GLIBCXX_3.4.21’未定义的引用
/usr/local/lib/�libglog.so:对‘vtable for std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >@GLIBCXX_3.4.21’未定义的引用
/usr/local/lib/libglog.so:对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::assign(char const*)@GLIBCXX_3.4.21’未定义的引用
/usr/local/lib/libglog.so:对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_assign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@GLIBCXX_3.4.21’未定义的引用
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libgflags.so:对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_erase(unsigned long, unsigned long)@GLIBCXX_3.4.21’未定义的引用
/usr/local/lib/libglog.so:对‘vtable for std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >@GLIBCXX_3.4.21’未定义的引用
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libgflags.so:对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::reserve(unsigned long)@GLIBCXX_3.4.21’未定义的引用
/usr/local/lib/libglog.so:collect2: error: ld returned 1 exit status
对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(char const*) const@GLIBCXX_3.4.21’未定义的引用
collect2: error: ld returned 1 exit status
/../x86_64-linux-gnu/libgflags.so:�对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace(unsigned long, unsigned long, char const*, unsigned long)’未定义的引用
finetune_net.cpp:(.text._ZNK5boost6system12system_error4whatEv[_ZNK5boost6system12system_error4whatEv]+0xa1):对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_append(char const*, unsigned long)’未定义的引用
finetune_net.cpp:(.text._ZNK5boost6system12system_error4whatEv[_ZNK5boost6system12system_error4whatEv]+0xe3):对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_append(char const*, unsigned long)’未定义的引用
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libgflags.so:对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const@GLIBCXX_3.4.21’未定义的引用
/usr/local/lib/libglog.so:对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long)@GLIBCXX_3.4.21’未定义的引用
/usr/local/lib/libglog.so:对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace_aux(unsigned long, unsigned long, unsigned long, char)@GLIBCXX_3.4.21’未定义的引用
/usr/local/lib/libglog.so:对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_append(char const*, unsigned long)@GLIBCXX_3.4.21’未定义的引用
/usr/local/lib/libglog.so:对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace(unsigned long, unsigned long, char const*, unsigned long)@GLIBCXX_3.4.21’未定义的引用
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libgflags.so:对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct(unsigned long, char)@GLIBCXX_3.4.21’未定义的引用
/usr/local/lib/libglog.so:对‘vtable for std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >@GLIBCXX_3.4.21’未定义的引用
/usr/local/lib/libglog.so:对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::assign(char const*)@GLIBCXX_3.4.21’未定义的引用
/usr/local/lib/libglog.so:对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_assign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@GLIBCXX_3.4.21’未定义的引用
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libgflags.so:对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_erase(unsigned long, unsigned long)@GLIBCXX_3.4.21’未定义的引用
/usr/local/lib/libglog.so:对‘vtable for std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >@GLIBCXX_3.4.21’未定义的引用
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libgflags.so:对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::reserve(unsigned long)@GLIBCXX_3.4.21’未定义的引用
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libgflags.so:对‘std::__throw_out_of_range_fmt(char const*, ...)@GLIBCXX_3.4.20’未定义的引用
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libgflags.so:对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::rfind(char, unsigned long) const@GLIBCXX_3.4.21’未定义的引用
/usr/local/lib/libglog.so:对‘std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::_M_sync(char*, unsigned long, unsigned long)@GLIBCXX_3.4.21’未定义的引用
/usr/local/lib/libglog.so:对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()@GLIBCXX_3.4.21’未定义的引用
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libgflags.so:对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::append(char const*)@GLIBCXX_3.4.21’未定义的引用
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libgflags.so:对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find(char, unsigned long) const@GLIBCXX_3.4.21’未定义的引用
/usr/local/lib/libglog.so:对‘std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_ostringstream()@GLIBCXX_3.4.21’未定义的引用
/usr/local/lib/libglog.so:对‘VTT for std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >@GLIBCXX_3.4.21’未定义的引用
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libgflags.so:对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find(char const*, unsigned long, unsigned long) const@GLIBCXX_3.4.21’未定义的引用
/usr/local/lib/libglog.so:对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(char const*) const@GLIBCXX_3.4.21’未定义的引用
collect2: error: ld returned 1 exit status
。。。很长一串问题
复制代码
对于这个问题找了N久都没有找到答案,在caffe的issue中看到有人有同样的问题,但并没有得到答案,后来在另一个问题中看到了一个方法https://github.com/BVLC/caffe/issues/2348,
复制代码
cd caffe
cp Makefile.config.example Makefile.config
and change setting in Makefile.config
mkdir build
cd build
cmake ..
./configure (??not sure??)
make all
复制代码
执行一遍后发现有戏啊,可是又有一个新的关于opencv_imgcodecs的问题,同样在刚才的链接中的方法
add "opencv_imgcodecs" in Makefile.(LIBRARIES += glog gflags protobuf leveldb snappy \
lmdb boost_system hdf5_hl hdf5 m \
opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs)
就是在makefile的“LIBRARIES +=”中添加一个“opencv_imgcodecs”,make clean,再make all这样刚才的问题就没有了
这样就可以了???结果又出了一个新的问题,/usr/lib/libopencv_highgui.so.2.4: undefined reference to TIFFRGBAImageOK@LIBTIFF_4.0' 1>
网上说是opencv编译的问题,于是就重新编译opencv,这次编译cmake加上一个参数:
-D BUILD_TIFF=ON
于是又屁颠屁颠的开始编译了,这一次已经有了报错的心里准备了,果然新的问题来了,//usr/lib/x86_64-linux-gnu/libsoxr.so.0:对‘GOMP_parallel@GOMP_4.0’未定义的,
对于这个问题我以为百度一下就能解决,可事实证明我还是too young too simple,这个问题找了很久都没找到答案,但是有个发现,就是稍微沾边的解释里都有anaconda,突然醒悟,我现在遭的罪不都是安装了anaconda后造成的么,搞不好是anaconda与系统兼容造成的,于是我决定anaconda
零时屏蔽了再来编译opencv试试,屏蔽的具体方法是在
sudo gedit ~/.bashrc
在下面这两句话前面加上“#”注释掉
#export PATH="/home/ks/anaconda2/bin:$PATH"
#export LD_LIBRARY_PATH="/home/ks/anaconda2/lib:$LD_LIBRARY_PATH"
然后再次来编译opencv,奇迹出现啦,经过漫长的等待,opencv终于编译完成啦,现在回头想想,caffe之所以编译报那么多错肯定也是由anaconda造成的,但是屏蔽anaconda后用以前的方法直接编译caffe还是会报很多错,不过用上面提到的cmake的方式进行编译就顺利的完成了。



Ubuntu Install conda with python2.7

Sample of install Anaconda with python 3
https://www.digitalocean.com/community/tutorials/how-to-install-the-anaconda-python-distribution-on-ubuntu-16-04

1. Download from the official website https://www.continuum.io/downloads
or

$ curl -O https://repo.continuum.io/archive/Anaconda2-2.4.0-Linux-x86_64.sh

2. compare meta data

$ sha256sum Anaconda2-2.4.0-Linux-x86_64.sh

3. Install

$ sh Anaconda2-2.4.0-Linux-x86_64.sh

4. source

$ source ~/.bashrc

[Solved] Ubuntu log in GUI problem

Solve Ubuntu log in GUI problem

Problem definition:
I have ubuntu-desktop 16.04 to access it via GUI. Now I get the GUI login screen with my username (display name) but when i enter my password the screen just flicks and comes back to login screen ( doesnt give me any error). the same user works fine with same credentials in CLI.
strange thing is when i click on guest, it logs me in straight away and works fine.

Solution from stackflow:

This looks like the .Xauthority file is corrupted. Try this in a tty:
sudo mv .Xauthority .Xauthority_backup
Then restart lightdm and try to log in again:
sudo service lightdm restart
If that was not the cause, restore the file to its previous state:
sudo mv .Xauthority_backup .Xauthority

Monday, July 3, 2017

How can I copy/paste files via RDP in Ubuntu?

https://github.com/FreeRDP/Remmina/issues/243 says that shares show up using Remmina when you also enable sound redirection. To recap, here is what you have to do:
  1. Create a Remmina RDP connection to the windows machine
  2. Choose a share folder
  3. In Advanced tab, change sound to local. Save it and connect
Then the shared folder appears in My computer in windows.
(If it does not appear, trying clicking Refresh).

4. Try restart Remmina if it doesn't work.

Crack Matlab 2016b in Ubuntu 16.04

http://www.linuxdiyf.com/linux/27432.html
http://www.linuxdiyf.com/linux/26858.html

挂载映像文件
在安装前,把所需文件都拷贝到了home目录,用完就删,反正硬盘有备份。那么使用下列命令挂先行载R2016b_glnxa64_dvd1.iso:
cd ~
mkdir matlab
sudo mount -t auto -o loop Linux/R2016b_glnxa64_dvd1.iso matlab/
 
安装Matlab
挂载iso之后,会发现文件系统多了一个盘,说明挂载成功,然后进行安装:
cd matlab/
sudo ./install
安装进行到82%的时候,会弹出一个提示框,说请插入dvd2,这时候我们需要重新开一个终端,把dvd2挂载到matlab文件夹中:
sudo mount -t auto -o loop Linux/R2016b_glnxa64_dvd2.iso matlab/
然后在对话框中点击OK,继续安装。完成安装后取消iso挂载:
umount matlab/

激活Matlab
安装完成后,可以在终端中输入matlab打开软件,如果失败,只能去安装位置打开:
cd /usr/local/MATLAB/R2016b/bin
./matlab
第一步,先载入激活文件license_standalone.lic:
第二步,把Crack文件夹中R2016b/Linux/R2016b/bin/glnxa64四个文件,复制到/usr/local/MATLAB/R2016b/bin/glnxa64目录下:

Friday, June 30, 2017

Bug summary when building caffe in Ubuntu 16.04

## pycaffe installation problems
# bug1
>>> import caffe
ImportError: /home/../anaconda2/lib/python2.7/site-packages/zmq/backend/cython/../../../../.././libstdc++.so.6: versionGLIBCXX_3.4.21' not found (required by ../python/caffe/_caffe.so)`
>>> quit()
# solution
$ conda install libgcc

# bug2
ImportError: No module named google.protobuf.internal
# solution
$ pip install protobuf
$ /home/username/anaconda2/bin/pip install protobuf

Thursday, June 29, 2017

Bug summary when building caffe in windows

Caffe installation bugs
Though following the official guidelines, there are also some problems related to different version of compilers or libraries.
The official guidelines are in
https://github.com/BVLC/caffe/tree/windows

I use the compiler vs2015 (MSVC=14), while the official one support vs2013, and ninja instead of cmake.

##
# bug 1
Error 'fatal error: pyconfig.h: No such file or directory'

# Solution
Add python path to system path

# bug 2
.\caffe/export.hpp(7): fatal error C1083: Cannot open include file: 'caffe/include_symbols.hpp'
# Solution
It seems the problem with vs2015. I didn't find the internal problem, but had a tricky solution. We may build with vs2013 first and then copy the include_symbols.hpp in the same path, finally the building will be successful.