Open iwahbe opened 4 years ago
I'm also running into the same issue after doing an irony upgrade (to irony-20190703.1732) at roughly the same time that I did an OS upgrade (to OSx 10.14), which also included an Xcode upgrade.
irony is working just fine, except that it's not finding any of the headers from either the c or c++ standard library.
I've tried building irony with the four llvm builds on my system, which include the native Xcode (prefix path: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/), and three different versions from MacPorts: llvm-8.0, llvm-7.0, and llvm-6.0 (which is what I think I was using before).
The irony-server seems to be building just fine:
-*- mode: compilation; default-directory: "/var/folders/2y/hqhdgbyj6vnf40gnhzlpjn540000gn/T/build-irony-server-1.3.1/" -*-
Compilation started at Wed Oct 2 15:05:21
cmake -DCMAKE_PREFIX_PATH=/opt/local/libexec/llvm-8.0/ -DCMAKE_CXX_COMPILER=/opt/local/libexec/llvm-8.0/bin/clang++ -DCMAKE_C_COMPILER=/opt/local/libexec/llvm-8.0/bin/clang -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON -DCMAKE_INSTALL_PREFIX\=/Users/worm/.emacs.d/irony/ /Users/worm/.emacs.d/elpa/irony-20190703.1732/server && cmake --build . --use-stderr --config Release --target install
-- The C compiler identification is Clang 8.0.1
-- The CXX compiler identification is Clang 8.0.1
-- Check for working C compiler: /opt/local/libexec/llvm-8.0/bin/clang
-- Check for working C compiler: /opt/local/libexec/llvm-8.0/bin/clang -- 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: /opt/local/libexec/llvm-8.0/bin/clang++
-- Check for working CXX compiler: /opt/local/libexec/llvm-8.0/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Irony package version is '1.3.1'
-- Found emacs: /usr/local/bin/emacs
-- Configuring done
-- Generating done
-- Build files have been written to: /var/folders/2y/hqhdgbyj6vnf40gnhzlpjn540000gn/T/build-irony-server-1.3.1
Scanning dependencies of target irony-server
[ 12%] Building CXX object src/CMakeFiles/irony-server.dir/support/CommandLineParser.cpp.o
[ 25%] Building CXX object src/CMakeFiles/irony-server.dir/support/TemporaryFile.cpp.o
[ 37%] Building CXX object src/CMakeFiles/irony-server.dir/Command.cpp.o
[ 50%] Building CXX object src/CMakeFiles/irony-server.dir/CompDBCache.cpp.o
[ 62%] Building CXX object src/CMakeFiles/irony-server.dir/Irony.cpp.o
[ 75%] Building CXX object src/CMakeFiles/irony-server.dir/TUManager.cpp.o
[ 87%] Building CXX object src/CMakeFiles/irony-server.dir/main.cpp.o
[100%] Linking CXX executable ../bin/irony-server
[100%] Built target irony-server
Install the project...
-- Install configuration: ""
-- Installing: /Users/worm/.emacs.d/irony/bin/irony-server
Interestingly, when I use llvm-7.0 or llvm-8.0, flycheck-irony can't find the header files themselves, but it's not complaining about the functions that should be in those headers and company-irony is suggesting them for me (i.e. #include
However, when I use llvm-6.0 or Xcode, flycheck doesn't complain on the header files and instead complains on the functions (for instance, memset and memcpy both result in "undeclared identifier" errors).
I've played around with manually setting the LIBCLANG_LIBRARY and LIBCLANG_INCLUDE_DIR options, and I've used install_name_tool to force irony-server to point to the correct libclang.dylib, but I'm still seeing the same issues.
I've been through many battles over the years with reconfiguring irony after llvm updates, but this one finally has me stumped.
Ok, I bit the bullet and added my system include paths to a .clang_complete file (as per the Mac OS X issues and workaround wiki entry) and now it seems like everything's working again. So I was probably just taking up extra bandwidth by adding to this thread, since it seems like that's pretty much the go-to fix for header issues on a Mac.
But I'm still curious about why irony doesn't automatically know where the system headers are. I'm assuming that these would be built into the libclang library, and they're clearly available to clang, since I can compile with it without adding extra -I's.
As an aside, and perhaps a path to a possible solution: xcode has a command called "xcrun" to set up a build environment for you. In fact, all of the clang commands that MacPorts installs are just scripts that run "xcrun /path/to/executable/clang-tool." If I try to run those executables on their own without xcrun then I get the same errors that irony throws. Unfortunately, running irony-server with xcrun doesn't make any difference.
When I have a .c file open, emacs cannot auto-complete on standard library .h files, and functions from standard library .h files show up as errors. On my
#includes
I get 'string.h' file not found'. However, I can use cmake to build what I write with standard libraries. Please help. This the relevant part of my init file:When I reinstall the irony server, this is the message I get: