The entire process of installing the YouCompleteMe plug-in CentOS,

Source: Internet
Author: User
Tags automake intel core 2 duo

The entire process of installing the YouCompleteMe plug-in CentOS,

After several twists and turns throughout the process, I searched a lot of online blogs. Refer to the following:

Http://990487026.blog.51cto.com/10133282/1905427

Http://blog.csdn.net/bboxhe/article/details/46849167

I have tried to install CentOS6.9 and CentOS7. The installation steps are as follows: (The write is rough)

1,

Win10 x64: connect to the network through a wireless network adapter:
IP: 192.168.1.106
Netmast: 255.255.255.0
Gateway: 192.168.1.1
DNS: 120.196.165.24
211.136.192.6
In vmware, the network uses the bridging mode. Select copy physical connection to the network. Remove all other wireless network adapters.

Centos6.9-x64
IP: 192.168.1.6/255.255.255.0/192.168.1.1 same network segment

For CentOS7-x86, pay attention to adding NICs, and pay attention to network settings, GATEWAY
1) disable the VM. VMare workstation. Add ethernet0.virtualDev = "e1000" to. vmx in the installation directory of the corresponding VM"
2) restart, ip addr-> cp/etc/sysconfig/network-scripts/ifg-lo/ect/sysconfig/network-scripts/ifg-ens33

Check whether network settings are correct

Ping 192.168.1.106
Ping 192.168.1.1
Ping www.baidu.com // pass

2. Add a hard disk to the VM to learn 20 gb scsi.
Reboot
Fdisk/dev/sdb
Mkfs. ext4/dev/sdb1
Echo "/dev/sdb1/learn ext4defaults 0 0">/etc/fstab

3. Add User kk4728
Useradd kk4728
Passwd kk4728
Add a sudo user,/etc/sudoers add kk4728 ALL = (ALL) ALL
Modify learning disk Permissions
Chown-R kk4728/learn
Chgrp-R kk4728/learn
Chmod-R 775/learn

4. Set Environment Variables
Vi ~ /. Add bash_profile
PATH = $ PATH :.
Allows the system to find the current Executable File

5. Synchronization time
Sudo yum install ntp
Sudo ntpdate time.nist.gov

6. Install Dependencies
Sudo yum install-y gcc-c ++ gdb ctags ncurses-devel libevent-devel git automake xz zlib-devel cmake libxml2 libxslt-devel kernel-devel wget openssl-devel

Gcc4.8.5 is installed by default in centos 7.
Glibc-2.17
Python-1, 2.7.5

7. Upgrade glibc
Wget http://ftp.gnu.org/pub/gnu/glibc/glibc-2.17.tar.xz
Xz-d glibc-2.17.tar.xz
Tar-xvf glibc-2.17.tar
Cd glibc-2.17
Mkdir build
Cd build
../Configure -- prefix =/usr -- disable-profile -- enable-add-ons -- with-headers =/usr/include -- with-binutils =/usr/bin
Sudo make & make install

An error occurred while installing libc. a write permission failed. Separate installation
Sudo make
Sudo make install

Verification:
X64: strings/lib64/libc. so.6 | grep GLIBC
X86: strings/lib/libc. so.6 | grep GLIBC

If verification fails. It should be the path that libc. so.6 (soft connection) points to is not correct. Here we will not upgrade, as needed later. The file pointed to by libc. so.6 is too critical;
Improper use may cause the system to fail to log on or restart. Some command segments are incorrect !!!
Find/-name "libc. so.6"
Cp/usr/glibc-2.17/lib/libc-2.17.so/lib/libc-2.17.so
Rm-rf/lib/libc. so.6
If an exception occurs later, the main reason is that libc. so.6 is the core link library of the system. An error occurred while deleting most commands!
You need to re-create the link, but ln also needs libc. so.6. You need to manually add the LD_PRELOAD path
[Root # localhost ~ ] LD_PRELOAD =/lib/libc-2.17.so ln-s/lib/libc-2.17.so/lib/libc. so.6
Verify again OK

8. Install Python2.7.13 (CentOS7-> Python 2.7.5)
Wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tar.xz
Xz-d Python-2.7.13.tar.xz
Tar-xvf Python-2.7.13.tar
Cd Python-2.7.13
./Configure -- enable-shared
Sudo make
Sudo make install
/Usr/local/bin/python2.7-V
Error Message

Switch permissions back to root
Vi/etc/ld. so. conf Add/usr/local/lib to save

/Sbin/ldconfig
/Sbin/ldconfig-v
Mv/usr/bin/python. bak
Ln-s/usr/local/bin/python2.7/usr/bin/python
Vi/usr/bin/yum
Change #! /Usr/bin/python2.6

Switch the permission back to kk4728

8. Component Installation
Install setuptools
Wget https://bootstrap.pypa.io/ez_setup.py-O-| sudo python
Pip Installation
Wget-no-check-certificate https://github.com/pypa/pip/archive/7.1.0.tar.gz
Tar zvxf 7.1.0.tar.gz # decompress the file
Cd pip-7.1.0
Sudo python setup. py install

CentOS7-x86
Wget-no-check-certificate https://github.com/pypa/pip/archive/9.0.0.tar.gz
Tar zvxf 9.0.0.tar.gz # decompress the file
Cd pip-9.0.0
Sudo python setup. py install

Change permission to root
Pip install requests
Pip install lxml
Pip install cssselect

Install flake8
Pip install flake8

Change permission back to kk4728

9. Upgrade vim8.0
Wget https://github.com/vim/vim/archive/master.zip

Change permission to root
Yum install unzip
Unzip master.zip
Cd vim-master
Cd src/
./Configure -- with-features = huge -- enable-python3interp -- enable-pythoninterp = yes -- enable-rubyinterp -- enable-luainterp -- enable-multibyte -- enable-csures
// -- Prefix =/usr/local/vim
// -- Enable-perlinterp
Make
Sudo make install

Change permission back to kk4728

Vim -- version
Verify whether vim -- version | grep python is installed


10 vimrc plug-in Installation
Git clone https://github.com/VundleVim/Vundle.vim.git ~ /. Vim/bundle/Vundle. vim
Add alias vi = vim to vim. bash_profile
Mv ~ /. Vimrc ~ /. Vimrc. bak
Vundle plugin management path :~ /. Vim/bundle/Vundle. vim

. Vimrc temporary Configuration
"""""""""""""""""""""""""""""""""""""""" """""
Filetype off
Set rtp + = ~ /. Vim/bundle/Vundle. vim
Call vundle # begin ()
Plugin 'vundlevim/Vundle. vim'
"My Plugins here:

Plugin 'bling/vim-airline'
Plugin 'scrooloose/nerdtree'
Plugin 'kien/ctrlp. vim'
Plugin 'taglist. vim'
Plugin 'valloric/youcompleteme'
Plugin 'winmanager'
Let g: winManagerWindowLayout = "NERDTree | TagList"
Let g: NERDTree_title = "[NERDTree]"
Function! NERDTree_Start ()
Exec 'nerdtree'
Endfunction
Function! NERDTree_IsValid ()
Return 1
Endfunction

"All of your Plugins must be added before the following line
Call vundle # end () "required
Filetype plugin indent on "required


// Installation takes 10 minutes
In vim: PluginInstall
Cmd: vim + PluginInstall + qall

11 it takes too long to update gcc to 6.3.0, and the permission issue may be interrupted. Use root for installation.
Wget http://ftp.gnu.org/gnu/gcc/gcc-6.3.0/gcc-6.3.0.tar.bz2
Tar-jxvf gcc-6.3.0.tar.bz2
Cd gcc-6.3.0
./Contrib/download_prerequisites
Cd ..
Mkdir gcc-build-6.3.0
Cd gcc-build-6.3.0
../Gcc-6.3.0/configure -- enable-checking = release -- enable-packages ages = c, c ++ -- disable-multilib

######################################## ##############
Note: remove the previous gcc version as needed.
Yum remove gcc
Yum remove g ++
Yum remove gcc-c ++


/Lib/cpp fails sanity check solution

When running./configure in some software, an error is reported. The error prompt is:
Configure: error: C ++ preprocessor "/lib/cpp" sanity check
Check See 'config. log' for more details
######################################## ##############

Make-j7
Make install

Processing libstdc ++. so.6 with different x86 x64 processors and different find/-name "libstdc ++ .*"
X64: cp libstdc ++. so.6.0.19/usr/lib64/libstdc ++. so.6.0.19
Ln-sf/usr/lib64/libstdc ++. so.6.0.19/usr/lib64/libstdc ++. so.6
X32: cp/usr/local/lib/libstdc ++. so.6.0.22/usr/lib/libstdc ++. so.6.0.22
Ln-sf/usr/lib/libstdc ++. so.6.0.22/usr/lib/libstdc ++. so.6
Enter strings/usr/lib64/libstdc ++. so.6 | grep GLIBCXX.
Strings/usr/lib/libstdc ++. so.6 | grep GLIBCXX
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_3.4.20
GLIBCXX_3.4.21
GLIBCXX_3.4.22
GLIBCXX_FORCE_NEW
GLIBCXX_DEBUG_MESSAGE_LENGTH


12 install clang: here we will not re-compile it. Download the updated version directly.

I686: a subset of i386. The supported cpu starts from Pentium 2 (686). The previous model is not supported.
I386: Applicable to All 32-bit intel and AMD CPUs and 32-bit cpu via X86 architecture.
Intel Platform includes 8086,80286, 80386,80133, Pentium series (1.2.3.4), sai Yang series, Pentium D series and centrino P-M, core duo and so on.
X86_64: 64-bit cpu with X86 architecture, including intel Core 2 Duo, Centrino Core 2 Duo, and Xeon, AMD Athlon64/x2, Sempron64/x2, and Duron64.

Wget http://llvm.org/releases/4.0.1/clang+llvm-4.0.1-x86_64-linux-gnu-Fedora-25.tar.xz
Xz-d clang+llvm-4.0.1-x86_64-linux-gnu-Fedora-25.tar. xz
Tar xvf clang+llvm-4.0.1-x86_64-linux-gnu-Fedora-25.tar
Cd clang + llvm-4.0.1-x86_64-linux-gnu-Fedora-25

X64:
Wget http://llvm.org/releases/3.5.1/clang+llvm-3.5.1-x86_64-fedora20.tar.xz
Xz-d clangw.llvm-3.5.1-x86_64-fedora{tar. xz
Tar xvf clang+llvm-3.5.1-x86_64-fedora20.tar
Cd clang + llvm-3.5.1-x86_64-fedora20
X86:
Wget http://llvm.org/releases/3.5.1/clang+llvm-3.5.1-i686-fedora20.tar.xz
Xz-d clangw.llvm-3.5.1-i686-fedora20.tar. xz
Tar xvf clang+llvm-3.5.1-i686-fedora20.tar
Cd clang + llvm-3.5.1-i686-fedora20

Either of the above two methods should be acceptable. It is all compiled. Here I use 3.5.1 conservatively. File smaller than 100 M 4.0.1 700 M

Root permission
Mkdir/usr/clang_351
Cp-r/learn/clang + llvm-3.5.1-x86_64-fedora2/bin/usr/clang_351
Cp-r/learn/clang + llvm-3.5.1-x86_64-fedora2/lib/usr/clang_351; libclang. so in this directory, You need to compile ycm later
Cp-r/learn/clang + llvm-3.5.1-x86_64-fedora2/lib/usr/clang_351; Generation ycm_core needs

Kk4728 permission:
Vi ~ /. Add bash_profile
PATH =/usr/clang_351/bin: $ PATH
Export PATH

Source ~ /. Bash_profile update

13 install YouCompleteMe

Cp/usr/clang_3_5/lib/libclang. so ~ /. Vim/bundle/YouCompleteMe/python/libclang. so

Cd ~
Mkdir build
Cd build
Cmake-G "Unix Makefiles"-DPATH_TO_LLVM_ROOT =/usr/clang_351 /.~ /. Vim/bundle/YouCompleteMe/third_party/ycmd/cpp
Cmake-G "Unix Makefiles ".~ /. Vim/bundle/YouCompleteMe/third_party/ycmd/cpp
Note: The Compiler does not support C ++ 11.
Your C ++ compiler does NOT fully support C ++ 11.

So find/usr-name "gcc" finds that the/usr/bin/gcc version is still 4.4.7, and back up/usr/bin/gcc and try again.
Since previous 4.4.7 versions were not removed when installing the gcc-6.3.0
So sudo yum remove gcc
Sudo yum remove g ++
Sudo yum remove gcc-c ++

Cp/usr/local/bin/gcc/usr/bin/gcc
Delete the intermediate file rm-rf * that failed to be installed in the build directory *

// Note that ,~ /Ycm_temp/llvm_root_dir contains the content extracted from the compressed package downloaded in step 1 (including include, bin, and other files ).
// An error occurs in the middle. If clang-c/Index. h cannot be found, it means the PATH_TO_LLVM_ROOT path is set incorrectly!

Rm-rf CMakeCache.txt // prevents problems caused by Midway compilation exceptions
Make ycm_core
Compilation problems: it may be related to the compiler version gcc6.3.0, which may be too new.-> later, it is very likely that clang3.5.1 may be replaced by 4.0.1.
--> Make ycm_core again
Cp/usr/clang_351/lib/libclang. so ~ /. Vim/bundle/YouCompleteMe/python/libclang. so it seems that there will be no error

[72%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/TranslationUnit. cpp. o
/Home/kk4728 /. vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/ClangCompleter/TranslationUnit. cpp in the function 'unsigned int YouCompleteMe :{ anonymous }:: EditingOptions:
/Home/kk4728 /. vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/ClangCompleter/TranslationUnit. cpp: 43: 10: Error: 'cxtranslationunit _ createpreambleonfirstparse' not declared in this scope
CXTranslationUnit_CreatePreambleOnFirstParse |
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~
/Home/kk4728 /. vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/ClangCompleter/TranslationUnit. cpp: 44: 10: Error: 'cxtranslationunit _ KeepGoing 'has not been declared in this scope
CXTranslationUnit_KeepGoing |
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
/Home/kk4728 /. vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/ClangCompleter/TranslationUnit. cpp in the constructor 'youcompleteme: TranslationUnit (const string &, const std: vector <UnsavedFile> &, const std: vector <std :__ cxx11 :: in basic_string <char >>&, CXIndex:
/Home/kk4728 /. vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/ClangCompleter/TranslationUnit. cpp: 105: 51: Error: 'clang _ parseTranslationUnit2FullArgv 'has not been declared in this scope
& Clang_translation_unit _);
^
Make [3]: *** [ycm/CMakeFiles/ycm_core.dir/ClangCompleter/TranslationUnit. cpp. o] Error 1
Make [2]: *** [ycm/CMakeFiles/ycm_core.dir/all] Error 2
Make [1]: *** [ycm/CMakeFiles/ycm_core.dir/rule] Error 2




Make ycm_support_libs x64 failed!

// Temporarily cross make ycm_make and make ycm_support_libs
Directly go to the YCM installation directory
./Install. sh -- clang-completer
It runs normally in x64, And the clang.5.0 library is abnormal in x86, so it cannot be automatically downloaded.

14 vimrc
Let g: ycm_global_ycm_extra_conf = '~ /. Vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/. ycm_extra_conf.py'
Check Configuration
Echo | clang-std = c ++ 11-stdlib = libc ++-v-E-x c ++-

The c library is added to ycm_extra_conf.py.
'-Isystem ',
'/Usr/include ',
'-Isystem ',
'/Usr/local/include ',
'-Isystem ',
'/Usr/clang_3_5/bin/../include/c ++/v1 ',
'-Isystem ',
'/Usr/clang_3_5/bin/../lib/clang/3.5.1/include ',

Install man
Yum install man
Yum install man-pages.noarch man-pages-overrides.noarch

Copy the man under en and use it together first:
Cp/usr/share/locale/en/LC_MESSAGES/man/usr/share/locale/zh/LC_MESSAGES/

The entire vimrc configuration is as follows:
"""""""""""""""""""""""""""""""""""""""" """
Filetype off
Set rtp + = ~ /. Vim/bundle/Vundle. vim
Call vundle # begin ()
Plugin 'gmarik/Vundle. vim'
"My Plugins here :"

Plugin 'bling/vim-airline'
"Let g: airline_powerline_fonts = 1"
Set laststatus = 2
Set t_co= 256

Plugin 'scrooloose/nerdtree'
Let mapleader = ","
Nmap <silent> <leader> ne: NERDTree <CR>
Nmap <silent> <leader> nc: NERDTreeClose <CR>
"Map <silent> <F3>: NERDTreeToggle <CR>"
Plugin 'kien/ctrlp. vim'
"Plugin 'altercation/vim-colors-solarized '"
Let g: ctrlp_custom_ignore = {
\ 'Dir': 'events/bundle/* \ | events/cache/* \ | public \ | spec ',
\ 'File': '\ v \. (exe | so | dll | swp | log | jpg | png | json) $ ',
\}
Syntax enable
Set background = dark
Let g: solarized_termcolors = 256
"Colorscheme flatcolor

Plugin 'taglist. vim'
Let Tlist_Show_One_File = 1 "the tag of multiple files is not displayed at the same time. Only the tag of the current file is displayed"
Let Tlist_Exit_OnlyWindow = 1 "Exit vim if the taglist window is the last window"
"Let Tlist_Use_Right_Window = 1" "display the taglist window in the right window"
"Nmap <F4>: TlistToggle <cr>"

Plugin 'valloric/youcompleteme'
Plugin 'rdnetto/YCM-generator'
Let g: ycm_global_ycm_extra_conf = '~ /. Vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/. ycm_extra_conf.py'
Let g: ycm_confirm_extra_conf = 0
Nnoremap <leader> gl: YcmCompleter GoToDeclaration <CR>
Nnoremap <leader> gf: YcmCompleter GoToDefinition <CR>
Nnoremap <leader> gg: YcmCompleter GoToDefinitionElseDeclaration <CR>
Inoremap <c-o> <c-x> <c-o>
Let g: ycm_semantic_triggers = {
\ 'C': ['->', '', '.','', '(', '[', '&'],
\ 'Cpp, objcpp ': ['-> ','. ',', '(', '[', '&', ':'],
\ 'Perl ': ['-> ',': ', ''],
\ 'Php': ['->', ':', '.'],
\ 'Cs, java, javascript, d, vim, python, perl6, scala, vb, elixir, go ': ['. '],
\ 'Ruby': ['.', ':'],
\ 'Lua': ['.', ':']
\}

Plugin 'winmanager'
Let g: winManagerWindowLayout = "NERDTree | TagList"
Let g: NERDTree_title = "[NERDTree]"
Function! NERDTree_Start ()
Exec 'nerdtree'
Endfunction
Function! NERDTree_IsValid ()
Return 1
Endfunction
Nmap <silent> <F2>: if IsWinManagerVisible () <BAR> WMToggle <CR> <BAR> else <BAR> WMToggle <CR>: q <CR> endif <CR>

"All of your Plugins must be added before the following line"
Call vundle # end () "required"
Filetype plugin indent on "required"

Set nu "show line number"
Set ts = 4 "tab length is 4"
Autocmd FileType * setlocal formatoptions-= c formatoptions-= r formatoptions-= o
Set list listchars = tab: → \, trail :·
Set hlsearch incsearch smartcase ignorecase
Autocmd BufNewFile, BufRead *. json set filetype = javascript

  
Nmap mm: call ChangeMouse () <cr>
Function ChangeMouse ()
If & mouse = ""
Set mouse-=
Else
Let & mouse = ""
Endif
Endfunction

Set nocompatible
Set autoindent
Set backspace = indent, eol, start

Set fencs = UTF-8, ucs-bom, shift-jis, gb18030, gbk, gb2312, cp936
Set termencoding = UTF-8
Set encoding = UTF-8
Set fileencodings = ucs-bom, UTF-8, cp936
Set fileencoding = UTF-8
  
Install TMUX
Yum install automake
Yum install libevent-devel ncurses-devel

TMUX installation error: 'evbuffer _ EOL_LF 'is not declared ---- No attempt !!!!!!!!!!

The reason is that the libevent version used is too low, and the libevent> = 2.0.10-stable is required.

Wget-no-check-certificate https://sourceforge.net/projects/levent/files/libevent/libevent-2.0/libevent-2.0.22-stable.tar.gz
Follow the https://blog.linuxeye.com/323.html
Successfully installed


15 cleanup
After clang is compiled, you do not need to install it. Just to get libclang. so has been copied to/usr/clang_351
Python2.7 is also temporary. Third-party libraries do not need to be installed as clang dependencies.
Gcc can also be temporary, used to compile clang, and libstdc ++. so can be obtained.

After cleaning, the space is not reduced much !!!!!!!!!!!!!!!!!!!



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.