Redefinition of error 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 Down...

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's user avatar

yoAlex5

26.5k8 gold badges180 silver badges191 bronze badges

asked Jul 10, 2018 at 0:18

AndyRoid's user avatar

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.

answered Jul 10, 2018 at 6:51

AndyRoid's user avatar

AndyRoidAndyRoid

5,0028 gold badges37 silver badges73 bronze badges

4

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

answered Dec 3, 2019 at 13:56

yoAlex5's user avatar

yoAlex5yoAlex5

26.5k8 gold badges180 silver badges191 bronze badges

Try removing Command-line tools and build your project

sudo rm -rf /Library/Developer/CommandLineTools 

To Reinstall:

xcode-select --install

answered Apr 17, 2020 at 9:08

Jitesh Middha's user avatar

0

Since I updated to xcode 8.3 I can’t compile my project, it was compiling fine with the previous version of xcode. It contains a framework and it now fails to compile the framework.

It fails with many errors about redefined module like so:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/module.modulemap:1:8: error: redefinition of module 'AppleTextureEncoder'
module AppleTextureEncoder [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk/usr/include/module.modulemap:1:8: note: previously defined here
module AppleTextureEncoder [system] [extern_c] {

These are not my modules.

I saw the release note mentioning something related, but I do not understand how to apply the work around. My project has no module map file defined in the setting, what should I rename it to? The error points to xcode own modules, so I am confused.

I haven’t been able to compile any of my project since xcode 8.3 as they all show the same error… My project and framework mix objective c and swift 3.0

thanks!

When building a framework that has module maps in both the source and the install directories that define the same module, the compiler will show a redefinition message. (28638816)Workaround: Rename the module map file in the source directory to a non-default name (the default name is

module.modulemap

or

module.map

), and set the Module Map File build setting to the renamed module map.

Replies

Same issue with xcode 8.3.1 😟

I don’t think that Xcode fix has anything to do with your problem, since you don’t declare your own module maps.

Instead, it looks like your target is being linked against both the iOS device and iOS simulator libraries, and you’re probably going to have to a bit of detective work on your project to figure out why. Note that it could be there was always something wrong with your project, but Xcode didn’t care before 8.3, or it could be that when Xcode updated your project for 8.3 it did something wrong.

Look in the General tab of the project editor, and see if there’s anything odd there. (It shouldn’t list any system frameworks, because these are found automatically these day, I believe.) Also check the Build Phases tab, especially the Link With Binaries phase. Also check the framework and include path build settings. Sometimes Xcode will migrate an old unwanted path into one of those.

Thanks a lot.

I have been doing quite a bit of investigative work on the project settingsm and comparing with a fresh new project settings, but didn’t figure it out yet. I noticed also that it actually compiles if I choose an iOS device, but only fails against the simulator.

I recreated the whole project from scratch in xcode 8.3.2, reimporting the source code manually and using fresh default settings. Interestingly the new project compile now against the simulator but fails against iOS (with the same redefinition error).

I also tried to study the command line that fails (and my environment variables) for any hints to ios reference but to no avail. Here is the full command line

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file /Users/brice/Development/xcode/RZUtils/src/universal/swift/RZSLog.swift -target x86_64-apple-ios9.0 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk -I /Users/brice/Library/Developer/Xcode/DerivedData/GarminConnect-dxmvrwpwzpqxffggolvmfzhyupdx/Build/Products/Debug-iphonesimulator -F /Users/brice/Library/Developer/Xcode/DerivedData/GarminConnect-dxmvrwpwzpqxffggolvmfzhyupdx/Build/Products/Debug-iphonesimulator -enable-testing -g -import-underlying-module -module-cache-path /Users/brice/Library/Developer/Xcode/DerivedData/ModuleCache -serialize-debugging-options -Xcc -I/Users/brice/Library/Developer/Xcode/DerivedData/GarminConnect-dxmvrwpwzpqxffggolvmfzhyupdx/Build/Intermediates/RZUtils.build/Debug-iphonesimulator/RZUtils.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/brice/Library/Developer/Xcode/DerivedData/GarminConnect-dxmvrwpwzpqxffggolvmfzhyupdx/Build/Intermediates/RZUtils.build/Debug-iphonesimulator/RZUtils.build/RZUtils-generated-files.hmap -Xcc -I/Users/brice/Library/Developer/Xcode/DerivedData/GarminConnect-dxmvrwpwzpqxffggolvmfzhyupdx/Build/Intermediates/RZUtils.build/Debug-iphonesimulator/RZUtils.build/RZUtils-own-target-headers.hmap -Xcc -I/Users/brice/Library/Developer/Xcode/DerivedData/GarminConnect-dxmvrwpwzpqxffggolvmfzhyupdx/Build/Intermediates/RZUtils.build/Debug-iphonesimulator/RZUtils.build/RZUtils-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/brice/Library/Developer/Xcode/DerivedData/GarminConnect-dxmvrwpwzpqxffggolvmfzhyupdx/Build/Intermediates/RZUtils.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/brice/Library/Developer/Xcode/DerivedData/GarminConnect-dxmvrwpwzpqxffggolvmfzhyupdx/Build/Intermediates/RZUtils.build/Debug-iphonesimulator/RZUtils.build/RZUtils-project-headers.hmap -Xcc -I/Users/brice/Library/Developer/Xcode/DerivedData/GarminConnect-dxmvrwpwzpqxffggolvmfzhyupdx/Build/Products/Debug-iphonesimulator/include -Xcc -I/Users/brice/Library/Developer/Xcode/DerivedData/GarminConnect-dxmvrwpwzpqxffggolvmfzhyupdx/Build/Intermediates/RZUtils.build/Debug-iphonesimulator/RZUtils.build/DerivedSources/x86_64 -Xcc -I/Users/brice/Library/Developer/Xcode/DerivedData/GarminConnect-dxmvrwpwzpqxffggolvmfzhyupdx/Build/Intermediates/RZUtils.build/Debug-iphonesimulator/RZUtils.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -DGC_IOS=1 -Xcc -ivfsoverlay -Xcc /Users/brice/Library/Developer/Xcode/DerivedData/GarminConnect-dxmvrwpwzpqxffggolvmfzhyupdx/Build/Intermediates/RZUtils.build/Debug-iphonesimulator/RZUtils.build/unextended-module-overlay.yaml -Xcc -working-directory/Users/brice/Development/xcode/RZUtils -emit-module-doc-path /Users/brice/Library/Developer/Xcode/DerivedData/GarminConnect-dxmvrwpwzpqxffggolvmfzhyupdx/Build/Intermediates/RZUtils.build/Debug-iphonesimulator/RZUtils.build/Objects-normal/x86_64/RZSLog~partial.swiftdoc -serialize-diagnostics-path /Users/brice/Library/Developer/Xcode/DerivedData/GarminConnect-dxmvrwpwzpqxffggolvmfzhyupdx/Build/Intermediates/RZUtils.build/Debug-iphonesimulator/RZUtils.build/Objects-normal/x86_64/RZSLog.dia -Onone -parse-as-library -module-name RZUtils -emit-module-path /Users/brice/Library/Developer/Xcode/DerivedData/GarminConnect-dxmvrwpwzpqxffggolvmfzhyupdx/Build/Intermediates/RZUtils.build/Debug-iphonesimulator/RZUtils.build/Objects-normal/x86_64/RZSLog~partial.swiftmodule -emit-dependencies-path /Users/brice/Library/Developer/Xcode/DerivedData/GarminConnect-dxmvrwpwzpqxffggolvmfzhyupdx/Build/Intermediates/RZUtils.build/Debug-iphonesimulator/RZUtils.build/Objects-normal/x86_64/RZSLog.d -emit-reference-dependencies-path /Users/brice/Library/Developer/Xcode/DerivedData/GarminConnect-dxmvrwpwzpqxffggolvmfzhyupdx/Build/Intermediates/RZUtils.build/Debug-iphonesimulator/RZUtils.build/Objects-normal/x86_64/RZSLog.swiftdeps -o /Users/brice/Library/Developer/Xcode/DerivedData/GarminConnect-dxmvrwpwzpqxffggolvmfzhyupdx/Build/Intermediates/RZUtils.build/Debug-iphonesimulator/RZUtils.build/Objects-normal/x86_64/RZSLog.o

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/module.modulemap:1:8: error: redefinition of module ‘AppleTextureEncoder’

module AppleTextureEncoder [system] [extern_c] {

^

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk/usr/include/module.modulemap:1:8: note: previously defined here

module AppleTextureEncoder [system] [extern_c] {

^

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/module.modulemap:7:8: error: redefinition of module ‘Compression’

module Compression [system] [extern_c] {

^

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk/usr/include/module.modulemap:7:8: note: previously defined here

module Compression [system] [extern_c] {

From your transcript:

-module-cache-path /Users/brice/Library/Developer/Xcode/DerivedData/ModuleCache

Have you tried deleting this folder? Note that everything in DerivedData is in theory re-creatable (at the expense of more build time at the point of re-creation).

Also, what is RZUtils? A framework? A static library? How you get it into your build? Note that if your main target relies on libraries that you’ve added to the target (e.g. in the General tab of the project info), you should check that its path is «relative to build products», rather than relative to a specific build folder. That could explain why same-named modules are being dragged in from different places.

Also, if RZUtils defines its own module map «manually», even though you didn’t do it, I suppose it’s possible that that subsystem ran afoul of the Xcode bug you mentioned earlier. If that’s the case, something in that project (GarminConnect?) may need to have the workaround applied. If this is code from a 3rd party, you might need to get them to fix it.

Hi, First, I just want to mention I really appreciate you helping me! Thanks a lot.

On your question, I tried to removed the derivedcache, it did not work 😟

RZUtils is a framework, I build, with all the shared component I want to use accros my different app and projects. It contains a few external packages (FMDatabase and LibComponentLogging). The framework contains both objective c and swift code. When I remove the swift code for the library it then compiles, so the problem is clearly mixing the two. I have build the framework quite a few generation of xcode ago, so the settings went through a few iteration of xcode update settings. GarminConnect is just one example of an app that include that framework and uses it. But all the app have the same problem.

I tried to recreate the framework from scratch by re-adding the source code to a fresh new xcode 8.3.2 framework project and it resulted in the same problem (though inverted; could compile on simulator but had redefinition error on ios built…)

What I will try today is to rebuild the framework more incrementally adding a few sources at a time see when it starts failing. (the freshly created framework of course compiles on both target)

Also I can share a sample small app trying to use the framework if you want to take a look.

Final update. I have recreated the framework project from scratch step by step and split the swift library from the objective c library.

It works now. I am not going to try further to fix the original process. Wasted a few hours, but glad it works again!

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.

Already on GitHub?
Sign in
to your account

Comments

@nabbestemmia

I’m trying to run my project with XCode 10 beta, but I get an error saying: redefinition of module ‘CommonCrypto’.

Showing All Messages
Failed to emit precompiled header ‘…/Library/Developer/Xcode/DerivedData/dukzbmbkgxmidoaaqsvrwtawkugp/Build/Intermediates.noindex/PrecompiledHeaders/Bridging-Header-swift_2EL3O7W05IR7C-clang_1MOIT4BKL3MYZ.pch’ for bridging header ‘…/Bridging-Header.h’

@sadaf-behbahani

I have the same issue. Do you have any idea ?

@YJSai

go to CommonCrypto directory, check any .modulmap files then you can find how they declare module name like below

module CommonCrypto [system] {
}

replace ‘CommonCrypto’ to any name you prefer
and also change the imported module name to new name

@jaelee1993

Did ^^ fix work guys? Having the same issue here

@zlata

Any update? Having the same issue here

@zlata

@einarnot

Please include a fix for this in the repo

@henrinormak

As I have been quite distant from iOS development for a while, if you could open a PR I would gladly merge a fix (assuming it will work as the sole dependency declaring CommonCrypto as well as with others).

@henrinormak

This should be fixed as of #73/#74 (thanks @einarnot for the PR), please confirm and I’ll close the issue. Pushed 2.0.0 release/tag with the fix.

@einarnot

It now works, but I introduced a bug causing device-builds to fail. Created a new PR with a fix. #76

@henrinormak

Thanks, I will push this to cocoapods soon (don’t have access to cocoapods atm), tagged the release already though — 2.0.1

@mobihunterz

Deleting folder Pods/Heimdall/CommonCrypto fixing this issue. Here’s fix for packaging jonblatho/JSONWebToken.swift@44f4b7a

Worked for me as well. My issues was with Mattress pod. CommonCrypto is not related to particular framework I believe.

I recently upgraded to Snow Leopard and Xcode 3.2.5 so I could test on my iPod Touch and iPhone and ran into some problems with the project I was working on. First it couldn’t find a Base SDK, then my old frameworks weren’t hooking up correctly. Finally after setting the Project Format to Xcode 3.1 compatible (3.2 also worked) and the Base SDK for all configurations to iOS 4.2, then setting my iOS deployment target to iOS 3.0 I was able to get the system to find a Base SDK and attempt a build. That’s when the frameworks didn’t want to cooperate. 4/6 I’m using displayed in red, so I re routed the path to the iPhone simulator 4.2 platform which worked perfectly. I was able to build my project, no errors or warnings and my app worked fine. I went to work last night thinking I had fixed the problem. This morning I fired up the laptop and went to build my code base and now have 1142 errors all of which have to do with code I haven’t written deemed as being redefined. Suggestions? The following is just a small sample of the error list (obviously don’t need to see all 1142)

//Frameworks/Foundation.framework/Headers/NSZone.h:48: error: redefinition of ‘NSMakeCollectable’

/Frameworks/Foundation.framework/Headers/NSObject.h:65: error: duplicate interface declaration for class ‘NSObject’

/Frameworks/Foundation.framework/Headers/NSObject.h:67: error: redefinition of ‘struct NSObject’

© Stack Overflow or respective owner

Related posts about iphone

  • iphone — direct link to iPhone review form from inside iphone

    as seen on Stack Overflow
    — Search for ‘Stack Overflow’

    I am trying to link directly to the review link of one of my Apps. I know that it is possible because Appirater did it in the past, but some change in iTunes turned the API down.
    Appirater uses this URL
    NSString *templateReviewURL = @»itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews…
    >>> More

  • Buy iPhone 4 Without Contract: $599 (AT&T) and $699 (Verizon)

    as seen on Tech Dreams
    — Search for ‘Tech Dreams’

    Purchasing iPhone without a contract is a good option when you are planning to gift it to someone or going to use it outside US. Both AT&T and Verizon lets you iPhone 4 without a contract but this information is buried deep under blurred text in FAQs and agreements. 
    Here is the pricing…
    >>> More

  • Is it possible to download and run IPhone apps on an IPhone emulator

    as seen on Stack Overflow
    — Search for ‘Stack Overflow’

    Hi,
    I am tasked to provide an IPhone client app for our SaaS website. I have never written an IPhone application, nor do I have an IPhone at the moment. Before I can decide whether or not I want to do this myself or outsource this, I’d like to try a few apps myself to get a feeling for the UI.
    Is…
    >>> More

  • iPhone web app from dashcode rss feed template works deployed on simulator but not on iphone

    as seen on Stack Overflow
    — Search for ‘Stack Overflow’

    iPhone web app from dashcode rss feed template works deployed on simulator but not on iphone.
    The web app is deployed at;
    http://www.alila.se/wordpress/index.html
    If i run the simulator and enter that adress, it fetches the rss feed and displays it. Everything fine. When i enter the adress into…
    >>> More

  • Problem running iPhone application on iPhone from Xcode (and in Instruments)

    as seen on Stack Overflow
    — Search for ‘Stack Overflow’

    Hi
    I have a problem running one application on the iPhone from Xcode (or Instruments).
    When I try to run the app I get the error message Failed to upload XXX.app in the bottom left corner of Xcode. The strange thing is it actually uploaded the app to the iPhone but it doesn’t start it (after this…
    >>> More

Related posts about xcode

  • Xcode 3 or Xcode 4

    as seen on Programmers
    — Search for ‘Programmers’

    Hi. I’m starting to learn development for the mac (then I’ll learn iOS development). I just buy an iOS developer program, and I see there are 2 IDEs available for download: Xcode 3.x and Xcode 4 (GM Status). So I don’t know where to start. Site’s says that Xcode 4 its now «integrated» so there is…
    >>> More

  • Running Xcode Applications without installing Xcode

    as seen on Stack Overflow
    — Search for ‘Stack Overflow’

    I know nothing about Xcode, except it’s a Developer interface from Apple that actually comes on OSX CD and it’s used to create iPhone apps as well.
    I also know it have a Applications folder, filled with little utilities, that are indeed quite useful. I tried grabbing one of them and running, without…
    >>> More

  • From Xcode 3.2.2 to Xcode 3.2.3

    as seen on Stack Overflow
    — Search for ‘Stack Overflow’

    Hi Everyone!
    Yesterday I felt in big issue that happens with all my projects. After I installed new Xcode 3.2.3 (for iPhone OS 4), all my projects started to spit out the «referenced from:» errors. I noticed that in new Xcode all the iPhone SDK versions earlier than 3.2 removed. But I have a projects…
    >>> More

  • Xcode : How to add support OS 3.0 in XCode 3.2.3

    as seen on Stack Overflow
    — Search for ‘Stack Overflow’

    Hi,
    Is there any way to detect the SDK prior to 3.1.3 in the latest XCode that is 3.2.3.
    Looking for answers.
    Thank You.
    >>> More

  • XCode vs VS2008 or how to work with a static library project on XCode

    as seen on Stack Overflow
    — Search for ‘Stack Overflow’

    Hello.
    I’ve working with Visual Studio for a long time and now I’m working with XCode.
    On Visual Studio I can work with more than one project at the same time adding them to a solution (imagine a solutin with a windows application project and a library project).
    Now I have XCode and two projects:…
    >>> More

Categories cloud

Понравилась статья? Поделить с друзьями:
  • Reddragon mitra как изменить подсветку
  • Red4ext cyberpunk 2077 ошибка при запуске
  • Red state asus как исправить
  • Red square keyrox tkl classic как изменить подсветку
  • Red script compilation failed os error 5