Problems Building YCM on 64-bit Windows 7 using MSVC 14

118 views
Skip to first unread message

Connor Griffith

unread,
Nov 20, 2015, 12:17:11 AM11/20/15
to ycm-users
Hi all,

I'm attempting to build YCM here as the subject says. I've tried both the simple install script and full directions but ran into problems both ways. I was hoping to get some insight into my problems. I must admit my knowledge of ycm internal structure, cmake, and msvc is all pretty primitive, so I'm guessing I'm missing something rather basic here...

Issue 1) Can't find clang-c/Index.h with install.py

Running "install.py --clang-completer" runs into problems when it can't find the header "clang-c/Index.h". I can see the header under YouCompleteMe\third_party\ycmd\cpp\llvm\include\clang-c. I noticed the line  

set( CLANG_INCLUDES_DIR "${PATH_TO_LLVM_ROOT}/include" )

so my guess is that cmake isn't getting the correct path to LLVM_ROOT, even though its controlling the extraction with the .exe.

I wasn't sure how to resolve the above issue, so I moved onto trying the full-build procedure.

Issue 2) Can't find python27.lib

I created a build directory and performed the prescribed cmake gen/config commands. This time however, I was using a libclang that I downloaded and installed to C:\Program Files\LLVM. I pointed the PATH_TO_LLVM_ROOT option to this directory.

When I ran the build step, it failed while trying to link the BoostParts.lib, saying it couldn't find python27.lib. I thought this odd, as the gen/config messages from cmake seemed to indicate that it was aware of the location of python. However, I resolved this issue by setting the /LIBPATH option to the linker to include the path of the Python library.

I'd be interested to know why I had to do this and why cmake wasn't able to set the library include path itself.

Issue 3) Unresolved externals boost::tss_cleanup_implemented()

This error is issued when attempting to create the BoostParts.lib as well. It's my understanding that this method is required by the boost thread library and ycm implements an empty copy of it in both ycm_core.cpp and ycm_client_support.cpp. I don't know how to resolve this one as its unclear to me why the linker can't see the implementations in the ycm code.



installpy.txt
ycm_build.txt

mbo...@gmail.com

unread,
Nov 20, 2015, 5:27:48 AM11/20/15
to ycm-users
Hi,

Some lines are missing at the configure step in the installpy.txt file you attached. This is certainly because you didn't redirect the stderr output to the file, only the stdout. Could you provide those missing lines or recreate the installpy.txt file by running the following command:

install.py --clang-completer > installpy.txt 2&>1

Running "install.py --clang-completer" runs into problems when it can't find the header "clang-c/Index.h". I can see the header under YouCompleteMe\third_party\
ycmd\cpp\llvm\include\clang-c

YCM will not use those headers to build the libraries but the ones from the Clang installer, which is automatically downloaded by CMake.


Issue 3) Unresolved externals boost::tss_cleanup_implemented()

This error is issued when attempting to create the BoostParts.lib as well. It's my understanding that this method is required by the boost thread library and ycm implements an empty copy of it in both ycm_core.cpp and ycm_client_support.cpp. I don't know how to resolve this one as its unclear to me why the linker can't see the implementations in the ycm code.

You should clean the build folder between two compilations. It may fix this issue.

Connor Griffith

unread,
Nov 20, 2015, 10:52:49 PM11/20/15
to ycm-users
Yes, you're right about the stderr not being directed to file for installpy.txt. Sorry about that. Hopefully the new attachment should have the info.

For the unresolved externals, I tried the --clean-first cmake option and also totally wiping the build directory and restarting again. Both time ended with same unresolved externals error. I'm attaching the log for the run right after I deleted and recreated the build directory.
installpy.txt
ycm_build.txt

mbo...@gmail.com

unread,
Nov 22, 2015, 8:28:48 AM11/22/15
to ycm-users
An important line is missing in the output of the install.py script. Just after the line

Using libclang to provide semantic completion for C/C++/ObjC

it should print this:

Using external libclang: C:/Users/***/AppData/Local/Temp/ycm_build.******/$_OUTDIR/lib/libclang.lib

Not seeing this line means that CMake could not find the libclang.lib library after extracting the LLVM-3.7.0-win64.exe installer using 7-zip.

Could you edit the build.py script in the YouCompleteMe/third_party/ycmd folder by commenting the following line (add a # at the start of the line):

rmtree( build_dir )

line 235. With this change, it will not remove the temporary folder used to build the YCM libraries. Run again the install.py script with the --clang-completer option and go to the temporary folder. You can find its path by looking at this line from the CMake output:

-- Build files have been written to: C:/Users/***/AppData/Local/Temp/ycm_build.******

Once in this path, can you tell me if the file $_OUTDIR/lib/libclang.lib exist?

Connor Griffith

unread,
Nov 22, 2015, 2:00:46 PM11/22/15
to ycm-users
Yes, libclang.lib does exist. I'll attach the install script output along with the directory listing.
installpy.txt
dir.txt

mbo...@gmail.com

unread,
Nov 22, 2015, 3:29:10 PM11/22/15
to ycm-users
Ok, I found the issue. In the new 7-zip release, files from the LLVM installer are not extracted the same way as before. We currently expect those files to be in the ycm_build.****/$_OUTDIR folder. This was the case with 7-zip 9.20 but in 7-zip 15.12, they are directly extracted in the ycm_build.**** like in the directory listing you attached. This is why the build is failing.
This will be soon fixed in YCM. Meanwhile, you can modify the line 153 in the YouCompleteMe/third_party/ycmd/cpp/ycm/CMakeLists.txt file to

set( PATH_TO_LLVM_ROOT ${CMAKE_CURRENT_BINARY_DIR}/.. )

(remove the /$_OUTDIR part) and run again the install.py script. Tell us if it works.

Connor Griffith

unread,
Nov 23, 2015, 12:51:40 AM11/23/15
to ycm-users
Yes, this resolved the issue. Awesome job and thank you for your help. I have attached the script output for your reference. I gave YCM a quick run on a project for which I have used it extensively on before, and it was giving the expected behavior.
installpy.txt
Reply all
Reply to author
Forward
0 new messages