Skip to content

Loading…

Issue with building YCM with semantic support on Mac OS X 10.7 #112

Closed
shan23 opened this Issue · 21 comments

4 participants

@shan23

I'm trying to install YCM on my MBP running Mac OS X 10.7. I'm using MacVim and have installed YCM using Vundle, as described in the installation instructions. The CMake I'm using was installed via MacPorts. Here is the output I'm getting when trying to build:

~ # cd ~/.vim/bundle/YouCompleteMe/
bundle/YouCompleteMe # ./install.sh --clang-completer
/var/folders/qv/8q1zlwk14jq_f3fcn9p6yzbm0000gn/T/ycm_build.XXXX.PxnamWg7 ~/.vim/bundle/YouCompleteMe
-- The C compiler identification is GNU 4.2.1
-- The CXX compiler identification is GNU 4.2.1
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
Your C++ compiler does NOT support C++11, compiling in C++03 mode.
-- Found PythonLibs: /usr/lib/libpython2.7.dylib (found suitable version "2.7.1", minimum required is "2.5") 
System libclang seems good enough, using it.
Using libclang to provide semantic completion for C/C++/ObjC
Using external libclang: TEMP-NOTFOUND
-- Found PythonInterp: /usr/bin/python (found version "2.7.1") 
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE  
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
TEMP
    linked by target "ycm_core" in directory /Users/shan/.vim/bundle/YouCompleteMe/cpp/ycm

-- Configuring incomplete, errors occurred!

The error seems weird, as the log seems to indicate it had got a "good enough" libclang to use, but then it errored while trying to use an external libclang for some reason! I tried the following:

Use the flag -DEXTERNAL_LIBCLANG_PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libclang.dylib in install.sh (as the following lines):

make -G "Unix Makefiles"  -DEXTERNAL_LIBCLANG_PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libclang.dylib $1 . $ycm_dir/cpp

case "$1" in
  --clang-completer)
    cmake_args='-DUSE_CLANG_COMPLETER=ON -DEXTERNAL_LIBCLANG_PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libclang.dylib'
    ;;
  '')
    cmake_args='-DEXTERNAL_LIBCLANG_PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libclang.dylib'
    ;;
  *)
    usage
    ;;
esac

Even that produced the same error! Let me know what else I can do to resolve this, and feel free to request additional info for helping solve it!

@Valloric
Owner

Start by installing the latest Xcode plus the Command Line Tools from within Xcode. Then try again.

@olajep

This seems to be somewhat related to #93
Does this work for you?

DYLD_LIBRARY_PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib ./install.sh --clang-completer

@shan23

As per Valloric's suggestion, I updated XCode and the CLT from within XCode - compilation was done without a hitch!

