Youcompleteme: How to install YCM in archlinux correctly?

Created on 30 Aug 2013  路  25Comments  路  Source: ycm-core/YouCompleteMe

Firstly, there is no package called python-dev in archlinux.

Second, I do not understand what does it means below:

Download the latest version of libclang. Clang is an open-source compiler that can compile C/C++/Objective-C/Objective-C++. The libclang library it provides is used to power the YCM semantic completion engine for those languages. YCM is designed to work with libclang version 3.3 or higher, but can in theory work with 3.2 as well.

You can use the system libclang only if you are sure it is version 3.3 or higher, otherwise don't. Even if it is, I recommend using the official binaries from llvm.org if at all possible. Make sure you download the correct archive file for your OS.

Need I install libclang? Or clang? Or llvm? Forgive my poor English.

Thirdly, ./install.sh does not work, it told me file DOWNLOAD HASH mismatch, but I can not find where ./clang+llvm-3.3-Ubuntu-13.04-x86_64-linux-gnu.tar.bz2 is!

Most helpful comment

I don't think @Valloric will leave this issue here, since is not a real issue. The appropriate place for this thing is ycm-user. Anyway if you use ./install.sh --clang-completer it tries to download a precompiled llvm from the site but there is no precompiled version for Arch and I don't know if the Ubuntu version works in Arch since lately they are moving things around. I think that if you do pacman -S clang and then use ./install.sh --clang-completer --system-libclang should work but I don't guarantee that it will work neither that it's the best approach (I don't use Arch at the moment so It's just my thoughts).

All 25 comments

I don't think @Valloric will leave this issue here, since is not a real issue. The appropriate place for this thing is ycm-user. Anyway if you use ./install.sh --clang-completer it tries to download a precompiled llvm from the site but there is no precompiled version for Arch and I don't know if the Ubuntu version works in Arch since lately they are moving things around. I think that if you do pacman -S clang and then use ./install.sh --clang-completer --system-libclang should work but I don't guarantee that it will work neither that it's the best approach (I don't use Arch at the moment so It's just my thoughts).

Agreed with @vheon, closing issue.

./install.sh --clang-completer --system-libclang is work for arch linux thanks a lot

I can install YCM in Arch Linux now.

  1. There is not any package called python-dev, but it does not matter, just ignore it please.
  2. Except executing ./install.sh --clang-completer --system-libclang immediatly, you can install the clang package from office repository and execute ./install.sh --clang-completer --system-libclang after compiling too.

Wouldn't it make sense to include this information in the README? It's very inconvenient to have to search for this.

Yes, after I typed ./install.sh --clang-completer --system-libclang, it worked.

The file DOWNLOAD HASH mismatch doesn't matter in my case.

That helps me a lot, too. Thanks every one.

As suggested, I think this information should be included in the README.

Yeah, that is a bit confusing. There are no binaries for us Arch users and so you either build the binary for it from source or - yeah, much simpler - pacman it. Now, as for the python-dev thing, the reason you can ignore it, I just found out the other day, is that a lot of Arch's packages - Python in particular - don't use separate branches for dev and regular; instead, they're bundled, so that makes things easier. Seems that it's just assumed Archers will somehow just KNOW, haha. Ah well, great way for a noob like me to learn, I suppose!

There are packages available in the Arch User Repository
https://aur.archlinux.org/packages/vim-youcompleteme-git/

This worked for me:

$ which python2 # verify you have python2 installed
$ sudo pacman -S python2 # install python2 if not available
$ sudo pacman -S cmake
$ cd /path/to/YCM 
$ python2 ./install.py --clang-completer

Doesn't work anymore, you can use downloaded clang (missing libraries) nor system one (too old). You need to compile own from svn atm.

Doesn't work to use the Clang files taken from LLVM (cfe-3.8.0.src); Not sure which files to actually download and build. The Arch repo is down too.

Just use this AUR package https://aur.archlinux.org/packages/clang-svn/, build it and install llvm-svn, llvm-libs-svn and clang-svn. After that build YCM.

If you don't want to build the stuff yourself, you can use my private repository:

[wolfsden]
Server = https://repo.wolfsden.cz

Signing key fingerprint:

2883 D422 B6DF F64C 98B9  974C E252 EDCA 52C5 A16E

After that it's just a question of sudo pacman -Syyu {llvm{-libs,},clang}-svn && ./install.py --clang-completer --system-libclang.

Building with ./install.py --clang-completer --system-libclang works for Cygwin as well. I've been stuck until I found this thread.

I know this issue is closed, but I managed to compile the ycm_core library with the libclang semantic completion under Arch linux with clang as packaged by arch as follows (reporting here as this issue is a top hit for google):
pacman -S clang
cmake -G "Unix Makefiles" -DPATH_TO_LLVM_ROOT=/bin -DEXTERNAL_LIBCLANG_PATH=/usr/lib/libclang.so.3.9 . ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp
Output is as follows:
-- The C compiler identification is GNU 6.3.1
-- The CXX compiler identification is GNU 6.3.1
-- Check for working C compiler: /bin/cc
-- Check for working C compiler: /bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /bin/c++
-- Check for working CXX compiler: /bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonLibs: /usr/lib64/libpython2.7.so (found suitable version "2.7.13", minimum required is "2.6")
Using libclang to provide semantic completion for C/C++/ObjC
Using external libclang: /usr/lib/libclang.so.3.9
-- Found PythonInterp: /bin/python2.7 (found version "2.7.13")
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /home/xxx/build/ycm_build

Note that I'm using vundle.

/install.sh --clang-completer --system-libclang worked on Manjaro KDE 17.0 haha

