2015年3月4日 星期三

YouCompleteMe on Debian Wheezy

reference : http://povilasb.com/vim/you_complete_me.html

Installation on Debian Wheezy

  1. Follow Ubuntu Linux x64 super-quick installation. It will install YouCompleteMe plugin which downloads libclang.so. Unfortunately the downloaded library depends on glibc 2.14 while Debian Wheezy comes with glibc 2.13.
  2. Get libclang.so library built for Debian Wheezy. It’s in libclang1-3.5 package:
    $ echo "deb http://llvm.org/apt/wheezy/ llvm-toolchain-wheezy main" >> /etc/apt/sources.list
    $ echo "deb-src http://llvm.org/apt/wheezy/ llvm-toolchain-wheezy main" >> /etc/apt/sources.list
    $ sudo apt-get update
    $ sudo apt-get install libclang1-3.5
  3. Put libclang.so to ~/.vim/bundle/YouCompleteMe/third_party/ycmd:
    $ cd ~/.vim/bundle/YouCompleteMe/third_party/ycmd
    $ ln -s /usr/lib/x86_64-linux-gnu/libclang-3.5.so.1 libclang.so
  4. That’s it. YouCompleteMe should work on Debian Wheezy.

Debugging

Enable YouCompleteMe logging by putting this in vimrc:
let g:ycm_server_keep_logfiles = 1
let g:ycm_server_log_level = 'debug'
Then open vim and enter :YcmDebugInfo command. It should print the log file paths:
Printing YouCompleteMe debug information...
-- Server crashed, no debug info from server
-- Server running at: http://127.0.0.1:50740
-- Server process ID: 9217
-- Server logfiles:
--   /tmp/ycm_temp/server_50740_stdout.log
--   /tmp/ycm_temp/server_50740_stderr.log

2015年2月9日 星期一

cross-compile Qt5 on RaspberryPi


I got lots of problems as following,
  • Fail => sudo apt-get install ia32-libs 
A:  sudo dpkg --add-architecture i386
  sudo apt-get update 
  sudo apt-get install ia32-libs
  • complier error
  • make[4]: *** [.obj/release-shared/qeglfshooks_pi.o] Error 1
  • make[4]: Leaving directory `/home/nathan/opt/qt5/qtbase/src/plugins/platforms/eglfs'
  • make[3]: *** [sub-eglfs-make_first] Error 2
  • make[3]: Leaving directory `/home/nathan/opt/qt5/qtbase/src/plugins/platforms'
  • make[2]: *** [sub-platforms-make_first] Error 2
  • make[2]: Leaving directory `/home/nathan/opt/qt5/qtbase/src/plugins'
  • make[1]: *** [sub-plugins-make_first] Error 2
  • make[1]: Leaving directory `/home/nathan/opt/qt5/qtbase/src'
  • make: *** [sub-src-make_first] Error 