bundle/YouCompleteMe # ./install.sh --clang-completer
/var/folders/qv/8q1zlwk14jq_f3fcn9p6yzbm0000gn/T/ycm_build.XXXX.i4GWBqij ~/.vim/bundle/YouCompleteMe
-- The C compiler identification is Clang 4.2.0
-- The CXX compiler identification is Clang 4.2.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
Your C++ compiler supports C++11, compiling in that mode.
-- Found PythonLibs: /usr/lib/libpython2.7.dylib (found suitable version "2.7.1", minimum required is "2.5") 
System libclang seems good enough, using it.
Using libclang to provide semantic completion for C/C++/ObjC
Using external libclang: /usr/lib/libclang.dylib
-- Found PythonInterp: /usr/bin/python (found version "2.7.1") 
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE  
-- Configuring done
-- Generating done
-- Build files have been written to: /var/folders/qv/8q1zlwk14jq_f3fcn9p6yzbm0000gn/T/ycm_build.XXXX.i4GWBqij
Scanning dependencies of target BoostParts
[  0%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/date_time/src/gregorian/date_generators.cpp.o
[  1%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/date_time/src/gregorian/greg_month.cpp.o
[  2%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/date_time/src/gregorian/greg_weekday.cpp.o
[  2%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/date_time/src/gregorian/gregorian_types.cpp.o
[  3%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/date_time/src/posix_time/posix_time_types.cpp.o
[  4%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/exception/src/clone_current_exception_non_intrusive.cpp.o
[  5%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/codecvt_error_category.cpp.o
[  5%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/operations.cpp.o
[  6%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/path.cpp.o
[  7%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/path_traits.cpp.o
[  8%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/portability.cpp.o
[  8%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/unique_path.cpp.o
[ 10%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/utf8_codecvt_facet.cpp.o
[ 11%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/windows_file_codecvt.cpp.o
[ 12%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/converter/arg_to_python_base.cpp.o
[ 12%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/converter/builtin_converters.cpp.o
[ 13%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/converter/from_python.cpp.o
[ 14%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/converter/registry.cpp.o
[ 15%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/converter/type_id.cpp.o
[ 15%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/dict.cpp.o
[ 16%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/errors.cpp.o
[ 17%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/exec.cpp.o
[ 19%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/import.cpp.o
[ 19%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/list.cpp.o
[ 20%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/long.cpp.o
[ 21%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/module.cpp.o
[ 22%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/numeric.cpp.o
[ 22%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/object/class.cpp.o
[ 23%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/object/enum.cpp.o
[ 24%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/object/function.cpp.o
[ 24%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/object/function_doc_signature.cpp.o
[ 25%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/object/inheritance.cpp.o
[ 26%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/object/iterator.cpp.o
[ 28%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/object/life_support.cpp.o
[ 28%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/object/pickle_support.cpp.o
[ 29%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/object/stl_iterator.cpp.o
[ 30%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/object_operators.cpp.o
[ 31%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/object_protocol.cpp.o
[ 31%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/slice.cpp.o
[ 32%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/str.cpp.o
[ 33%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/tuple.cpp.o
[ 34%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/wrapper.cpp.o
[ 34%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/c_regex_traits.cpp.o
[ 35%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/cpp_regex_traits.cpp.o
[ 37%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/cregex.cpp.o
[ 38%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/fileiter.cpp.o
[ 38%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/icu.cpp.o
[ 39%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/instances.cpp.o
[ 40%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/posix_api.cpp.o
[ 41%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/regex.cpp.o
[ 41%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/regex_debug.cpp.o
[ 42%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/regex_raw_buffer.cpp.o
[ 43%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/regex_traits_defaults.cpp.o
[ 44%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/static_mutex.cpp.o
[ 44%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/usinstances.cpp.o
[ 46%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/w32_regex_traits.cpp.o
[ 47%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/wc_regex_traits.cpp.o
[ 47%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/wide_posix_api.cpp.o
[ 48%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/winstances.cpp.o
[ 49%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/archive_exception.cpp.o
[ 50%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/basic_archive.cpp.o
[ 50%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/basic_iarchive.cpp.o
[ 51%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/basic_iserializer.cpp.o
[ 52%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/basic_oarchive.cpp.o
[ 53%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/basic_oserializer.cpp.o
[ 53%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/basic_pointer_iserializer.cpp.o
[ 55%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/basic_pointer_oserializer.cpp.o
[ 56%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/basic_serializer_map.cpp.o
[ 57%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/basic_text_iprimitive.cpp.o
[ 57%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/basic_text_oprimitive.cpp.o
[ 58%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/basic_text_wiprimitive.cpp.o
[ 59%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/basic_text_woprimitive.cpp.o
[ 60%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/basic_xml_archive.cpp.o
[ 60%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/binary_iarchive.cpp.o
[ 61%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/binary_oarchive.cpp.o
[ 62%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/binary_wiarchive.cpp.o
[ 64%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/binary_woarchive.cpp.o
[ 64%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/codecvt_null.cpp.o
[ 65%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/extended_type_info.cpp.o
[ 66%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/extended_type_info_no_rtti.cpp.o
[ 67%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/extended_type_info_typeid.cpp.o
[ 67%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/polymorphic_iarchive.cpp.o
[ 68%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/polymorphic_oarchive.cpp.o
[ 69%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/shared_ptr_helper.cpp.o
[ 69%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/stl_port.cpp.o
[ 70%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/text_iarchive.cpp.o
[ 71%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/text_oarchive.cpp.o
[ 73%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/text_wiarchive.cpp.o
[ 73%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/text_woarchive.cpp.o
[ 74%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/utf8_codecvt_facet.cpp.o
[ 75%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/void_cast.cpp.o
[ 76%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/xml_archive_exception.cpp.o
[ 76%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/xml_grammar.cpp.o
[ 77%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/xml_iarchive.cpp.o
[ 78%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/xml_oarchive.cpp.o
[ 79%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/xml_wgrammar.cpp.o
[ 79%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/xml_wiarchive.cpp.o
[ 80%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/serialization/src/xml_woarchive.cpp.o
[ 82%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/smart_ptr/src/sp_collector.cpp.o
[ 83%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/smart_ptr/src/sp_debug_hooks.cpp.o
[ 83%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/system/src/error_code.cpp.o
[ 84%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/thread/src/future.cpp.o
[ 85%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/thread/src/pthread/once.cpp.o
[ 86%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/thread/src/pthread/thread.cpp.o
Linking CXX static library libBoostParts.a
/usr/bin/ranlib: file: libBoostParts.a(gregorian_types.cpp.o) has no symbols
/usr/bin/ranlib: file: libBoostParts.a(posix_time_types.cpp.o) has no symbols
/usr/bin/ranlib: file: libBoostParts.a(windows_file_codecvt.cpp.o) has no symbols
/usr/bin/ranlib: file: libBoostParts.a(icu.cpp.o) has no symbols
/usr/bin/ranlib: file: libBoostParts.a(regex_debug.cpp.o) has no symbols
/usr/bin/ranlib: file: libBoostParts.a(usinstances.cpp.o) has no symbols

/usr/bin/ranlib: file: libBoostParts.a(w32_regex_traits.cpp.o) has no symbols
/usr/bin/ranlib: file: libBoostParts.a(stl_port.cpp.o) has no symbols
/usr/bin/ranlib: file: libBoostParts.a(sp_collector.cpp.o) has no symbols
/usr/bin/ranlib: file: libBoostParts.a(sp_debug_hooks.cpp.o) has no symbols
/usr/bin/ranlib: file: libBoostParts.a(gregorian_types.cpp.o) has no symbols
/usr/bin/ranlib: file: libBoostParts.a(posix_time_types.cpp.o) has no symbols
/usr/bin/ranlib: file: libBoostParts.a(windows_file_codecvt.cpp.o) has no symbols
/usr/bin/ranlib: file: libBoostParts.a(icu.cpp.o) has no symbols
/usr/bin/ranlib: file: libBoostParts.a(regex_debug.cpp.o) has no symbols
/usr/bin/ranlib: file: libBoostParts.a(usinstances.cpp.o) has no symbols
/usr/bin/ranlib: file: libBoostParts.a(w32_regex_traits.cpp.o) has no symbols
/usr/bin/ranlib: file: libBoostParts.a(stl_port.cpp.o) has no symbols
/usr/bin/ranlib: file: libBoostParts.a(sp_collector.cpp.o) has no symbols
/usr/bin/ranlib: file: libBoostParts.a(sp_debug_hooks.cpp.o) has no symbols
[ 86%] Built target BoostParts
Scanning dependencies of target ycm_core
[ 86%] Building CXX object ycm/CMakeFiles/ycm_core.dir/Candidate.cpp.o
[ 87%] Building CXX object ycm/CMakeFiles/ycm_core.dir/CandidateRepository.cpp.o
[ 88%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/ClangCompleter.cpp.o
[ 89%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/ClangResultsCache.cpp.o
[ 89%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/ClangUtils.cpp.o
[ 91%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/CompilationDatabase.cpp.o
[ 92%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/CompletionData.cpp.o
[ 93%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/TranslationUnit.cpp.o
[ 93%] Building CXX object ycm/CMakeFiles/ycm_core.dir/CustomAssert.cpp.o
[ 94%] Building CXX object ycm/CMakeFiles/ycm_core.dir/IdentifierCompleter.cpp.o
[ 95%] Building CXX object ycm/CMakeFiles/ycm_core.dir/IdentifierUtils.cpp.o
[ 96%] Building CXX object ycm/CMakeFiles/ycm_core.dir/LetterNode.cpp.o
[ 96%] Building CXX object ycm/CMakeFiles/ycm_core.dir/LetterNodeListMap.cpp.o
[ 97%] Building CXX object ycm/CMakeFiles/ycm_core.dir/PythonSupport.cpp.o
[ 98%] Building CXX object ycm/CMakeFiles/ycm_core.dir/Result.cpp.o
[100%] Building CXX object ycm/CMakeFiles/ycm_core.dir/Utils.cpp.o
[100%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ycm_core.cpp.o
Linking CXX shared library /Users/shan/.vim/bundle/YouCompleteMe/python/ycm_core.so
[100%] Built target ycm_core
~/.vim/bundle/YouCompleteMe

However, when I launched Vim after that, it immediately crashed:

bundle/YouCompleteMe # which vim
/Applications/MacVim.app/Contents/MacOS/vim
bundle/YouCompleteMe # vim install.sh 
Vim: Caught deadly signal ABRT

Vim: Finished.
Abort
     bundle/YouCompleteMe #

Just to be sure, I reinstalled YCM through Vundle (after doing rm -rf * for that directory), and then re-ran the build - exact same result.

Do let me know if any additional info (specs/debug builds/core dumps as needed, I'll be happy to attach them!)

@shan23

Additional info:

  • The crash happens both with/without semantic support for YCM
  • I've pasted the last few lines for the Vim runtime log for debug level 10 - it seems the crash happens immediately after sourcing the autoload file.
Searching for "/Applications/MacVim.app/Contents/Resources/vim/vimfiles/after/plugin/**/*.vim"
Searching for "/Users/shan/.vim/after/plugin/**/*.vim"
Searching for "/Users/shan/.vim/bundle/vundle/plugin/**/*.vim"
Searching for "/Users/shan/.vim/bundle/vundle/after/plugin/**/*.vim"
Searching for "/Users/shan/.vim/bundle/YouCompleteMe/after/plugin/**/*.vim"
Reading viminfo file "/Users/shan/.viminfo" info oldfiles
Executing BufEnter Auto commands for "*"
autocommand sil! call s:LocalBrowse(expand("<amatch>"))

Executing VimEnter Auto commands for "*"
autocommand call youcompleteme#Enable()

Searching for "autoload/youcompleteme.vim" in "/Users/shan/.vim/bundle/vundle,/Users/shan/.vim/bundle/YouCompleteMe,/Users/shan/.vim,/Applications/MacVim.app/Contents/Resources/vim/vimfiles,/Applications/MacVim.app/Contents/Resources/vim/runtime,/Applications/MacVim.app/Contents/Resources/vim/vimfiles/after,/Users/shan/.vim/after,/Users/shan/.vim/bundle/vundle/,/Users/shan/.vim/bundle/vundle/after,/Users/shan/.vim/bundle/YouCompleteMe/after"
Searching for "/Users/shan/.vim/bundle/vundle/autoload/youcompleteme.vim"
Searching for "/Users/shan/.vim/bundle/YouCompleteMe/autoload/youcompleteme.vim"
chdir(/Users/shan/.vim/bundle/YouCompleteMe/autoload)
fchdir() to previous dir
line 0: sourcing "/Users/shan/.vim/bundle/YouCompleteMe/autoload/youcompleteme.vim"
finished sourcing /Users/shan/.vim/bundle/YouCompleteMe/autoload/youcompleteme.vim
continuing in VimEnter Auto commands for "*"
@Valloric
Owner

Try to start Vim under gdb/lldb; that should show you more details about the crash.

@shan23

Output from gdb (version 6.3, installed by default in /usr/bin):

Reading symbols for shared libraries ... done
Fatal Python error: Interpreter not initialized (version mismatch?)

Program received signal SIGABRT, Aborted.
0x00007fff94f2ace2 in __pthread_kill ()
(gdb) bt
#0  0x00007fff94f2ace2 in __pthread_kill ()
#1  0x00007fff94d617d2 in pthread_kill ()
#2  0x00007fff94d52a7a in abort ()
#3  0x000000010568696e in Py_FatalError ()
#4  0x000000010568446b in Py_InitModule4_64 ()
#5  0x0000000105386448 in boost::python::detail::init_module ()
#6  0x000000010042dee2 in _PyImport_LoadDynamicModule ()
#7  0x000000010042c652 in PyImport_ReloadModule ()
#8  0x000000010042c860 in PyImport_ReloadModule ()
#9  0x000000010042d60d in PyImport_ImportModuleLevel ()
#10 0x0000000100411b4c in _PyBuiltin_Init ()
#11 0x000000010039f4c0 in PyObject_Call ()
#12 0x000000010041636b in PyEval_CallObjectWithKeywords ()
#13 0x000000010041ba33 in PyEval_EvalFrameEx ()
#14 0x000000010041cda4 in PyEval_EvalCodeEx ()
#15 0x000000010041ce19 in PyEval_EvalCode ()
#16 0x000000010042b346 in PyImport_ExecCodeModuleEx ()
#17 0x000000010042b88e in PyImport_ExecCodeModuleEx ()
#18 0x000000010042c652 in PyImport_ReloadModule ()
#19 0x000000010042c860 in PyImport_ReloadModule ()
#20 0x000000010042d60d in PyImport_ImportModuleLevel ()
#21 0x0000000100411b4c in _PyBuiltin_Init ()
#22 0x000000010039f4c0 in PyObject_Call ()
#23 0x000000010041636b in PyEval_CallObjectWithKeywords ()
#24 0x000000010041ba33 in PyEval_EvalFrameEx ()
#25 0x000000010041cda4 in PyEval_EvalCodeEx ()
#26 0x000000010041ce19 in PyEval_EvalCode ()
#27 0x000000010043416b in Py_CompileString ()
#28 0x00000001004342f7 in PyRun_StringFlags ()
#29 0x000000010043517d in PyRun_SimpleStringFlags ()
#30 0x000000010018770d in DoPythonCommand ()
#31 0x000000010018796a in ex_python ()
#32 0x0000000100061403 in do_cmdline ()
#33 0x0000000100035cb4 in call_func ()
#34 0x00000001000383cf in get_func_tv ()
#35 0x000000010003d3a6 in ex_call ()
#36 0x0000000100061403 in do_cmdline ()
#37 0x00000001000720d9 in apply_autocmds_group ()
#38 0x000000010007235e in apply_autocmds ()
#39 0x000000010019b018 in main ()

I'm not sure why its showing a version mismatch, seeing that it correctly detected python during installation. FWIW, here's the version used by defult on my system:

~ # which python
/usr/bin/python
~ # python --version
Python 2.7.1
@shan23

I got more info on this, using gdb 7.5 that I updated today via MacPorts:

Starting program: /Applications/MacVim.app/Contents/MacOS/vim
[New Thread 0x2e03 of process 80677]
[New Thread 0x2f03 of process 80677]
[New Thread 0x3003 of process 80677]

Program received signal SIGABRT, Aborted.
0x00007fff94f2ace2 in __pthread_kill () from /usr/lib/system/libsystem_kernel.dylib
#0  0x00007fff94f2ace2 in __pthread_kill () from /usr/lib/system/libsystem_kernel.dylib
#1  0x00007fff94d617d2 in pthread_kill () from /usr/lib/system/libsystem_c.dylib
#2  0x00007fff94d52a7a in abort () from /usr/lib/system/libsystem_c.dylib
#3  0x0000000105d8696e in Py_FatalError ()
   from /System/Library/Frameworks/Python.framework/Versions/2.7/Python
#4  0x0000000105d8446b in Py_InitModule4_64 ()
   from /System/Library/Frameworks/Python.framework/Versions/2.7/Python
#5  0x0000000105a86448 in boost::python::detail::init_module(char const*, void (*)()) ()
   from /Users/shan/.vim/bundle/YouCompleteMe/autoload/../python/ycm_core.so
#6  0x000000010042dee2 in _PyImport_LoadDynamicModule ()
   from /System/Library/Frameworks/Python.framework/Versions/2.6/Python
#7  0x000000010042c652 in PyImport_ReloadModule ()
   from /System/Library/Frameworks/Python.framework/Versions/2.6/Python
#8  0x000000010042c860 in PyImport_ReloadModule ()
   from /System/Library/Frameworks/Python.framework/Versions/2.6/Python
#9  0x000000010042d60d in PyImport_ImportModuleLevel ()
   from /System/Library/Frameworks/Python.framework/Versions/2.6/Python
#10 0x0000000100411b4c in _PyBuiltin_Init ()
   from /System/Library/Frameworks/Python.framework/Versions/2.6/Python
#11 0x000000010039f4c0 in PyObject_Call ()
   from /System/Library/Frameworks/Python.framework/Versions/2.6/Python
#12 0x000000010041636b in PyEval_CallObjectWithKeywords ()
   from /System/Library/Frameworks/Python.framework/Versions/2.6/Python
#13 0x000000010041ba33 in PyEval_EvalFrameEx ()
   from /System/Library/Frameworks/Python.framework/Versions/2.6/Python
#14 0x000000010041cda4 in PyEval_EvalCodeEx ()
   from /System/Library/Frameworks/Python.framework/Versions/2.6/Python
#15 0x000000010041ce19 in PyEval_EvalCode ()
   from /System/Library/Frameworks/Python.framework/Versions/2.6/Python
#16 0x000000010042b346 in PyImport_ExecCodeModuleEx ()
   from /System/Library/Frameworks/Python.framework/Versions/2.6/Python
#17 0x000000010042b88e in PyImport_ExecCodeModuleEx ()
   from /System/Library/Frameworks/Python.framework/Versions/2.6/Python
#18 0x000000010042c652 in PyImport_ReloadModule ()
   from /System/Library/Frameworks/Python.framework/Versions/2.6/Python
#19 0x000000010042c860 in PyImport_ReloadModule ()
   from /System/Library/Frameworks/Python.framework/Versions/2.6/Python
#20 0x000000010042d60d in PyImport_ImportModuleLevel ()
   from /System/Library/Frameworks/Python.framework/Versions/2.6/Python
#21 0x0000000100411b4c in _PyBuiltin_Init ()
   from /System/Library/Frameworks/Python.framework/Versions/2.6/Python
#22 0x000000010039f4c0 in PyObject_Call ()
   from /System/Library/Frameworks/Python.framework/Versions/2.6/Python
#23 0x000000010041636b in PyEval_CallObjectWithKeywords ()
   from /System/Library/Frameworks/Python.framework/Versions/2.6/Python
#24 0x000000010041ba33 in PyEval_EvalFrameEx ()
   from /System/Library/Frameworks/Python.framework/Versions/2.6/Python
#25 0x000000010041cda4 in PyEval_EvalCodeEx ()
   from /System/Library/Frameworks/Python.framework/Versions/2.6/Python
#26 0x000000010041ce19 in PyEval_EvalCode ()
   from /System/Library/Frameworks/Python.framework/Versions/2.6/Python
#27 0x000000010043416b in Py_CompileString ()
   from /System/Library/Frameworks/Python.framework/Versions/2.6/Python
#28 0x00000001004342f7 in PyRun_StringFlags ()
   from /System/Library/Frameworks/Python.framework/Versions/2.6/Python
#29 0x000000010043517d in PyRun_SimpleStringFlags ()
   from /System/Library/Frameworks/Python.framework/Versions/2.6/Python
#30 0x000000010018770d in DoPythonCommand ()
#31 0x000000010018796a in ex_python ()
#32 0x0000000100061403 in do_cmdline ()
#33 0x0000000100035cb4 in call_func ()
#34 0x00000001000383cf in get_func_tv ()
#35 0x000000010003d3a6 in ex_call ()
#36 0x0000000100061403 in do_cmdline ()
#37 0x00000001000720d9 in apply_autocmds_group ()
#38 0x000000010007235e in apply_autocmds ()
#39 0x000000010019b018 in main () 

It seems to me that while loading, YCM is somehow trying to use Python 2.6 in /System/Library..., though why it is doing so, and how to dissuade it from doing so, I'm not really sure - hope this helps!

@Valloric
Owner

Sorry I don't know how to help you with this. You've got it tracked down, Vim is loading one version of Python while you've got YCM compiled against a different version.

Where did you get your Vim binary? Are you using MacVim?

@shan23

Yes, as specified in the installation instructions, I'm using MacVim:

~ # which vim
/Applications/MacVim.app/Contents/MacOS/vim
~ # vim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Dec 13 2012 00:07:34)
MacOS X (unix) version
Included patches: 1-754
Compiled by Douglas Drumond <douglas@drumond19.com>
**Huge version with MacVim GUI**.  Features included (+) or not (-):
+arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset +cindent 
+clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments 
+conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con_gui +diff 
+digraphs +dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi 
+file_in_path +find_in_path +float +folding -footer +fork() +fullscreen 
-gettext -hangul_input +iconv +insert_expand +jumplist +keymap +langmap 
+libcall +linebreak +lispindent +listcmds +localmap -lua +menu +mksession 
+modify_fname +mouse +mouseshape +mouse_dec -mouse_gpm -mouse_jsbterm 
+mouse_netterm +mouse_sgr -mouse_sysmouse +mouse_urxvt +mouse_xterm +multi_byte
 +multi_lang -mzscheme +netbeans_intg +odbeditor +path_extra +perl 
+persistent_undo +postscript +printer +profile +python -python3 +quickfix 
+reltime +rightleft +ruby +scrollbind +signs +smartindent -sniff +startuptime 
+statusline -sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white 
-tcl +terminfo +termresponse +textobjects +title +toolbar +transparency 
+user_commands +vertsplit +virtualedit +visual +visualextra +viminfo +vreplace 
+wildignore +wildmenu +windows +writebackup -X11 -xfontset +xim -xsmp 
-xterm_clipboard -xterm_save 
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/Applications/MacVim.app/Contents/Resources/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe  -DMACOS_X_UNIX -no-cpp-precomp  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1      
Linking: gcc   -L.    -L.         -o Vim -framework Cocoa -framework Carbon      -lncurses  -liconv -framework Cocoa    -L/usr/local/lib  -L/System/Library/Perl/5.10.0/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc -framework Python   -framework Ruby

Any ideas as to what flags one can use to point to the python version to be used, or any hacks (such as symlinking the python library/binary in the YCM python folder) that can be applied? I do want to make this work, and would appreciate any help you can provide!

@Valloric
Owner

Try passing the following to cmake; don't forget to always fully delete everything in your build folder before changing something in the cmake call.

-DPYTHON_INCLUDE_DIR=/usr/include/python2.7 -DPYTHON_LIBRARY=/usr/lib/libpython2.7.so

@Valloric
Owner

Closing since no further info provided by issue reporter.

@Valloric Valloric closed this
@shan23

@Valloric
In order to try using the suggested flags, I made the following change in install.sh:

cmake -G "Unix Makefiles" '-DPYTHON_LIBRARY=/usr/lib/libpython2.7.so' '-DPYTHON_INCLUDE_DIR=/usr/include/python2.7' $1 . $ycm_dir/cpp

With that, I'm getting the following issue:

[100%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ycm_core.cpp.o
make[3]: *** No rule to make target `/usr/lib/libpython2.7.so', needed by `/Users/shan/.vim/bundle/YouCompleteMe/python/ycm_core.so'.  Stop.

I then pulled the latest release of YCM, which supposedly has this automated (inside install.sh), but I still get the same abort with same call stack:

Installation log:

-- The C compiler identification is Clang 4.2.0
-- The CXX compiler identification is Clang 4.2.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
Your C++ compiler supports C++11, compiling in that mode.
-- Found PythonLibs: /System/Library/Frameworks/Python.framework/Versions/2.7/Python (found suitable version "2.7.1", minimum required is "2.5") 
System libclang seems good enough, using it.
Using libclang to provide semantic completion for C/C++/ObjC
Using external libclang: /usr/lib/libclang.dylib
-- Found PythonInterp: /usr/bin/python (found version "2.7.1") 
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE  
-- Configuring done
-- Generating done

Call stack on abort:

Program received signal SIGABRT, Aborted.
0x00007fff94f2ace2 in __pthread_kill () from /usr/lib/system/libsystem_kernel.dylib
(gdb) bt
#0  0x00007fff94f2ace2 in __pthread_kill () from /usr/lib/system/libsystem_kernel.dylib
#1  0x00007fff94d617d2 in pthread_kill () from /usr/lib/system/libsystem_c.dylib
#2  0x00007fff94d52a7a in abort () from /usr/lib/system/libsystem_c.dylib
#3  0x000000010559396e in Py_FatalError () from /System/Library/Frameworks/Python.framework/Versions/2.7/Python
#4  0x000000010559146b in Py_InitModule4_64 ()
   from /System/Library/Frameworks/Python.framework/Versions/2.7/Python
#5  0x000000010528df38 in boost::python::detail::init_module(char const*, void (*)()) ()
   from /Users/shan/.vim/bundle/YouCompleteMe/autoload/../python/ycm_core.so
#6  0x000000010042dee2 in _PyImport_LoadDynamicModule ()
   from /System/Library/Frameworks/Python.framework/Versions/2.6/Python
#7  0x000000010042c652 in PyImport_ReloadModule ()
   from /System/Library/Frameworks/Python.framework/Versions/2.6/Python
#8  0x000000010042c860 in PyImport_ReloadModule ()
   from /System/Library/Frameworks/Python.framework/Versions/2.6/Python
#9  0x000000010042d60d in PyImport_ImportModuleLevel ()
   from /System/Library/Frameworks/Python.framework/Versions/2.6/Python
#10 0x0000000100411b4c in _PyBuiltin_Init () from /System/Library/Frameworks/Python.framework/Versions/2.6/Python
#11 0x000000010039f4c0 in PyObject_Call () from /System/Library/Frameworks/Python.framework/Versions/2.6/Python
#12 0x000000010041636b in PyEval_CallObjectWithKeywords ()
   from /System/Library/Frameworks/Python.framework/Versions/2.6/Python
#13 0x000000010041ba33 in PyEval_EvalFrameEx ()
   from /System/Library/Frameworks/Python.framework/Versions/2.6/Python
#14 0x000000010041cda4 in PyEval_EvalCodeEx ()
   from /System/Library/Frameworks/Python.framework/Versions/2.6/Python

Do you want me to
a) Open a new issue (as this seems to have been closed without warning while I was trying out the suggested solutions)
b) Just move on?

@xgalaxy

shan23,

See: Homebrew/homebrew#17908

Also, from that output it looks like both MacVim and YouCompleteMe found Python in your system path, which is fine. However YouCompleteMe used 2.7 and MacVim is using 2.6.

What is the output of:

python-config --prefix

If its 2.7 then you need to recompile MacVim.

@shan23

@xgalaxy
I don't have homebrew installed - I use MacPorts, and MacVim has been downloaded directly from the website as suggested in the installation instructions. Do you think the solution is still applicable, as in my case, YCM confuses between python version installed by XCode?

@xgalaxy

YouCompleteMe and MacVim need to be compiled targeting the same Python version. If MacVim is targeting 2.6 then you need to force YouCompleteMe to target 2.6.

Run:

otool -L <path/to/macvim> | grep Python

This will tell you exactly which Python it was linked against. Then you can run the same command on the ycm_cor.so and see exactly which Python it was linked against. If they aren't the same you will continue to get this error.

Here is mine:

/usr/local/bin/ ❯ otool -L vim | grep Python                                                                                             master @ a61cca6
 /System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.1)

~/.vim/bundle/YouCompleteMe/python ❯ otool -L ycm_core.so | grep Python
/System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.1)
@shan23

Hmmm - does that mean I'll have to employ the somewhat "dirty" solution mentioned here, each time I want to build/update YCM? Just wanted to confirm if
1) That is indeed what you meant
2) There is no permanent solution in the works, which I'll be glad to wait for!

@xgalaxy

Again, please do the below commands and the ones I've given you and note their output here. Otherwise we are just guessing.

python-config --prefix

and

otool -L /Applications/MacVim.app/Contents/MacOS/vim | grep Python

And tell us what those say.

@shan23
~ # python-config --prefix
/System/Library/Frameworks/Python.framework/Versions/2.7
~ # otool -L /Applications/MacVim.app/Contents/MacOS/vim | grep Python
    /System/Library/Frameworks/Python.framework/Versions/2.6/Python (compatibility version 2.6.0, current version 2.6.1)

It seems I've to force YCM to use 2.6, or get a new MacVim compiled with 2.7...

@xgalaxy

Yes.
Unfortunately YCM doesn't really have any good way of knowing what python your MacVim was compiled against. I guess it could technically automate the otool call and parse out the python version but there is no guarantee that the user doesn't have MacVim with 2.6 and regular Vim with 2.7.

All YCM can do is guess as to which the best Python would be to use based on the currently active Python version, as found via python-config --prefix.

Another option is to improve the install script for YCM further by prompting the user to choose a Python version to compile against or provide an additional optional argument to force a version.

I could probably find the time to add the additional optional argument to the install script some time later this week.

@shan23

@xgalaxy
Seems I've solved the issue for now - by compiling MacVim with Python 2.7 ! Here's the how-to I used:
http://tartley.com/?p=1355

But yeah, having a fix would definitely be nice, either using otool or the cmdline option to force python version...

@Valloric
Owner

@xgalaxy I support the possible additional argument for the install script that lets the user choose a version of Python to compile against. I'd gladly merge that in.

@shan23 I'd like to address why I closed this issue. First, don't take the issue status too seriously; open issues are merely those for which I think I still need to do something. If I think there's nothing more to do, I close it. I've often encountered issue reports where I give the reporter instructions on how to fix his problem and then he resolves it, but never comes back to say "everything works" and close the issue. Thus when there have been a few days of inactivity by the reporter, I close the issue so it doesn't obscure my TODO list. It can always easily be reopened if need be.

I'm glad to see you got this resolved.

BTW, my output for otool -L /Applications/MacVim.app/Contents/MacOS/vim | grep Python shows the following:

/System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.2)

Which shows MacVim linking against Python 2.7. I'm on Mac OS X 10.8.2 and using the latest upstream MacVim binary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.