After installing clang-svn, llvm-svn (version 5.0.0)
./install.py --clang-completer --system-libclang

I get:
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Check for working C compiler: /usr/bin/cc
CMake Error at /usr/share/cmake-3.8/Modules/CMakeTestCCompiler.cmake:37 (try_compile):
Unknown extension ".c" for file

/tmp/ycm_build_4976ptn7/CMakeFiles/CMakeTmp/testCCompiler.c
try_compile() works only for enabled languages. Currently these are:

C CXX
See project() command to enable other languages.
Call Stack (most recent call first):
CMakeLists.txt:26 (project)

-- Check for working C compiler: /usr/bin/cc -- broken
CMake Error at /usr/share/cmake-3.8/Modules/CMakeTestCCompiler.cmake:51 (message):
The C compiler "/usr/bin/cc" is not able to compile a simple test program.

It fails with the following output:

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:26 (project)

-- Configuring incomplete, errors occurred!
See also "/tmp/ycm_build_4976ptn7/CMakeFiles/CMakeOutput.log".
See also "/tmp/ycm_build_4976ptn7/CMakeFiles/CMakeError.log".
ERROR: the build failed.

NOTE: it is highly unlikely that this is a bug but rather
that this is a problem with the configuration of your system
or a missing dependency. Please carefully read CONTRIBUTING.md
and if you're sure that it is a bug, please raise an issue on the
issue tracker, including the entire output of this script
and the invocation line used to run it.

It seems like the package for clang-svn is currently broken. Will try a build tomorrow again.

I have found a solution. Download Clang / LLVM Arch Linux binaries from http://releases.llvm.org/download.html. Say it is downloaded to ~/Downloads,

cd ~/Downloads
tar xf clang+llvm-4.0.0-aarch64-linux-gnu.tar.xz
sudo mkdir /usr/share/ycm-clang-llvm
sudo mv clang+llvm-4.0.0-aarch64-linux-gnu/* /usr/share/ycm-clang-llvm/

Now you need to find the CMakeLists.txt file for ycm_core. Go to the folder where your vim / neovim package manager downloaded YouCompleteMe. In my case, it is
cd ~/.config/nvim/bundle/YouCompleteMe/
The cmake file is located in
/path/to/YouCompleteMe/third_party/ycmd/cpp/ycm/CMakeLists.txt

You will notice the following lines at the top of this file:

Change OFF to ON on lines 23 and 24 ( USE_CLANG_COMPLETER and USE_SYSTEM_LIBCLANG ).

Then on line 25, for 'PATH_TO_LLVM_ROOT' insert the path to where you coppied the clang / llvm binaries. In my case the line reads
set( PATH_TO_LLVM_ROOT "/usr/share/ycm-clang-llvm" CACHE PATH "Path to ... " )

And finally, set the path to libclang on line 26. In my case it reads
set( EXTERNAL_LIBCLANG_PATH "/usr/share/ycm-clang-llvm/lib/libclang.so" CACHE PATH "Path to ... " )

Finally, we can build and install YouCompleteMe by running ./install.py --clang-completer in the neovim / vim plugin directory, where it was downloaded.

I am very happy to finally have this tool up and running. Reply here if anyone needs help.

Thanks @jmnel - your method worked perfectly for me. Now it works (mostly).

For some reason jedi is not working correctly. Originally, before trying to install ycm I was using the 'davidhalter/jedi-vim'. Something that plugin did that I really liked was if I typed "from os" it would automatically type "import " followed by the list of available options to choose from. For some reason this aspect of ycm doesn't work for me, and ycm is using jedi (is that right?). So not sure what's up there.

However, I have the jedi plugin and ycm both running and that works fine, although it would be nice to skip the jedi-plugin if that funcitionally exists in ycm and can be accessed...

Almost works for me.. MacOS get hung up on this last bit.

/Users/marcus/.vim/bundle/youcompleteme/third_party/ycmd/cpp/ycm/ClangCompleter/ClangUtils.h:21:10: fatal error: 'clang-c/Index.h' file not found
#include <clang-c/Index.h>
         ^~~~~~~~~~~~~~~~~
1 error generated.
[57/76] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/winstances.cpp.o
ninja: build stopped: subcommand failed.
ERROR: the build failed.

NOTE: it is *highly* unlikely that this is a bug but rather
that this is a problem with the configuration of your system
or a missing dependency. Please carefully read CONTRIBUTING.md
and if you're sure that it is a bug, please raise an issue on the
issue tracker, including the entire output of this script
and the invocation line used to run it.

./install.py --clang-completer --system-libclang
This worked perfecty for me in arch.
Thanks guys

Hi All, maybe this is not the right approach to share how I fixed my problem but I was having the following problem: after installing YouCompletMe, with Plug, in Arch, and without calling the install script, it sort of worked out of the box, at least for a simple Python script I've been testing the plugin. I started typing, for example, os.getcw and the list of options will display but it will not filter while typing. After running ./install.sh --clang-completer --system-libclangthe filter works.

4.17.14-arch1-1-ARCH here.

./install.py --clang-completer --system-libclang didn't work for me, it threw an error:
[13/76] Building CXX object BoostParts...bs/python/src/converter/registry.cpp.o ninja: build stopped: subcommand failed. ERROR: the build failed.

However./install.sh --clang-completer --system-libclang worked. I needed to have clang installed also.

Locking the issue as installing YCM through install.sh is deprecated and its use should not be encouraged (it's only a wrapper of install.py so there is no reason for install.sh to work better than install.py).

Was this page helpful?
0 / 5 - 0 ratings