Skip to content

C autocomplete and clang indexing is once again broken #10514

Closed

Description

@DavisVaughan

System details

RStudio Edition : Desktop
RStudio Version : Preview 2022.02.0 Build 392 (But also in the daily!)
OS Version      :  macOS Monterey
R Version       : 4.1.1

Steps to reproduce the problem

Screen Shot 2022-02-07 at 9 46 41 AM

Here are the clang diagnostics from .rs.setClangDiagnostics(2). It looks like the R headers aren't being included at all?

> .rs.setClangDiagnostics(2)
Attemping to load libclang for x86_64-apple-darwin17.0 
/Applications/RStudio.app/Contents/MacOS/rsclang/libclang.dylib
   (Not Found)
/Library/Developer/CommandLineTools/usr/lib/libclang.dylib
   LOADED: 13.0.0

Restarting R session...

> 
CLANG INDEXING: /Users/davis/Desktop/r/playground/packages/testcppautocomplete/src/code.c
# RESTORING PACKAGE COMPILATION CONFIG ----
/Users/davis/Desktop/r/playground/packages/testcppautocomplete/.Rproj.user/49404F48/cpp-compilation-config
{
    "args": [
        "-I/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include",
        "-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1",
        "-I/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include",
        "-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include",
        "-I/Library/Developer/CommandLineTools/usr/include"
    ],
    "pch": "",
    "is_cpp": false,
    "hash": "16323402221644244300",
    "compiler": "3328171544225527596",
    "rversion": "4.1.1"
}

# COMPILATION ARGUMENTS ----
[
    "-I/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include",
    "-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1",
    "-I/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include",
    "-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include",
    "-I/Library/Developer/CommandLineTools/usr/include",
    "-v"
]
  (Creating new index)
Apple clang version 13.0.0 (clang-1300.0.27.3)
Target: x86_64-apple-darwin21.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/local/include"
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Library/Frameworks"
ignoring duplicate directory "/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include"
ignoring duplicate directory "/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include"
  as it is a non-system directory that duplicates a system directory
ignoring duplicate directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include"
  as it is a non-system directory that duplicates a system directory
ignoring duplicate directory "/Library/Developer/CommandLineTools/usr/include"
  as it is a non-system directory that duplicates a system directory
#include "..." search starts here:
#include <...> search starts here:
 /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1
 /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include
 /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
 /Library/Developer/CommandLineTools/usr/include
 /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory)
End of search list.
/Users/davis/Desktop/r/playground/packages/testcppautocomplete/src/code.c:2:10: fatal error: 'R.h' file not found
TOTAL MEMORY: 400 kb (code.c)
PERFORMANCE 146 ms (code.c)

Activity

  1. DavisVaughan commented on Feb 7, 2022

    @DavisVaughan
    Author

    Note that I just updated to macOS Monterey from Mojave and also immediately updated my RStudio version to the daily version (to use Quarto). I have no idea if this is related to the Monterey update or not.

  2. ronblum commented on Feb 7, 2022

    @ronblum
    Contributor

    I can reproduce the problem in the following:

    • RStudio Desktop 1.3.1093, 2021.09.2+382, and 2022.02.0+420 on MacOS 12.1
    • RStudio Desktop 2022.02.0+406

    However, it works in

    • RStudio Desktop 1.1.463 and 1.2.5042 on MacOS 12.1

    Also, there are issues in init.c:
    init

    Note: Marking as triage to consider the milestone.

  3. DavisVaughan commented on Feb 8, 2022

    @DavisVaughan
    Author

    Can confirm that Kevin's fix is working in the latest daily

  4. valerie-rstudio commented on Feb 8, 2022

    @valerie-rstudio

    Verified Fixed

    RStudio Edition : Desktop
    RStudio Version : 2022.02.0-427
    OS Version      : mac os 11.5.2
    R Version       : 3.6.3
    

    Summary

    Verified that C code autocomplete is now working as expected.

    Automation

    • N/A, only occurring on desktop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions