5

image of errors in Xcode

Encountering this issue in Xcode, solutions I've tried:

  • Enabled modules to YES and NO
  • Reinstalled Xcode 9.4.1 by deleting 9.4.1 and ~/Library/Developer
  • Downgraded command lines tools to 9.4.1
  • Downgraded Cocoapods to 1.4.0 from 1.5.3

I'm at a loss at this point can someone point me to the right direction here? I've already spent an entire day on this. Other projects build fine though.

yoAlex5
  • 29,217
  • 8
  • 193
  • 205
AndyRoid
  • 5,062
  • 8
  • 38
  • 73

3 Answers3

5

I SOLVED IT!

XCode was adding the following Header Search Paths:

/usr/include/libxml2 recursive
/usr/include/libxml2 non-recursive

But libxml2 is already included in the SDK from XCode.app via $(inherited) search path so everything was conflicting.

Removed those two /usr/include/libxml2 paths at the top of my folder hierarchy fixed it!

Thank the XCode gods.

AndyRoid
  • 5,062
  • 8
  • 38
  • 73
  • 1
    could you add more details? how did you remove them? – Hatim Apr 05 '20 at 04:25
  • I have been looking in the various paths that Xcode has for the 'Hello' sample of Vapor, but there are no such entries. Where exactly did you re-arrange things or removed 'duplicates'? – El Architect Apr 10 '20 at 11:48
  • 1
    Can you be more specific on the resolution? Was this a project-specific issue? Did you update build settings? If so, where in Build Settings. – Adrian May 23 '20 at 12:36
  • 1-) Open Terminal 2-) Paste this line to terminal /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include 3-) delete the extra libxml files (In my case there was extra "libxml 1" and "modulemap" files) 4-) Restart xcode and run – Ahmet Kazim Günay Aug 15 '21 at 09:42
2

Error: redefinition of module

I got redefinition of module when was working on own framework and added a first .m file (as a part of Cocoa Touch Class) and created module.modulemap file. Please note that this error is shown even if you do not add a path into Module Map File

To solve this issue I just renamed a module.modulemap to ModuleName.modulemap

yoAlex5
  • 29,217
  • 8
  • 193
  • 205
-4

Try removing Command-line tools and build your project

sudo rm -rf /Library/Developer/CommandLineTools 

To Reinstall:

xcode-select --install
Jitesh Middha
  • 389
  • 3
  • 10