3

I know a lot of people are getting this error when trying to compile their app in Xcode 8 Beta 3, however none of the available answers here seemed to help me.

While trying to run my app, I got the usual error: (null): Found an unexpected Mach-O header code: 0x72613c21, and when I expanded the information, I was given this in return:

Effective srcDirs: {(
    <DVTFilePath:0x6000008bb0c0:'/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos'>,
    <DVTFilePath:0x6080002a00c0:'/Applications/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/lib/swift/iphoneos'>
)}
error: Found an unexpected Mach-O header code: 0x72613c21

Note: I see something in the file path about Swift_2.3 which might lead to some answers, but I am not sure.

It could have also possibly been a problem with my Podfile, so I followed the directions posted in this StackOverflow answer and pasted the following line of code into my podfile, so that at the end my podfile looked like this:

# Uncomment this line to define a global platform for your project
platform :ios, '9.0'

target 'Roast' do
  # Comment this line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

pod 'Firebase'
pod 'Firebase/Core'
pod 'Firebase/Database'
pod 'Firebase/Auth'
pod 'Firebase/AdMob'
pod 'JSQMessagesViewController'

  target 'RoastTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

target 'RoastKeyboard' do
  # Comment this line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!
  pod 'Firebase'
  pod 'Firebase/Core'
  pod 'Firebase/Database'
  pod 'Firebase/Auth'

  # Pods for RoastKeyboard

end

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'] = 'NO'
        end
    end
end

And I updated my pods.

However, that effectively did nothing.

This is a super annoying error, because I just spent the last two hours fixing bugs in my code and now I get an error that is probably not even my fault.

If anybody could help me out, that would be awesome. Thanks!

Community
  • 1
  • 1
Ahad Sheriff
  • 1,829
  • 8
  • 24
  • 46
  • 1
    I'm getting the same error. Seems to be a problem with the Crashlytics framework (and possibly others). Log a radar to get the issue prioritized. In the meantime, you can either not link to the offending framework, or try a non-beta version of Xcode if you can. – Mark Jul 23 '16 at 14:54
  • I have the same error. Any solution this annoying error? – fdlr Jul 25 '16 at 11:50
  • It just bit me today too. None of the things suggested worked for me. I'm not using Crashlytics. – Tap Forms Jul 28 '16 at 04:09
  • @TapForms Yeah I tried everything but couldn't figure it out. I downgraded both Xcode and my version of iOS so that its stable for now at least. Thought I would get a head start on iOS 10 development but guess not now – Ahad Sheriff Jul 28 '16 at 05:42

1 Answers1

1

Looks like this issue has been fixed in Xcode 8.0 (beta 4).. So you don't need to try following stuff.

Issue seems to be with Xcode was getting confused with Toolchain directory path, when build includes both swift and objc headers.

One way to fix is

  1. Patch the SDK header files for use with the compiler ( stupid thing doesn't like the new headers! ) or
  2. Use the old header files ( which are great, but some things dont work/exist the same anymore! ) or
  3. Use the following settings in your Makefile to avoid warnings and errors during compilation and linking:

CC=/usr/bin/clang

CFLAGS=-fsigned-char -g -ObjC -fobjc-exceptions \ -Wall -Wundeclared-selector -Wreturn-type -Wnested-externs \ -Wredundant-decls \ -Wbad-function-cast \ -Wchar-subscripts \ -Winline -Wswitch -Wshadow \ -I/var/include \ -I/var/include/gcc/darwin/4.0 \ -D_CTYPE_H_ \ -D_BSD_ARM_SETJMP_H \ -D_UNISTD_H_

CPPFLAGS=

LD=$(CC)

LDFLAGS=-lobjc \ -F/System/Library/Frameworks \ -framework CoreFoundation \ -framework Foundation \ -framework UIKit \ -framework CoreGraphics \ -L/usr/lib -lc /usr/lib/libgcc_s.1.dylib \ -bind_at_load \ -multiply_defined suppress

iHS
  • 5,372
  • 4
  • 31
  • 49