A: http://qt-project.org/forums/viewthread/33587
Ok Solution:
type in root$ sudo find ~/opt -type f -exec grep -H ‘vc_dispmanx_element_change_attributes’ {} \;
Password: your_root_password
then it should find 2 locations
/Users/your_user_name/opt/qt5/qtbase/mkspecs/devices/linux-rasp-pi-g++/qeglfshooks_pi.cpp
and
/Users/your_user_name/opt/rasp-pi-rootfs/opt/vc/include/interface/vmcs_host/vc_dispmanx.h
First edit prototype of function in vc_dispmanx.h from:
VCHPRE_ int VCHPOST_ vc_dispmanx_element_change_attributes(DISPMANX_UPDATE_HANDLE_T 
update, DISPMANX_ELEMENT_HANDLE_T element, uint32_t change_flags, int32_t layer, uint8_t opacity, 
const VC_RECT_T *dest_rect, const VC_RECT_T *src_rect,
DISPMANX_RESOURCE_HANDLE_T mask, VC_IMAGE_TRANSFORM_T transform );
To:
VCHPRE_ int VCHPOST_ vc_dispmanx_element_change_attributes(DISPMANX_UPDATE_HANDLE_T 
update, DISPMANX_ELEMENT_HANDLE_T element, uint32_t change_flags, int32_t layer, uint8_t opacity, 
const VC_RECT_T *dest_rect, const VC_RECT_T *src_rect, DISPMANX_RESOURCE_HANDLE_T 
mask, DISPMANX_TRANSFORM_T transform );
Then Edit
/Users/your_user_name/opt/qt5/qtbase/mkspecs/devices/linux-rasp-pi-g++/qeglfshooks_pi.cpp
go to function moveDispmanxLayer and make sure it looks like this:
static void moveDispmanxLayer(EGLNativeWindowType window, const QPoint &pos)
   EGL_DISPMANX_WINDOW_T *eglWindow = static_cast<EGL_DISPMANX_WINDOW_T *>(window); 
   QSize size(eglWindow->width, eglWindow->height);
   VC_RECT_T dst_rect; 
   dst_rect.x = pos.x(); 
   dst_rect.y = pos.y(); 
   dst_rect.width = size.width(); 
   dst_rect.height = size.height(); 
   VC_RECT_T src_rect; 
   src_rect.x = 0; 
   src_rect.y = 0; 
   src_rect.width = size.width() << 16; 
   src_rect.height = size.height() << 16; 
   DISPMANX_UPDATE_HANDLE_T dispman_update = vc_dispmanx_update_start(0);
   vc_dispmanx_element_change_attributes(dispman_update, 
                                                                      eglWindow->element,
                                                                      ELEMENT_CHANGE_DEST_RECT /*change_flags*/, 
                                                                      0,
                                                                      0, 
                                                                      &dst_rect, NULL
                                                                      0, 
                                                                      (DISPMANX_TRANSFORM_T)0); 
   vc_dispmanx_update_submit_sync(dispman_update); 
}
Then recompile
  • install qt5 library at pi
A: http://ricky-tee.blogspot.tw/2013/03/running-qt5-cinematic-experience.html
http://twolife.be/raspbian/
we have to modify twolife's Raspbian repository
deb http://twolife.be/raspbian/ wheezy main backports
deb-src http://twolife.be/raspbian/ wheezy main backports
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key 2578B775
  • could not find xcb plugin

A:sudo apt get install libx11-xcb-dev
  • bash: /home/pi/qaz: No such file or directory
Application finished with exit code 127.
A: http://qt-project.org/doc/qtcreator-2.8/creator-deployment-maemo.html
But I found I can't succeed when setting as following at *.pro,
target.path = /home/pi
INSTALLS += target

When I create another folder at /home/pi, I can deploy and run it successfully 

target.path = /home/pi/test
INSTALLS += target
  • The selected build of GDB does not support Python scripting.It cannot be used in Qt Creator.
A:  sudo apt-get install gdb-multiarch
https://jeanleflambeur.wordpress.com/2014/09/28/remote-debugging-on-the-raspberry-pi-from-qtcreator/
http://sourceware.org/gdb/papers/multi-arch/whatis.html

DEBIAN 7 - Can't exec "locale": No such file or directory at /usr/share/perl5/Debconf/Encoding.pm

from:http://samonesoznanie.blogspot.tw/2014/09/debian-7-cant-exec-locale-no-such-file.html


DEBIAN 7
cause
Can't exec "locale": No such file or directory at /usr/share/perl5/Debconf/Encoding.pm line 16.
Use of uninitialized value $Debconf::Encoding::charmap in scalar chomp at /usr/share/perl5/Debconf/Encoding.pm line 17.
dpkg: `ldconfig' not found on PATH.
dpkg: 1 expected program(s) not found on PATH.
NB: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin.
E: Sub-process /usr/bin/dpkg returned an error code (2)

for fix

Download and extract the package

apt-get download libc-bin
dpkg -x libc-bin*.deb unpackdir/


Copy the file to your system

sudo cp unpackdir/sbin/ldconfig /sbin/

Make sure the package and package system is in a good state.

sudo apt-get install --reinstall libc-bin
sudo apt-get install -f

Futher errors after this indicates something else is wrong.