Skip to content

YCM Fails to Find Project Headers #4291

@mehoggan

Description

@mehoggan

I recently upgraded my corporate laptop to macOS Sequoia 15.3.1 (24D70). I deleted my previous version of YCM, re-cloned recursively and then built YCM with:

python3 install.py --clangd-completer

My vim version is:

VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Sep 18 2024 15:59:03)
macOS version - x86_64
Included patches: 1-736
Compiled by matthew.hoggan@WUST038464.bayer.cnb
Huge version without GUI.  Features included (+) or not (-):
+acl               +file_in_path      +mouse_urxvt       -tag_any_white
+arabic            +find_in_path      +mouse_xterm       -tcl
+autocmd           +float             +multi_byte        +termguicolors
+autochdir         +folding           +multi_lang        +terminal
-autoservername    -footer            -mzscheme          +terminfo
-balloon_eval      +fork()            -netbeans_intg     +termresponse
+balloon_eval_term +gettext           +num64             +textobjects
-browse            -hangul_input      +packages          +textprop
++builtin_terms    +iconv             +path_extra        +timers
+byte_offset       +insert_expand     +perl/dyn          +title
+channel           +ipv6              +persistent_undo   -toolbar
+cindent           +job               +popupwin          +user_commands
-clientserver      +jumplist          +postscript        +vartabs
+clipboard         +keymap            +printer           +vertsplit
+cmdline_compl     +lambda            +profile           +vim9script
+cmdline_hist      +langmap           -python            +viminfo
+cmdline_info      +libcall           +python3           +virtualedit
+comments          +linebreak         +quickfix          +visual
+conceal           +lispindent        +reltime           +visualextra
+cryptv            +listcmds          +rightleft         +vreplace
-cscope            +localmap          -ruby              +wildignore
+cursorbind        -lua               +scrollbind        +wildmenu
+cursorshape       +menu              +signs             +windows
+dialog_con        +mksession         +smartindent       +writebackup
+diff              +modify_fname      -sodium            -X11
+digraphs          +mouse             +sound             -xattr
-dnd               -mouseshape        +spell             -xfontset
-ebcdic            +mouse_dec         +startuptime       -xim
+emacs_tags        -mouse_gpm         +statusline        -xpm
+eval              -mouse_jsbterm     -sun_workshop      -xsmp
+ex_extra          +mouse_netterm     +syntax            -xterm_clipboard
+extra_search      +mouse_sgr         +tag_binary        -xterm_save
-farsi             -mouse_sysmouse    -tag_old_static    
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
 3rd user vimrc file: "~/.config/vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X -DMACOS_X_DARWIN -g -O2 -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 
Linking: gcc -L/usr/local/lib -o vim -lm -lncurses -liconv -lintl -framework AppKit -L/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/config-3.12-darwin -lpython3.12 -framework CoreFoundation 

The YCM server starts up with the following YcmDebugInfo

 /Users/matthew.hoggan/Devel/gitlab/mehoggan/dag_scheduler                                                                 COMMAND  ᚠ REMOVE_DEPS!  include/dag_scheduler/concurrent_task_queue.h                                                                                                                                                                                                                                               cpp  utf-8[unix]  0% ☰ 1/179 ㏑:1  W:7(L31)  E:19(L1) 
