5

I've just updated Xcode to version 9 and I've started getting the following error message when compiling:


The issue seems to be linked to compiling with the "Optimization Level" parameter set to "None" (i.e. -O0). If I set this higher the error goes away, BUT when I increase the optimization the debugging tools do not work appropriately (for example variable tracking).

I've looked at other questions that list this error, but they either involve some kind of duplicate '-isystem' or don't involve Xcode at all.

I'm currently compiling a program using an external clang downloaded via macports (port clang-5.0) in order to debug using openmp (which does not come with the default clang shipped with mac os).

Any suggestions?

Jvinniec
  • 616
  • 12
  • 18

1 Answers1

8

I was getting the same error when trying to enable OpenMP in Xcode 9.

Finally able to fix the problem by changing some Xcode 9 settings found from this:

In build settings > build options > Enable Index-While-Building Functionality to No

enter image description here

safat siddiqui
  • 311
  • 1
  • 3
  • 7
  • 1
    In all honesty, I got a little tired of dealing with XCode changes every few months that interrupted my development cycle, so after hitting this issue I made the change to Visual Studio Code (a change I'm very happy with). However, I made a minimal xcode project that was able to reproduce my above issue and your suggestion resolved it, so I accept this as the solution. – Jvinniec Feb 12 '18 at 08:31
  • When using `clang` on the command line, a similar option exists: `-index-store-path`. Removing it fixed the error. – lionello Dec 11 '18 at 07:53
  • You beautiful human, you. Thank you for this. I went down a multi-hour rabbit hole yesterday trying all sorts of settings and updates to clang, llvm, XCode. Starting fresh and changing this setting is what got me past this error (and onto others haha). Thanks! – Joshua Pinter Apr 07 '19 at 14:50