Printing YouCompleteMe debug information...
-- Resolve completions: Up front
-- Client logfile: /var/folders/z8/phspv2fx4mb7pfkcndd6m1pr0000gq/T/ycm_4dcjebeb.log
-- Server Python interpreter: /Users/matthew.hoggan/.pyenv/versions/3.11.8/bin/python3
-- Server Python version: 3.11.8
-- Server has Clang support compiled in: False
-- Clang version: None
-- Extra configuration file found and loaded
-- Extra configuration path: /Users/matthew.hoggan/Devel/gitlab/mehoggan/dag_scheduler/.ycm_extra_conf.py
-- C-family completer debug information:
--   Clangd running
--   Clangd process ID: 77352
--   Clangd executable: ['/Users/matthew.hoggan/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd', '-header-insertion-decorators=0', '-resource-dir=/Users/matthew.hoggan/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clang/lib/clang/19.1.0', '-limit-results=500']
--   Clangd logfiles:
--     /var/folders/z8/phspv2fx4mb7pfkcndd6m1pr0000gq/T/clangd_stderr8d87ikhh.log
--   Clangd Server State: Initialized
--   Clangd Project Directory: /Users/matthew.hoggan/Devel/gitlab/mehoggan/dag_scheduler
--   Clangd Open Workspaces: {'/Users/matthew.hoggan/Devel/gitlab/mehoggan/dag_scheduler'}
--   Clangd Settings: {}
--   Clangd Compilation Command: ['clang-tool', '-I', '/Users/matthew.hoggan/Devel/gitlab/mehoggan/dag_scheduler/stages_lib/include', '-I', '/Users/matthew.hoggan/Devel/gitlab/mehoggan/dag_scheduler/test/utils', '-I', '/Users/matthew.hoggan/Devel/gitlab/mehoggan/dag_scheduler/include', '-I', '/Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sdk/usr/include/c++/v1', '-I', '/usr/local/Cellar/boost@1.85/1.85.0_2/include', '-I', '/Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sd
k/usr/include', '-isysroot', '/Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sdk/usr/include/c++/v1', '-isystem', '/Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sdk/usr/include/c++/v1', '-isysroot', '/Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sdk/usr/include', '-isystem', '/Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sdk/usr/include', '-x', 'c++', '-Wall', '-std=c++17', '-std=gnu++17', '-isystem', '/Library/Developer/CommandLineTools/usr/include/c++/v1', '
-isystem', '/Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sdk/usr/include/usr/local/include', '-isystem', '/usr/local/include', '-isystem', '/Users/matthew.hoggan/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clang/lib/clang/19.1.0/include', '-isystem', '/Library/Developer/CommandLineTools/usr/include', '-isystem', '/Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sdk/usr/include/usr/include', '-iframework', '/Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sdk/
usr/include/System/Library/Frameworks', '-iframework', '/Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sdk/usr/include/Library/Frameworks', '/Users/matthew.hoggan/Devel/gitlab/mehoggan/dag_scheduler/include/dag_scheduler/concurrent_task_queue.h']
-- Server running at: http://127.0.0.1:59613
-- Server process ID: 77255
-- Server logfiles:
--   /var/folders/z8/phspv2fx4mb7pfkcndd6m1pr0000gq/T/ycmd_59613_stdout_k78mhyyl.log
--   /var/folders/z8/phspv2fx4mb7pfkcndd6m1pr0000gq/T/ycmd_59613_stderr_upyqt2xg.log
-- Semantic highlighting supported: True
-- Virtual text supported: True
-- Popup windows supported: True

I have checked each path in the Settings and they all exist. The code builds fine using the system clang. I have also tried to use other brew versions of clang/llvm and see the same results.

The contents of the logs are:

clangd_stderr8d87ikhh.log
I[15:03:27.551] Built preamble of size 55570416 for file /Users/matthew.hoggan/Devel/gitlab/mehoggan/dag_scheduler/include/dag_scheduler/concurrent_task_queue.h version 1 in 5.93 seconds
I[15:03:27.554] Indexing c++17 standard library in the context of /Users/matthew.hoggan/Devel/gitlab/mehoggan/dag_scheduler/include/dag_scheduler/concurrent_task_queue.h 
I[15:03:27.698] --> textDocument/publishDiagnostics                             
I[15:03:30.095] Indexed /Users/matthew.hoggan/Devel/gitlab/mehoggan/dag_scheduler/include/dag_scheduler/concurrent_task_queue.h (30189 symbols, 213724 refs, 2434 files)
I[15:03:30.095] Failed to compile /Users/matthew.hoggan/Devel/gitlab/mehoggan/dag_scheduler/include/dag_scheduler/concurrent_task_queue.h, index may be incomplete
I[15:03:30.417] Indexed c++17 standard library: 10673 symbols, 2391 filtered
ycmd_59613_stderr_upyqt2xg.log
127.0.0.1 - - [06/Mar/2025 15:08:45] "POST /receive_messages HTTP/1.1" 200 4    
127.0.0.1 - - [06/Mar/2025 15:08:55] "POST /receive_messages HTTP/1.1" 200 4    
127.0.0.1 - - [06/Mar/2025 15:09:05] "POST /receive_messages HTTP/1.1" 200 4    
127.0.0.1 - - [06/Mar/2025 15:09:15] "POST /receive_messages HTTP/1.1" 200 4    
127.0.0.1 - - [06/Mar/2025 15:09:24] "POST /debug_info HTTP/1.1" 200 2733       
127.0.0.1 - - [06/Mar/2025 15:09:25] "POST /receive_messages HTTP/1.1" 200 4    
127.0.0.1 - - [06/Mar/2025 15:09:35] "POST /debug_info HTTP/1.1" 200 2733       
127.0.0.1 - - [06/Mar/2025 15:09:35] "POST /receive_messages HTTP/1.1" 200 4    
127.0.0.1 - - [06/Mar/2025 15:09:45] "POST /receive_messages HTTP/1.1" 200 4
ycmd_59613_stdout_k78mhyyl.log
127.0.0.1 - - [06/Mar/2025 15:08:45] "POST /receive_messages HTTP/1.1" 200 4    
127.0.0.1 - - [06/Mar/2025 15:08:55] "POST /receive_messages HTTP/1.1" 200 4    
127.0.0.1 - - [06/Mar/2025 15:09:05] "POST /receive_messages HTTP/1.1" 200 4    
127.0.0.1 - - [06/Mar/2025 15:09:15] "POST /receive_messages HTTP/1.1" 200 4    
127.0.0.1 - - [06/Mar/2025 15:09:24] "POST /debug_info HTTP/1.1" 200 2733       
127.0.0.1 - - [06/Mar/2025 15:09:25] "POST /receive_messages HTTP/1.1" 200 4    
127.0.0.1 - - [06/Mar/2025 15:09:35] "POST /debug_info HTTP/1.1" 200 2733       
127.0.0.1 - - [06/Mar/2025 15:09:35] "POST /receive_messages HTTP/1.1" 200 4    
127.0.0.1 - - [06/Mar/2025 15:09:45] "POST /receive_messages HTTP/1.1" 200 4    
127.0.0.1 - - [06/Mar/2025 15:09:55] "POST /receive_messages HTTP/1.1" 200 4    
127.0.0.1 - - [06/Mar/2025 15:10:06] "POST /receive_messages HTTP/1.1" 200 4 

The contents of my ycm_extra_conf.py is:

"""Needed by YouCompleteMe
"""
# Copyright (C) 2014 Google Inc.
#
# This file is part of ycmd.
#
# ycmd is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ycmd is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with ycmd.  If not, see <http://www.gnu.org/licenses/>.
import os
import ycm_core

# These are the compilation flags that will be used in case there's no
# compilation database set (by default, one is not set).
# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.
flags = [
    '-I' , '/Users/matthew.hoggan/Devel/gitlab/mehoggan/dag_scheduler/stages_lib/include',
    '-I', '/Users/matthew.hoggan/Devel/gitlab/mehoggan/dag_scheduler/test/utils',
    '-I', '/Users/matthew.hoggan/Devel/gitlab/mehoggan/dag_scheduler/include',
    '-I', '/Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sdk/usr/include/c++/v1',
    '-I', '/usr/local/Cellar/boost@1.85/1.85.0_2/include',
    '-I', '/Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sdk/usr/include',
    '-isysroot', '/Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sdk/usr/include/c++/v1',
    '-isystem', '/Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sdk/usr/include/c++/v1',
    '-isysroot', '/Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sdk/usr/include',
    '-isystem', '/Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sdk/usr/include',
    '-x',
    'c++',
    '-Wall',
    '-std=c++17',
    '-std=gnu++17'
]


def DirectoryOfThisScript():
    """Helper method used by `Settings`
    """
    return os.path.dirname(os.path.abspath(__file__))


def Settings(** kwargs):
    """YCM API
    """
    return {
        'flags': flags,
        'include_paths_relative_to_dir': DirectoryOfThisScript()
    }

I am working on trying to run the clangd command to see why it is failing to generate the index.

An example of what I am seeing in vim is:

  #ifndef TASK_STAGE_H_INCLUDED                                                   
  #define TASK_STAGE_H_INCLUDED                                                   
                                                                                                                                              
  #include <ostream>                                                                                                                          
  #include <sstream>                                                                                                                          
                                                                                                                                              
E #include "dag_scheduler/uuid.h" // E: 'dag_scheduler/uuid.h' file not found     
                                                                                                                                              
  namespace com {                                                                                                                             
  namespace dag_scheduler {                                                       
  class BaseTaskStage {                                                            
   public:                                                                                                                                    
    /**                                                                                                                                       
     * @brief default ctor                                                        
     */                                                                                                                                       
    BaseTaskStage();                                                                                                                          
                                                                                                                                              
    /**                                                                                                                                       
     * @brief A constructor for a BaseTaskStage that assigns a user defined       
     *        label.                                                                                                                          
     *                                                                                                                                        
     * The \p label is used only to describe what the task is for. It             
     * does not impact what the task does or how it operates.                     
     *                                                                                                                                        
     * @param[in] label The user defined label.                                   
     */                                                                                                                                       
    explicit BaseTaskStage(const std::string &label);                             
                                                                                                                                              
    /**                                                                                                                                       
     * @brief dtor                                                                                                                            
     */                                                                                                                                       
    virtual ~BaseTaskStage();                                                     
                                                                                                                                              
W   BaseTaskStage(const BaseTaskStage &other) = delete; // W: Deleted function definitions are a C++11 extension
                                                                                                                                              
W   BaseTaskStage &operator=(const BaseTaskStage &other) = delete; // W: Deleted function definitions are a C++11 extension

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions